Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Align NS_DECL_NSIWINDOWCREATOR2 implementation of the WindowCreator
The uri is no longer passed and is not really used. Let's just drop
it.
  • Loading branch information
rainemak committed Apr 8, 2020
1 parent 2d42f1f commit b92bd1e
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 24 deletions.
4 changes: 2 additions & 2 deletions embedding/embedlite/EmbedLiteApp.cpp
Expand Up @@ -497,7 +497,7 @@ EmbedLiteApp::ChildReadyToDestroy()
}

uint32_t
EmbedLiteApp::CreateWindowRequested(const uint32_t& chromeFlags, const char* uri, const uint32_t& contextFlags, const uint32_t& parentId)
EmbedLiteApp::CreateWindowRequested(const uint32_t& chromeFlags, const uint32_t& contextFlags, const uint32_t& parentId)
{
EmbedLiteView* view = nullptr;
std::map<uint32_t, EmbedLiteView*>::iterator it;
Expand All @@ -508,7 +508,7 @@ EmbedLiteApp::CreateWindowRequested(const uint32_t& chromeFlags, const char* uri
break;
}
}
uint32_t viewId = mListener ? mListener->CreateNewWindowRequested(chromeFlags, uri, contextFlags, view) : 0;
uint32_t viewId = mListener ? mListener->CreateNewWindowRequested(chromeFlags, contextFlags, view) : 0;
return viewId;
}

Expand Down
3 changes: 1 addition & 2 deletions embedding/embedlite/EmbedLiteApp.h
Expand Up @@ -48,7 +48,6 @@ class EmbedLiteAppListener
virtual void OnObserve(const char* aMessage, const char16_t* aData) {}
// New Window request which is usually coming from WebPage new window request
virtual uint32_t CreateNewWindowRequested(const uint32_t& chromeFlags,
const char* uri,
const uint32_t& contextFlags,
EmbedLiteView* aParentView) { return 0; }
virtual void LastViewDestroyed() {};
Expand Down Expand Up @@ -185,7 +184,7 @@ class EmbedLiteApp
void ViewDestroyed(uint32_t id);
void WindowDestroyed(uint32_t id);
void ChildReadyToDestroy();
uint32_t CreateWindowRequested(const uint32_t& chromeFlags, const char* uri, const uint32_t& contextFlags, const uint32_t& parentId);
uint32_t CreateWindowRequested(const uint32_t& chromeFlags, const uint32_t& contextFlags, const uint32_t& parentId);
EmbedLiteAppListener* GetListener();
MessageLoop* GetUILoop();
static void PreDestroy(EmbedLiteApp*);
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/PEmbedLiteApp.ipdl
Expand Up @@ -18,7 +18,7 @@ nested(upto inside_cpow) sync protocol PEmbedLiteApp {
parent:
async Initialized();
async ReadyToShutdown();
sync CreateWindow(uint32_t parentId, nsCString uri, uint32_t chromeFlags, uint32_t contextFlags)
sync CreateWindow(uint32_t parentId, uint32_t chromeFlags, uint32_t contextFlags)
returns (uint32_t createdID, bool cancel);
async PrefsArrayInitialized(PrefSetting[] prefs);

Expand Down
Expand Up @@ -204,14 +204,13 @@ EmbedLiteAppProcessParent::RecvReadyToShutdown()

bool
EmbedLiteAppProcessParent::RecvCreateWindow(const uint32_t& parentId,
const nsCString& uri,
const uint32_t& chromeFlags,
const uint32_t& contextFlags,
uint32_t* createdID,
bool* cancel)
{
LOGT();
*createdID = mApp->CreateWindowRequested(chromeFlags, uri.get(), contextFlags, parentId);
*createdID = mApp->CreateWindowRequested(chromeFlags, contextFlags, parentId);
*cancel = !*createdID;
return true;
}
Expand Down
Expand Up @@ -42,7 +42,6 @@ class EmbedLiteAppProcessParent : public PEmbedLiteAppParent
virtual bool
RecvCreateWindow(
const uint32_t& parentId,
const nsCString& uri,
const uint32_t& chromeFlags,
const uint32_t& contextFlags,
uint32_t* createdID,
Expand Down
4 changes: 2 additions & 2 deletions embedding/embedlite/embedshared/EmbedLiteAppBaseChild.cpp
Expand Up @@ -187,9 +187,9 @@ EmbedLiteAppBaseChild::DeallocPEmbedLiteWindowChild(PEmbedLiteWindowChild* aActo
return true;
}

bool EmbedLiteAppBaseChild::CreateWindow(const uint32_t& parentId, const nsCString& uri, const uint32_t& chromeFlags, const uint32_t& contextFlags, uint32_t* createdID, bool* cancel)
bool EmbedLiteAppBaseChild::CreateWindow(const uint32_t& parentId, const uint32_t& chromeFlags, const uint32_t& contextFlags, uint32_t* createdID, bool* cancel)
{
return SendCreateWindow(parentId, uri, chromeFlags, contextFlags, createdID, cancel);
return SendCreateWindow(parentId, chromeFlags, contextFlags, createdID, cancel);
}

EmbedLiteViewChildIface*
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/embedshared/EmbedLiteAppBaseChild.h
Expand Up @@ -32,7 +32,7 @@ class EmbedLiteAppBaseChild : public PEmbedLiteAppChild,
EmbedLiteViewChildIface* GetViewByID(uint32_t aId);
EmbedLiteViewChildIface* GetViewByChromeParent(nsIWebBrowserChrome* aParent);
EmbedLiteWindowBaseChild* GetWindowByID(uint32_t aWindowID);
bool CreateWindow(const uint32_t& parentId, const nsCString& uri, const uint32_t& chromeFlags, const uint32_t& contextFlags, uint32_t* createdID, bool* cancel);
bool CreateWindow(const uint32_t& parentId, const uint32_t& chromeFlags, const uint32_t& contextFlags, uint32_t* createdID, bool* cancel);
static EmbedLiteAppBaseChild* GetInstance();

protected:
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/embedshared/EmbedLiteAppChildIface.h
Expand Up @@ -13,7 +13,7 @@ class EmbedLiteAppChildIface
public:
virtual EmbedLiteViewChildIface* GetViewByID(uint32_t aId) = 0;
virtual EmbedLiteViewChildIface* GetViewByChromeParent(nsIWebBrowserChrome* aParent) = 0;
virtual bool CreateWindow(const uint32_t& parentId, const nsCString& uri, const uint32_t& chromeFlags, const uint32_t& contextFlags, uint32_t* createdID, bool* cancel) = 0;
virtual bool CreateWindow(const uint32_t& parentId, const uint32_t& chromeFlags, const uint32_t& contextFlags, uint32_t* createdID, bool* cancel) = 0;
};

}}
Expand Down
3 changes: 1 addition & 2 deletions embedding/embedlite/embedthread/EmbedLiteAppThreadParent.cpp
Expand Up @@ -64,13 +64,12 @@ EmbedLiteAppThreadParent::RecvReadyToShutdown()

