Skip to content

Commit

Permalink
Merge branch 'embedlite' into embedlite_processImpl
Browse files Browse the repository at this point in the history
Conflicts:
	embedding/embedlite/EmbedLiteApp.cpp
	embedding/embedlite/embedthread/EmbedLiteViewThreadChild.h
  • Loading branch information
tmeshkova committed Dec 14, 2014
2 parents d4dc48f + f30b595 commit 323fe7e
Show file tree
Hide file tree
Showing 28 changed files with 1,386 additions and 1,324 deletions.
5 changes: 2 additions & 3 deletions embedding/embedlite/EmbedLiteApp.cpp
Expand Up @@ -400,14 +400,13 @@ void EmbedLiteApp::RemoveObservers(nsTArray<nsCString>& observersList)
}

EmbedLiteView*
EmbedLiteApp::CreateView(uint32_t aParent)
EmbedLiteApp::CreateView(uint32_t aParent, bool aIsPrivateWindow)
{
LOGT();
NS_ASSERTION(mState == INITIALIZED, "The app must be up and runnning by now");
mViewCreateID++;


PEmbedLiteViewParent* viewParent = static_cast<PEmbedLiteViewParent*>(mAppParent->SendPEmbedLiteViewConstructor(mViewCreateID, aParent));
PEmbedLiteViewParent* viewParent = static_cast<PEmbedLiteViewParent*>(mAppParent->SendPEmbedLiteViewConstructor(mViewCreateID, aParent, aIsPrivateWindow));
EmbedLiteView* view = new EmbedLiteView(this, viewParent, mViewCreateID);
mViews[mViewCreateID] = view;
return view;
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/EmbedLiteApp.h
Expand Up @@ -106,7 +106,7 @@ class EmbedLiteApp
// Must be called from same thread as StartChildThread, and before Stop()
virtual bool StopChildThread();

virtual EmbedLiteView* CreateView(uint32_t aParent = 0);
virtual EmbedLiteView* CreateView(uint32_t aParent = 0, bool aIsPrivateWindow = false);
virtual void DestroyView(EmbedLiteView* aView);

virtual void SetIsAccelerated(bool aIsAccelerated);
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/PEmbedLiteApp.ipdl
Expand Up @@ -16,7 +16,7 @@ parent:
returns (uint32_t createdID, bool cancel);

child:
PEmbedLiteView(uint32_t id, uint32_t parentId);
PEmbedLiteView(uint32_t id, uint32_t parentId, bool isPrivateWindow);
PreDestroy();
SetBoolPref(nsCString name, bool value);
SetCharPref(nsCString name, nsCString value);
Expand Down
1 change: 1 addition & 0 deletions embedding/embedlite/embedding.js
Expand Up @@ -297,6 +297,7 @@ pref("media.preload.auto", 2); // preload metadata if preload=auto
pref("image.mem.decodeondraw", true);
pref("image.mem.allow_locking_in_content_processes", false);
pref("image.mem.min_discard_timeout_ms", 10000);
pref("image.onload.decode.limit", 24); /* don't decode more than 24 images eagerly */

// SimplePush
pref("services.push.enabled", false);
Expand Down
4 changes: 2 additions & 2 deletions embedding/embedlite/embedprocess/EmbedLiteAppProcessChild.cpp
Expand Up @@ -198,10 +198,10 @@ EmbedLiteAppProcessChild::QuickExit()
}

PEmbedLiteViewChild*
EmbedLiteAppProcessChild::AllocPEmbedLiteViewChild(const uint32_t& id, const uint32_t& parentId)
EmbedLiteAppProcessChild::AllocPEmbedLiteViewChild(const uint32_t& id, const uint32_t& parentId, const bool& isPrivateWindow)
{
LOGT("id:%u, parentId:%u", id, parentId);
EmbedLiteViewProcessChild* view = new EmbedLiteViewProcessChild(id, parentId);
EmbedLiteViewProcessChild* view = new EmbedLiteViewProcessChild(id, parentId, isPrivateWindow);
view->AddRef();
return view;
}
Expand Down
4 changes: 2 additions & 2 deletions embedding/embedlite/embedprocess/EmbedLiteAppProcessChild.h
Expand Up @@ -7,7 +7,7 @@
#define MOZ_APP_EMBED_PROCESS_CHILD_H

