From 5f39c0e104ed07c6bae0c1667f30c6dae0e0766e Mon Sep 17 00:00:00 2001 From: "jamescook@chromium.org" Date: Fri, 1 Nov 2013 20:18:54 +0000 Subject: Convert ExtensionProcessManager to BrowserContext, part 1 Part of moving ExtensionProcessManager to src/extensions. * Introduce more test coverage * Convert most usage of Profile to BrowserContext * Separate out "master" vs. incognito profiles/contexts * Move switches into extensions/common/switches.h BUG=313481 TEST=unit_tests ExtensionProcessManager* and browser_tests ExtensionProcessManager* R=miket@chromium.org Review URL: https://codereview.chromium.org/52983004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232456 0039d316-1c4b-4281-b951-d872f2087c98 --- extensions/browser/extensions_browser_client.h | 11 ++++++++++- extensions/browser/lazy_background_task_queue_unittest.cc | 2 +- extensions/common/switches.cc | 8 ++++++++ extensions/common/switches.h | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) (limited to 'extensions') diff --git a/extensions/browser/extensions_browser_client.h b/extensions/browser/extensions_browser_client.h index 4810836..dd78811 100644 --- a/extensions/browser/extensions_browser_client.h +++ b/extensions/browser/extensions_browser_client.h @@ -29,7 +29,7 @@ class ExtensionsBrowserClient { virtual bool IsSameContext(content::BrowserContext* first, content::BrowserContext* second) = 0; - // Returns true if |context| has an off-the-record content associated with it. + // Returns true if |context| has an off-the-record context associated with it. virtual bool HasOffTheRecordContext(content::BrowserContext* context) = 0; // Returns the off-the-record context associated with |context|. If |context| @@ -39,6 +39,15 @@ class ExtensionsBrowserClient { virtual content::BrowserContext* GetOffTheRecordContext( content::BrowserContext* context) = 0; + // Return the original "recording" context. This method returns |context| if + // |context| is not incognito. + virtual content::BrowserContext* GetOriginalContext( + content::BrowserContext* context) = 0; + + // Returns true if loading background pages should be deferred. + virtual bool DeferLoadingBackgroundHosts( + content::BrowserContext* context) const = 0; + // Returns the single instance of |this|. static ExtensionsBrowserClient* Get(); diff --git a/extensions/browser/lazy_background_task_queue_unittest.cc b/extensions/browser/lazy_background_task_queue_unittest.cc index 27d8471..da2e5bc 100644 --- a/extensions/browser/lazy_background_task_queue_unittest.cc +++ b/extensions/browser/lazy_background_task_queue_unittest.cc @@ -21,7 +21,7 @@ namespace extensions { class TestExtensionProcessManager : public ExtensionProcessManager { public: explicit TestExtensionProcessManager(Profile* profile) - : ExtensionProcessManager(profile), + : ExtensionProcessManager(profile, profile->GetOriginalProfile()), create_count_(0) {} virtual ~TestExtensionProcessManager() {} diff --git a/extensions/common/switches.cc b/extensions/common/switches.cc index 3c8ab10..674bb03 100644 --- a/extensions/common/switches.cc +++ b/extensions/common/switches.cc @@ -26,6 +26,14 @@ const char kEnableExperimentalExtensionApis[] = // them in the chrome:extensions page. const char kErrorConsole[] = "error-console"; +// The time in seconds that an extension event page can be idle before it +// is shut down. +const char kEventPageIdleTime[] = "event-page-idle-time"; + +// The time in seconds that an extension event page has between being notified +// of its impending unload and that unload happening. +const char kEventPageSuspendingTime[] = "event-page-unloading-time"; + // Enables extensions running scripts on chrome:// URLs. // Extensions still need to explicitly request access to chrome:// URLs in the // manifest. diff --git a/extensions/common/switches.h b/extensions/common/switches.h index 43cc0f1..e6ff310 100644 --- a/extensions/common/switches.h +++ b/extensions/common/switches.h @@ -15,6 +15,8 @@ extern const char kAllowLegacyExtensionManifests[]; extern const char kAllowScriptingGallery[]; extern const char kEnableExperimentalExtensionApis[]; extern const char kErrorConsole[]; +extern const char kEventPageIdleTime[]; +extern const char kEventPageSuspendingTime[]; extern const char kExtensionsOnChromeURLs[]; extern const char kShowComponentExtensionOptions[]; -- cgit v1.1