bool
EmbedLiteAppThreadParent::RecvCreateWindow(const uint32_t& parentId,
const nsCString& uri,
const uint32_t& chromeFlags,
const uint32_t& contextFlags,
uint32_t* createdID,
bool* cancel)
{
*createdID = mApp->CreateWindowRequested(chromeFlags, uri.get(), contextFlags, parentId);
*createdID = mApp->CreateWindowRequested(chromeFlags, contextFlags, parentId);
*cancel = !*createdID;
return true;
}
Expand Down
4 changes: 1 addition & 3 deletions embedding/embedlite/embedthread/EmbedLiteAppThreadParent.h
Expand Up @@ -40,9 +40,7 @@ class EmbedLiteAppThreadParent : public PEmbedLiteAppParent
const nsString& data) override;

virtual bool
RecvCreateWindow(
const uint32_t& parentId,
const nsCString& uri,
RecvCreateWindow(const uint32_t& parentId,
const uint32_t& chromeFlags,
const uint32_t& contextFlags,
uint32_t* createdID,
Expand Down
13 changes: 6 additions & 7 deletions embedding/embedlite/utils/WindowCreator.cpp
Expand Up @@ -35,11 +35,14 @@ NS_IMETHODIMP
WindowCreator::CreateChromeWindow2(nsIWebBrowserChrome* aParent,
uint32_t aChromeFlags,
uint32_t aContextFlags,
nsIURI* aURI,
nsITabParent* aOpeningTab,
mozIDOMWindowProxy *aOpener,
bool* aCancel,
nsIWebBrowserChrome* *_retval)
{
// Unused variables
(void)aOpeningTab;
(void)aOpener;
NS_ENSURE_ARG_POINTER(aCancel);
NS_ENSURE_ARG_POINTER(_retval);
*aCancel = false;
Expand All @@ -50,16 +53,12 @@ WindowCreator::CreateChromeWindow2(nsIWebBrowserChrome* aParent,
Desktop FF allow to create popup window if aChromeFlags == 1670, aContextFlags == 0
*/

nsCString spec;
if (aURI) {
aURI->GetSpec(spec);
}
LOGF("parent:%p, chrfl:%u, contfl:%u, spec:%s", aParent, aChromeFlags, aContextFlags, spec.get());
LOGF("parent: %p, chrome flags: %u, context flags: %u", aParent, aChromeFlags, aContextFlags);

EmbedLiteViewChildIface* parent = mChild->GetViewByChromeParent(aParent);
uint32_t createdID = 0;
uint32_t parentID = parent ? parent->GetID() : 0;
mChild->CreateWindow(parentID, spec, aChromeFlags, aContextFlags, &createdID, aCancel);
mChild->CreateWindow(parentID, aChromeFlags, aContextFlags, &createdID, aCancel);

if (*aCancel) {
return NS_OK;
Expand Down

0 comments on commit b92bd1e

Please sign in to comment.