#include "mozilla/embedlite/PEmbedLiteAppChild.h" // for PEmbedLiteAppChild
#include "EmbedLiteAppChildIface.h"
#include "mozilla/embedlite/EmbedLiteAppChildIface.h"

namespace mozilla {
namespace embedlite {
Expand Down Expand Up @@ -70,7 +70,7 @@ class EmbedLiteAppProcessChild : public PEmbedLiteAppChild,
virtual bool RecvAddObservers(const InfallibleTArray<nsCString>& observers) MOZ_OVERRIDE;
virtual bool RecvRemoveObservers(const InfallibleTArray<nsCString>& observers) MOZ_OVERRIDE;

virtual PEmbedLiteViewChild* AllocPEmbedLiteViewChild(const uint32_t&, const uint32_t& parentId) MOZ_OVERRIDE;
virtual PEmbedLiteViewChild* AllocPEmbedLiteViewChild(const uint32_t&, const uint32_t& parentId, const bool& isPrivateWindow) MOZ_OVERRIDE;
virtual bool DeallocPEmbedLiteViewChild(PEmbedLiteViewChild*) MOZ_OVERRIDE;

private:
Expand Down
Expand Up @@ -181,7 +181,9 @@ EmbedLiteAppProcessParent::RecvCreateWindow(const uint32_t& parentId,
bool* cancel)
{
LOGT();
return false;
*createdID = mApp->CreateWindowRequested(chromeFlags, uri.get(), contextFlags, parentId);
*cancel = !*createdID;
return true;
}

bool
Expand All @@ -192,10 +194,10 @@ EmbedLiteAppProcessParent::RecvObserve(const nsCString& topic, const nsString& d
}

PEmbedLiteViewParent*
EmbedLiteAppProcessParent::AllocPEmbedLiteViewParent(const uint32_t& id, const uint32_t& parentId)
EmbedLiteAppProcessParent::AllocPEmbedLiteViewParent(const uint32_t& id, const uint32_t& parentId, const bool& isPrivateWindow)
{
LOGT();
EmbedLiteViewProcessParent* p = new EmbedLiteViewProcessParent(id, parentId);
EmbedLiteViewProcessParent* p = new EmbedLiteViewProcessParent(id, parentId, isPrivateWindow);
p->AddRef();
return p;
}
Expand Down
4 changes: 1 addition & 3 deletions embedding/embedlite/embedprocess/EmbedLiteAppProcessParent.h
Expand Up @@ -46,9 +46,7 @@ class EmbedLiteAppProcessParent : public PEmbedLiteAppParent
const nsString& data);

virtual PEmbedLiteViewParent*
AllocPEmbedLiteViewParent(
const uint32_t& id,
const uint32_t& parentId);
AllocPEmbedLiteViewParent(const uint32_t& id, const uint32_t& parentId, const bool&);

virtual bool
DeallocPEmbedLiteViewParent(PEmbedLiteViewParent* aActor);
Expand Down
26 changes: 21 additions & 5 deletions embedding/embedlite/embedprocess/EmbedLiteViewProcessChild.cpp
Expand Up @@ -9,6 +9,7 @@
#include "nsEmbedCID.h"
#include "nsIIOService.h"
#include "nsNetCID.h"
#include "nsILoadContext.h"

using namespace mozilla::layers;
using namespace mozilla::widget;
Expand All @@ -19,12 +20,12 @@ namespace mozilla {
namespace embedlite {

MOZ_IMPLICIT
EmbedLiteViewProcessChild::EmbedLiteViewProcessChild(const uint32_t& id, const uint32_t& parentId)
EmbedLiteViewProcessChild::EmbedLiteViewProcessChild(const uint32_t& id, const uint32_t& parentId, const bool& isPrivateWindow)
{
LOGT();
MOZ_COUNT_CTOR(EmbedLiteViewProcessChild);
mInitWindowTask = NewRunnableMethod(this,
&EmbedLiteViewProcessChild::InitGeckoWindow, parentId);
&EmbedLiteViewProcessChild::InitGeckoWindow, parentId, isPrivateWindow);
MessageLoop::current()->PostTask(FROM_HERE, mInitWindowTask);
}

Expand All @@ -35,7 +36,7 @@ MOZ_IMPLICIT EmbedLiteViewProcessChild::~EmbedLiteViewProcessChild()
}

void
EmbedLiteViewProcessChild::InitGeckoWindow(const uint32_t& parentId)
EmbedLiteViewProcessChild::InitGeckoWindow(const uint32_t& parentId, const bool& isPrivateWindow)
{
LOGT("parentID: %u", parentId);
if (mInitWindowTask) {
Expand Down Expand Up @@ -83,6 +84,10 @@ EmbedLiteViewProcessChild::InitGeckoWindow(const uint32_t& parentId)
mChrome = new WebBrowserChrome(this);
uint32_t aChromeFlags = 0; // View()->GetWindowFlags();

if (isPrivateWindow || Preferences::GetBool("browser.privatebrowsing.autostart")) {
aChromeFlags = nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW|nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
}

mWebBrowser->SetContainerWindow(mChrome);

mChrome->SetChromeFlags(aChromeFlags);
Expand Down Expand Up @@ -110,7 +115,6 @@ EmbedLiteViewProcessChild::InitGeckoWindow(const uint32_t& parentId)
nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(mDOMWindow);
utils->GetOuterWindowID(&mOuterId);

#warning "Return me back"
EmbedLiteAppService::AppService()->RegisterView(mId);

nsCOMPtr<nsIObserverService> observerService =
Expand All @@ -123,7 +127,19 @@ EmbedLiteViewProcessChild::InitGeckoWindow(const uint32_t& parentId)
if (!mWebNavigation) {
NS_ERROR("Failed to get the web navigation interface.");
}
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mWebBrowser);

if (aChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME) {
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mWebNavigation);
MOZ_ASSERT(docShell);

docShell->SetAffectPrivateSessionLifetime(true);
}

if (aChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW) {
nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(mWebNavigation);
MOZ_ASSERT(loadContext);
loadContext->SetPrivateBrowsing(true);
}

mChrome->SetWebBrowser(mWebBrowser);

Expand Down
4 changes: 2 additions & 2 deletions embedding/embedlite/embedprocess/EmbedLiteViewProcessChild.h
Expand Up @@ -25,14 +25,14 @@ class EmbedLiteViewProcessChild : public PEmbedLiteViewChild,
{
NS_INLINE_DECL_REFCOUNTING(EmbedLiteViewProcessChild)
public:
MOZ_IMPLICIT EmbedLiteViewProcessChild(const uint32_t& id, const uint32_t& parentId);
MOZ_IMPLICIT EmbedLiteViewProcessChild(const uint32_t& id, const uint32_t& parentId, const bool& isPrivateWindow);

NS_DECL_NSIEMBEDBROWSERCHROMELISTENER

virtual ~EmbedLiteViewProcessChild();

private:
void InitGeckoWindow(const uint32_t& parentId);
void InitGeckoWindow(const uint32_t& parentId, const bool& isPrivateWindow);

protected:
virtual bool
Expand Down
Expand Up @@ -5,7 +5,7 @@
namespace mozilla {
namespace embedlite {

MOZ_IMPLICIT EmbedLiteViewProcessParent::EmbedLiteViewProcessParent(const uint32_t& id, const uint32_t& parentId)
MOZ_IMPLICIT EmbedLiteViewProcessParent::EmbedLiteViewProcessParent(const uint32_t& id, const uint32_t& parentId, const bool& isPrivateWindow)
: mView(nullptr)
{
LOGT();
Expand Down
Expand Up @@ -17,7 +17,7 @@ class EmbedLiteViewProcessParent : public PEmbedLiteViewParent,
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EmbedLiteViewProcessParent)
public:
MOZ_IMPLICIT EmbedLiteViewProcessParent(const uint32_t& id, const uint32_t& parentId);
MOZ_IMPLICIT EmbedLiteViewProcessParent(const uint32_t& id, const uint32_t& parentId, const bool&);
virtual ~EmbedLiteViewProcessParent();

NS_DECL_EMBEDLITEVIEWIFACE
Expand Down

0 comments on commit 323fe7e

Please sign in to comment.