Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / browser / test_extensions_browser_client.cc
blobe21bc7620e1cbc6913c136bcfdfb183f7469b691
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
3 // found in the LICENSE file.
5 #include "extensions/browser/test_extensions_browser_client.h"
7 #include "content/public/browser/browser_context.h"
8 #include "extensions/browser/app_sorting.h"
9 #include "extensions/browser/extension_host_delegate.h"
10 #include "extensions/browser/test_runtime_api_delegate.h"
12 using content::BrowserContext;
14 namespace extensions {
16 TestExtensionsBrowserClient::TestExtensionsBrowserClient(
17 BrowserContext* main_context)
18 : main_context_(main_context),
19 incognito_context_(NULL),
20 process_manager_delegate_(NULL) {
21 DCHECK(main_context_);
22 DCHECK(!main_context_->IsOffTheRecord());
25 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {}
27 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) {
28 // If a context is provided it must be off-the-record.
29 DCHECK(!context || context->IsOffTheRecord());
30 incognito_context_ = context;
33 bool TestExtensionsBrowserClient::IsShuttingDown() { return false; }
35 bool TestExtensionsBrowserClient::AreExtensionsDisabled(
36 const base::CommandLine& command_line,
37 BrowserContext* context) {
38 return false;
41 bool TestExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
42 return context == main_context_ ||
43 (incognito_context_ && context == incognito_context_);
46 bool TestExtensionsBrowserClient::IsSameContext(BrowserContext* first,
47 BrowserContext* second) {
48 DCHECK(first);
49 DCHECK(second);
50 return first == second ||
51 (first == main_context_ && second == incognito_context_) ||
52 (first == incognito_context_ && second == main_context_);
55 bool TestExtensionsBrowserClient::HasOffTheRecordContext(
56 BrowserContext* context) {
57 return context == main_context_ && incognito_context_ != NULL;
60 BrowserContext* TestExtensionsBrowserClient::GetOffTheRecordContext(
61 BrowserContext* context) {
62 if (context == main_context_)
63 return incognito_context_;
64 return NULL;
67 BrowserContext* TestExtensionsBrowserClient::GetOriginalContext(
68 BrowserContext* context) {
69 return main_context_;
72 bool TestExtensionsBrowserClient::IsGuestSession(
73 BrowserContext* context) const {
74 return false;
77 bool TestExtensionsBrowserClient::IsExtensionIncognitoEnabled(
78 const std::string& extension_id,
79 content::BrowserContext* context) const {
80 return false;
83 bool TestExtensionsBrowserClient::CanExtensionCrossIncognito(
84 const extensions::Extension* extension,
85 content::BrowserContext* context) const {
86 return false;
89 bool TestExtensionsBrowserClient::IsWebViewRequest(
90 net::URLRequest* request) const {
91 return false;
94 net::URLRequestJob*
95 TestExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
96 net::URLRequest* request,
97 net::NetworkDelegate* network_delegate,
98 const base::FilePath& directory_path,
99 const std::string& content_security_policy,
100 bool send_cors_header) {
101 return NULL;
104 bool TestExtensionsBrowserClient::AllowCrossRendererResourceLoad(
105 net::URLRequest* request,
106 bool is_incognito,
107 const Extension* extension,
108 InfoMap* extension_info_map) {
109 return false;
112 PrefService* TestExtensionsBrowserClient::GetPrefServiceForContext(
113 BrowserContext* context) {
114 return NULL;
117 void TestExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
118 content::BrowserContext* context,
119 std::vector<ExtensionPrefsObserver*>* observers) const {}
121 ProcessManagerDelegate* TestExtensionsBrowserClient::GetProcessManagerDelegate()
122 const {
123 return process_manager_delegate_;
126 scoped_ptr<ExtensionHostDelegate>
127 TestExtensionsBrowserClient::CreateExtensionHostDelegate() {
128 return scoped_ptr<ExtensionHostDelegate>();
131 bool TestExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
132 return false;
135 void TestExtensionsBrowserClient::PermitExternalProtocolHandler() {
138 scoped_ptr<AppSorting> TestExtensionsBrowserClient::CreateAppSorting() {
139 return scoped_ptr<AppSorting>();
142 bool TestExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; }
144 ApiActivityMonitor* TestExtensionsBrowserClient::GetApiActivityMonitor(
145 BrowserContext* context) {
146 return NULL;
149 ExtensionSystemProvider*
150 TestExtensionsBrowserClient::GetExtensionSystemFactory() {
151 DCHECK(extension_system_factory_);
152 return extension_system_factory_;
155 void TestExtensionsBrowserClient::RegisterExtensionFunctions(
156 ExtensionFunctionRegistry* registry) const {}
158 scoped_ptr<RuntimeAPIDelegate>
159 TestExtensionsBrowserClient::CreateRuntimeAPIDelegate(
160 content::BrowserContext* context) const {
161 return scoped_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate());
164 ComponentExtensionResourceManager*
165 TestExtensionsBrowserClient::GetComponentExtensionResourceManager() {
166 return NULL;
169 net::NetLog* TestExtensionsBrowserClient::GetNetLog() {
170 return NULL;
173 } // namespace extensions