Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: extensions/browser/test_extensions_browser_client.h

Issue 381283002: Refactor code that defers extension background page loading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on top of chrome_browser_extensions.gypi GN changes Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ 5 #ifndef EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_
6 #define EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ 6 #define EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "extensions/browser/extensions_browser_client.h" 9 #include "extensions/browser/extensions_browser_client.h"
10 10
11 namespace extensions { 11 namespace extensions {
12 12
13 // A simplified ExtensionsBrowserClient for a single normal browser context and 13 // A simplified ExtensionsBrowserClient for a single normal browser context and
14 // an optional incognito browser context associated with it. A test that uses 14 // an optional incognito browser context associated with it. A test that uses
15 // this class should call ExtensionsBrowserClient::Set() with its instance. 15 // this class should call ExtensionsBrowserClient::Set() with its instance.
16 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { 16 class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
17 public: 17 public:
18 // |context| is required and must not be an incognito context. 18 // |main_context| is required and must not be an incognito context.
19 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context); 19 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context);
20 virtual ~TestExtensionsBrowserClient(); 20 virtual ~TestExtensionsBrowserClient();
21 21
22 void set_process_manager_delegate(ProcessManagerDelegate* delegate) {
23 process_manager_delegate_ = delegate;
24 }
25
22 // Associates an incognito context with |main_context_|. 26 // Associates an incognito context with |main_context_|.
23 void SetIncognitoContext(content::BrowserContext* incognito_context); 27 void SetIncognitoContext(content::BrowserContext* incognito_context);
24 28
25 // ExtensionsBrowserClient overrides: 29 // ExtensionsBrowserClient overrides:
26 virtual bool IsShuttingDown() OVERRIDE; 30 virtual bool IsShuttingDown() OVERRIDE;
27 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, 31 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line,
28 content::BrowserContext* context) OVERRIDE; 32 content::BrowserContext* context) OVERRIDE;
29 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; 33 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE;
30 virtual bool IsSameContext(content::BrowserContext* first, 34 virtual bool IsSameContext(content::BrowserContext* first,
31 content::BrowserContext* second) OVERRIDE; 35 content::BrowserContext* second) OVERRIDE;
(...skipping 20 matching lines...) Expand all
52 virtual bool AllowCrossRendererResourceLoad(net::URLRequest* request, 56 virtual bool AllowCrossRendererResourceLoad(net::URLRequest* request,
53 bool is_incognito, 57 bool is_incognito,
54 const Extension* extension, 58 const Extension* extension,
55 InfoMap* extension_info_map) 59 InfoMap* extension_info_map)
56 OVERRIDE; 60 OVERRIDE;
57 virtual PrefService* GetPrefServiceForContext( 61 virtual PrefService* GetPrefServiceForContext(
58 content::BrowserContext* context) OVERRIDE; 62 content::BrowserContext* context) OVERRIDE;
59 virtual void GetEarlyExtensionPrefsObservers( 63 virtual void GetEarlyExtensionPrefsObservers(
60 content::BrowserContext* context, 64 content::BrowserContext* context,
61 std::vector<ExtensionPrefsObserver*>* observers) const OVERRIDE; 65 std::vector<ExtensionPrefsObserver*>* observers) const OVERRIDE;
62 virtual bool DeferLoadingBackgroundHosts( 66 virtual ProcessManagerDelegate* GetProcessManagerDelegate() const OVERRIDE;
63 content::BrowserContext* context) const OVERRIDE;
64 virtual bool IsBackgroundPageAllowed(content::BrowserContext* context) const
65 OVERRIDE;
66 virtual scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() 67 virtual scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate()
67 OVERRIDE; 68 OVERRIDE;
68 virtual bool DidVersionUpdate(content::BrowserContext* context) OVERRIDE; 69 virtual bool DidVersionUpdate(content::BrowserContext* context) OVERRIDE;
69 virtual scoped_ptr<AppSorting> CreateAppSorting() OVERRIDE; 70 virtual scoped_ptr<AppSorting> CreateAppSorting() OVERRIDE;
70 virtual bool IsRunningInForcedAppMode() OVERRIDE; 71 virtual bool IsRunningInForcedAppMode() OVERRIDE;
71 virtual ApiActivityMonitor* GetApiActivityMonitor( 72 virtual ApiActivityMonitor* GetApiActivityMonitor(
72 content::BrowserContext* context) OVERRIDE; 73 content::BrowserContext* context) OVERRIDE;
73 virtual ExtensionSystemProvider* GetExtensionSystemFactory() OVERRIDE; 74 virtual ExtensionSystemProvider* GetExtensionSystemFactory() OVERRIDE;
74 virtual void RegisterExtensionFunctions( 75 virtual void RegisterExtensionFunctions(
75 ExtensionFunctionRegistry* registry) const OVERRIDE; 76 ExtensionFunctionRegistry* registry) const OVERRIDE;
76 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( 77 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
77 content::BrowserContext* context) const OVERRIDE; 78 content::BrowserContext* context) const OVERRIDE;
78 virtual ComponentExtensionResourceManager* 79 virtual ComponentExtensionResourceManager*
79 GetComponentExtensionResourceManager() OVERRIDE; 80 GetComponentExtensionResourceManager() OVERRIDE;
80 81
81 private: 82 private:
82 content::BrowserContext* main_context_; // Not owned. 83 content::BrowserContext* main_context_; // Not owned.
83 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. 84 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL.
84 85
86 // Not owned, defaults to NULL.
87 ProcessManagerDelegate* process_manager_delegate_;
88
85 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); 89 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient);
86 }; 90 };
87 91
88 } // namespace extensions 92 } // namespace extensions
89 93
90 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ 94 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_
OLDNEW
« no previous file with comments | « extensions/browser/process_manager_unittest.cc ('k') | extensions/browser/test_extensions_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698