Chromium Code Reviews| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 const std::string& min_version) { | 198 const std::string& min_version) { |
| 194 return true; | 199 return true; |
| 195 } | 200 } |
| 196 | 201 |
| 197 ExtensionWebContentsObserver* | 202 ExtensionWebContentsObserver* |
| 198 TestExtensionsBrowserClient::GetExtensionWebContentsObserver( | 203 TestExtensionsBrowserClient::GetExtensionWebContentsObserver( |
| 199 content::WebContents* web_contents) { | 204 content::WebContents* web_contents) { |
| 200 return nullptr; | 205 return nullptr; |
| 201 } | 206 } |
| 202 | 207 |
| 208 scoped_refptr<update_client::UpdateClient> | |
| 209 TestExtensionsBrowserClient::CreateUpdateClient( | |
| 210 content::BrowserContext* context) { | |
| 211 if (update_client_factory_.is_null()) { | |
|
Sorin Jianu
2015/10/14 20:37:09
can use ?:
asargent_no_longer_on_chrome
2015/10/15 20:16:02
Done.
| |
| 212 return nullptr; | |
| 213 } | |
| 214 return make_scoped_refptr(update_client_factory_.Run()); | |
| 215 } | |
| 216 | |
| 203 } // namespace extensions | 217 } // namespace extensions |
| OLD | NEW |