OLD | NEW |
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 #include "extensions/browser/test_extensions_browser_client.h" | 5 #include "extensions/browser/test_extensions_browser_client.h" |
6 | 6 |
7 #include "content/public/browser/browser_context.h" | 7 #include "content/public/browser/browser_context.h" |
8 #include "extensions/browser/app_sorting.h" | 8 #include "extensions/browser/app_sorting.h" |
9 #include "extensions/browser/extension_host_delegate.h" | 9 #include "extensions/browser/extension_host_delegate.h" |
10 #include "extensions/browser/test_runtime_api_delegate.h" | 10 #include "extensions/browser/test_runtime_api_delegate.h" |
11 | 11 |
12 using content::BrowserContext; | 12 using content::BrowserContext; |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 TestExtensionsBrowserClient::TestExtensionsBrowserClient( | 16 TestExtensionsBrowserClient::TestExtensionsBrowserClient( |
17 BrowserContext* main_context) | 17 BrowserContext* main_context) |
18 : main_context_(main_context), | 18 : main_context_(main_context), |
19 incognito_context_(NULL), | 19 incognito_context_(nullptr), |
20 process_manager_delegate_(NULL), | 20 process_manager_delegate_(nullptr), |
21 extension_system_factory_(NULL) { | 21 extension_system_factory_(nullptr) { |
22 DCHECK(main_context_); | 22 DCHECK(main_context_); |
23 DCHECK(!main_context_->IsOffTheRecord()); | 23 DCHECK(!main_context_->IsOffTheRecord()); |
24 } | 24 } |
25 | 25 |
26 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {} | 26 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {} |
27 | 27 |
28 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) { | 28 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) { |
29 // If a context is provided it must be off-the-record. | 29 // If a context is provided it must be off-the-record. |
30 DCHECK(!context || context->IsOffTheRecord()); | 30 DCHECK(!context || context->IsOffTheRecord()); |
31 incognito_context_ = context; | 31 incognito_context_ = context; |
(...skipping 16 matching lines...) Expand all Loading... |
48 BrowserContext* second) { | 48 BrowserContext* second) { |
49 DCHECK(first); | 49 DCHECK(first); |
50 DCHECK(second); | 50 DCHECK(second); |
51 return first == second || | 51 return first == second || |
52 (first == main_context_ && second == incognito_context_) || | 52 (first == main_context_ && second == incognito_context_) || |
53 (first == incognito_context_ && second == main_context_); | 53 (first == incognito_context_ && second == main_context_); |
54 } | 54 } |
55 | 55 |
56 bool TestExtensionsBrowserClient::HasOffTheRecordContext( | 56 bool TestExtensionsBrowserClient::HasOffTheRecordContext( |
57 BrowserContext* context) { | 57 BrowserContext* context) { |
58 return context == main_context_ && incognito_context_ != NULL; | 58 return context == main_context_ && incognito_context_ != nullptr; |
59 } | 59 } |
60 | 60 |
61 BrowserContext* TestExtensionsBrowserClient::GetOffTheRecordContext( | 61 BrowserContext* TestExtensionsBrowserClient::GetOffTheRecordContext( |
62 BrowserContext* context) { | 62 BrowserContext* context) { |
63 if (context == main_context_) | 63 if (context == main_context_) |
64 return incognito_context_; | 64 return incognito_context_; |
65 return NULL; | 65 return nullptr; |
66 } | 66 } |
67 | 67 |
68 BrowserContext* TestExtensionsBrowserClient::GetOriginalContext( | 68 BrowserContext* TestExtensionsBrowserClient::GetOriginalContext( |
69 BrowserContext* context) { | 69 BrowserContext* context) { |
70 return main_context_; | 70 return main_context_; |
71 } | 71 } |
72 | 72 |
73 bool TestExtensionsBrowserClient::IsGuestSession( | 73 bool TestExtensionsBrowserClient::IsGuestSession( |
74 BrowserContext* context) const { | 74 BrowserContext* context) const { |
75 return false; | 75 return false; |
(...skipping 11 matching lines...) Expand all Loading... |
87 return false; | 87 return false; |
88 } | 88 } |
89 | 89 |
90 net::URLRequestJob* | 90 net::URLRequestJob* |
91 TestExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob( | 91 TestExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob( |
92 net::URLRequest* request, | 92 net::URLRequest* request, |
93 net::NetworkDelegate* network_delegate, | 93 net::NetworkDelegate* network_delegate, |
94 const base::FilePath& directory_path, | 94 const base::FilePath& directory_path, |
95 const std::string& content_security_policy, | 95 const std::string& content_security_policy, |
96 bool send_cors_header) { | 96 bool send_cors_header) { |
97 return NULL; | 97 return nullptr; |
98 } | 98 } |
99 | 99 |
100 bool TestExtensionsBrowserClient::AllowCrossRendererResourceLoad( | 100 bool TestExtensionsBrowserClient::AllowCrossRendererResourceLoad( |
101 net::URLRequest* request, | 101 net::URLRequest* request, |
102 bool is_incognito, | 102 bool is_incognito, |
103 const Extension* extension, | 103 const Extension* extension, |
104 InfoMap* extension_info_map) { | 104 InfoMap* extension_info_map) { |
105 return false; | 105 return false; |
106 } | 106 } |
107 | 107 |
108 PrefService* TestExtensionsBrowserClient::GetPrefServiceForContext( | 108 PrefService* TestExtensionsBrowserClient::GetPrefServiceForContext( |
109 BrowserContext* context) { | 109 BrowserContext* context) { |
110 return NULL; | 110 return nullptr; |
111 } | 111 } |
112 | 112 |
113 void TestExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( | 113 void TestExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( |
114 content::BrowserContext* context, | 114 content::BrowserContext* context, |
115 std::vector<ExtensionPrefsObserver*>* observers) const {} | 115 std::vector<ExtensionPrefsObserver*>* observers) const {} |
116 | 116 |
117 ProcessManagerDelegate* TestExtensionsBrowserClient::GetProcessManagerDelegate() | 117 ProcessManagerDelegate* TestExtensionsBrowserClient::GetProcessManagerDelegate() |
118 const { | 118 const { |
119 return process_manager_delegate_; | 119 return process_manager_delegate_; |
120 } | 120 } |
(...skipping 11 matching lines...) Expand all Loading... |
132 } | 132 } |
133 | 133 |
134 scoped_ptr<AppSorting> TestExtensionsBrowserClient::CreateAppSorting() { | 134 scoped_ptr<AppSorting> TestExtensionsBrowserClient::CreateAppSorting() { |
135 return scoped_ptr<AppSorting>(); | 135 return scoped_ptr<AppSorting>(); |
136 } | 136 } |
137 | 137 |
138 bool TestExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } | 138 bool TestExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } |
139 | 139 |
140 ApiActivityMonitor* TestExtensionsBrowserClient::GetApiActivityMonitor( | 140 ApiActivityMonitor* TestExtensionsBrowserClient::GetApiActivityMonitor( |
141 BrowserContext* context) { | 141 BrowserContext* context) { |
142 return NULL; | 142 return nullptr; |
143 } | 143 } |
144 | 144 |
145 ExtensionSystemProvider* | 145 ExtensionSystemProvider* |
146 TestExtensionsBrowserClient::GetExtensionSystemFactory() { | 146 TestExtensionsBrowserClient::GetExtensionSystemFactory() { |
147 DCHECK(extension_system_factory_); | 147 DCHECK(extension_system_factory_); |
148 return extension_system_factory_; | 148 return extension_system_factory_; |
149 } | 149 } |
150 | 150 |
151 void TestExtensionsBrowserClient::RegisterExtensionFunctions( | 151 void TestExtensionsBrowserClient::RegisterExtensionFunctions( |
152 ExtensionFunctionRegistry* registry) const {} | 152 ExtensionFunctionRegistry* registry) const {} |
153 | 153 |
154 scoped_ptr<RuntimeAPIDelegate> | 154 scoped_ptr<RuntimeAPIDelegate> |
155 TestExtensionsBrowserClient::CreateRuntimeAPIDelegate( | 155 TestExtensionsBrowserClient::CreateRuntimeAPIDelegate( |
156 content::BrowserContext* context) const { | 156 content::BrowserContext* context) const { |
157 return scoped_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate()); | 157 return scoped_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate()); |
158 } | 158 } |
159 | 159 |
160 ComponentExtensionResourceManager* | 160 ComponentExtensionResourceManager* |
161 TestExtensionsBrowserClient::GetComponentExtensionResourceManager() { | 161 TestExtensionsBrowserClient::GetComponentExtensionResourceManager() { |
162 return NULL; | 162 return nullptr; |
163 } | 163 } |
164 | 164 |
165 void TestExtensionsBrowserClient::BroadcastEventToRenderers( | 165 void TestExtensionsBrowserClient::BroadcastEventToRenderers( |
166 const std::string& event_name, | 166 const std::string& event_name, |
167 scoped_ptr<base::ListValue> args) { | 167 scoped_ptr<base::ListValue> args) { |
168 } | 168 } |
169 | 169 |
170 net::NetLog* TestExtensionsBrowserClient::GetNetLog() { | 170 net::NetLog* TestExtensionsBrowserClient::GetNetLog() { |
171 return NULL; | 171 return nullptr; |
172 } | 172 } |
173 | 173 |
174 } // namespace extensions | 174 } // namespace extensions |
OLD | NEW |