| 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 "base/values.h" | 7 #include "base/values.h" |
| 8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.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 #include "extensions/browser/updater/null_extension_cache.h" | 11 #include "extensions/browser/updater/null_extension_cache.h" |
| 12 | 12 |
| 13 using content::BrowserContext; | 13 using content::BrowserContext; |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 TestExtensionsBrowserClient::TestExtensionsBrowserClient( | 17 TestExtensionsBrowserClient::TestExtensionsBrowserClient( |
| 18 BrowserContext* main_context) | 18 BrowserContext* main_context) |
| 19 : main_context_(main_context), | 19 : main_context_(main_context), |
| 20 incognito_context_(NULL), | 20 incognito_context_(NULL), |
| 21 process_manager_delegate_(NULL), | 21 process_manager_delegate_(NULL), |
| 22 extension_system_factory_(NULL), | 22 extension_system_factory_(NULL), |
| 23 extension_cache_(new NullExtensionCache) { | 23 extension_cache_(new NullExtensionCache) { |
| 24 DCHECK(main_context_); | 24 DCHECK(main_context_); |
| 25 DCHECK(!main_context_->IsOffTheRecord()); | 25 DCHECK(!main_context_->IsOffTheRecord()); |
| 26 } | 26 } |
| 27 | 27 |
| 28 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {} | 28 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {} |
| 29 | 29 |
| 30 void TestExtensionsBrowserClient::SetUpdateClientFactory( |
| 31 const base::Callback<update_client::UpdateClient*(void)>& factory) { |
| 32 update_client_factory_ = factory; |
| 33 } |
| 34 |
| 30 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) { | 35 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) { |
| 31 // If a context is provided it must be off-the-record. | 36 // If a context is provided it must be off-the-record. |
| 32 DCHECK(!context || context->IsOffTheRecord()); | 37 DCHECK(!context || context->IsOffTheRecord()); |
| 33 incognito_context_ = context; | 38 incognito_context_ = context; |
| 34 } | 39 } |
| 35 | 40 |
| 36 bool TestExtensionsBrowserClient::IsShuttingDown() { return false; } | 41 bool TestExtensionsBrowserClient::IsShuttingDown() { return false; } |
| 37 | 42 |
| 38 bool TestExtensionsBrowserClient::AreExtensionsDisabled( | 43 bool TestExtensionsBrowserClient::AreExtensionsDisabled( |
| 39 const base::CommandLine& command_line, | 44 const base::CommandLine& command_line, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const std::string& min_version) { | 202 const std::string& min_version) { |
| 198 return true; | 203 return true; |
| 199 } | 204 } |
| 200 | 205 |
| 201 ExtensionWebContentsObserver* | 206 ExtensionWebContentsObserver* |
| 202 TestExtensionsBrowserClient::GetExtensionWebContentsObserver( | 207 TestExtensionsBrowserClient::GetExtensionWebContentsObserver( |
| 203 content::WebContents* web_contents) { | 208 content::WebContents* web_contents) { |
| 204 return nullptr; | 209 return nullptr; |
| 205 } | 210 } |
| 206 | 211 |
| 212 scoped_refptr<update_client::UpdateClient> |
| 213 TestExtensionsBrowserClient::CreateUpdateClient( |
| 214 content::BrowserContext* context) { |
| 215 return update_client_factory_.is_null() |
| 216 ? nullptr |
| 217 : make_scoped_refptr(update_client_factory_.Run()); |
| 218 } |
| 219 |
| 207 } // namespace extensions | 220 } // namespace extensions |
| OLD | NEW |