| 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), incognito_context_(NULL) { | 18 : main_context_(main_context), |
| 19 incognito_context_(NULL), |
| 20 defer_loading_background_hosts_(false) { |
| 19 DCHECK(main_context_); | 21 DCHECK(main_context_); |
| 20 DCHECK(!main_context_->IsOffTheRecord()); | 22 DCHECK(!main_context_->IsOffTheRecord()); |
| 21 } | 23 } |
| 22 | 24 |
| 23 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {} | 25 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {} |
| 24 | 26 |
| 25 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) { | 27 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) { |
| 26 // If a context is provided it must be off-the-record. | 28 // If a context is provided it must be off-the-record. |
| 27 DCHECK(!context || context->IsOffTheRecord()); | 29 DCHECK(!context || context->IsOffTheRecord()); |
| 28 incognito_context_ = context; | 30 incognito_context_ = context; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 BrowserContext* context) { | 113 BrowserContext* context) { |
| 112 return NULL; | 114 return NULL; |
| 113 } | 115 } |
| 114 | 116 |
| 115 void TestExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( | 117 void TestExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( |
| 116 content::BrowserContext* context, | 118 content::BrowserContext* context, |
| 117 std::vector<ExtensionPrefsObserver*>* observers) const {} | 119 std::vector<ExtensionPrefsObserver*>* observers) const {} |
| 118 | 120 |
| 119 bool TestExtensionsBrowserClient::DeferLoadingBackgroundHosts( | 121 bool TestExtensionsBrowserClient::DeferLoadingBackgroundHosts( |
| 120 BrowserContext* context) const { | 122 BrowserContext* context) const { |
| 121 return false; | 123 return defer_loading_background_hosts_; |
| 122 } | 124 } |
| 123 | 125 |
| 124 bool TestExtensionsBrowserClient::IsBackgroundPageAllowed( | 126 bool TestExtensionsBrowserClient::IsBackgroundPageAllowed( |
| 125 BrowserContext* context) const { | 127 BrowserContext* context) const { |
| 126 return true; | 128 return true; |
| 127 } | 129 } |
| 128 | 130 |
| 129 scoped_ptr<ExtensionHostDelegate> | 131 scoped_ptr<ExtensionHostDelegate> |
| 130 TestExtensionsBrowserClient::CreateExtensionHostDelegate() { | 132 TestExtensionsBrowserClient::CreateExtensionHostDelegate() { |
| 131 return scoped_ptr<ExtensionHostDelegate>(); | 133 return scoped_ptr<ExtensionHostDelegate>(); |
| 132 } | 134 } |
| 133 | 135 |
| 134 bool TestExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) { | 136 bool TestExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) { |
| 135 return false; | 137 return false; |
| 136 } | 138 } |
| 137 | 139 |
| 138 scoped_ptr<AppSorting> TestExtensionsBrowserClient::CreateAppSorting() { | 140 scoped_ptr<AppSorting> TestExtensionsBrowserClient::CreateAppSorting() { |
| 139 return scoped_ptr<AppSorting>(); | 141 return scoped_ptr<AppSorting>(); |
| 140 } | 142 } |
| 141 | 143 |
| 142 bool TestExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } | 144 bool TestExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } |
| 143 | 145 |
| 144 ApiActivityMonitor* TestExtensionsBrowserClient::GetApiActivityMonitor( | 146 ApiActivityMonitor* TestExtensionsBrowserClient::GetApiActivityMonitor( |
| 145 BrowserContext* context) { | 147 BrowserContext* context) { |
| 146 return NULL; | 148 return NULL; |
| 147 } | 149 } |
| 148 | 150 |
| 149 ExtensionSystemProvider* | 151 ExtensionSystemProvider* |
| 150 TestExtensionsBrowserClient::GetExtensionSystemFactory() { | 152 TestExtensionsBrowserClient::GetExtensionSystemFactory() { |
| 151 // Tests requiring an extension system should override this function. | 153 DCHECK(extension_system_factory_); |
| 152 NOTREACHED(); | 154 return extension_system_factory_; |
| 153 return NULL; | |
| 154 } | 155 } |
| 155 | 156 |
| 156 void TestExtensionsBrowserClient::RegisterExtensionFunctions( | 157 void TestExtensionsBrowserClient::RegisterExtensionFunctions( |
| 157 ExtensionFunctionRegistry* registry) const {} | 158 ExtensionFunctionRegistry* registry) const {} |
| 158 | 159 |
| 159 scoped_ptr<RuntimeAPIDelegate> | 160 scoped_ptr<RuntimeAPIDelegate> |
| 160 TestExtensionsBrowserClient::CreateRuntimeAPIDelegate( | 161 TestExtensionsBrowserClient::CreateRuntimeAPIDelegate( |
| 161 content::BrowserContext* context) const { | 162 content::BrowserContext* context) const { |
| 162 return scoped_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate()); | 163 return scoped_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate()); |
| 163 } | 164 } |
| 164 | 165 |
| 165 ComponentExtensionResourceManager* | 166 ComponentExtensionResourceManager* |
| 166 TestExtensionsBrowserClient::GetComponentExtensionResourceManager() { | 167 TestExtensionsBrowserClient::GetComponentExtensionResourceManager() { |
| 167 return NULL; | 168 return NULL; |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace extensions | 171 } // namespace extensions |
| OLD | NEW |