| 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 #ifndef EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ | 5 #ifndef EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ |
| 6 #define EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ | 6 #define EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "components/update_client/update_client.h" | 17 #include "components/update_client/update_client.h" |
| 18 #include "extensions/browser/extensions_browser_client.h" | 18 #include "extensions/browser/extensions_browser_client.h" |
| 19 #include "extensions/browser/updater/extension_cache.h" | 19 #include "extensions/browser/updater/extension_cache.h" |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 class KioskDelegate; |
| 22 | 23 |
| 23 // A simplified ExtensionsBrowserClient for a single normal browser context and | 24 // A simplified ExtensionsBrowserClient for a single normal browser context and |
| 24 // an optional incognito browser context associated with it. A test that uses | 25 // an optional incognito browser context associated with it. A test that uses |
| 25 // this class should call ExtensionsBrowserClient::Set() with its instance. | 26 // this class should call ExtensionsBrowserClient::Set() with its instance. |
| 26 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { | 27 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { |
| 27 public: | 28 public: |
| 28 // |main_context| is required and must not be an incognito context. | 29 // |main_context| is required and must not be an incognito context. |
| 29 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context); | 30 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context); |
| 30 ~TestExtensionsBrowserClient() override; | 31 ~TestExtensionsBrowserClient() override; |
| 31 | 32 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void BroadcastEventToRenderers( | 103 void BroadcastEventToRenderers( |
| 103 events::HistogramValue histogram_value, | 104 events::HistogramValue histogram_value, |
| 104 const std::string& event_name, | 105 const std::string& event_name, |
| 105 std::unique_ptr<base::ListValue> args) override; | 106 std::unique_ptr<base::ListValue> args) override; |
| 106 net::NetLog* GetNetLog() override; | 107 net::NetLog* GetNetLog() override; |
| 107 ExtensionCache* GetExtensionCache() override; | 108 ExtensionCache* GetExtensionCache() override; |
| 108 bool IsBackgroundUpdateAllowed() override; | 109 bool IsBackgroundUpdateAllowed() override; |
| 109 bool IsMinBrowserVersionSupported(const std::string& min_version) override; | 110 bool IsMinBrowserVersionSupported(const std::string& min_version) override; |
| 110 ExtensionWebContentsObserver* GetExtensionWebContentsObserver( | 111 ExtensionWebContentsObserver* GetExtensionWebContentsObserver( |
| 111 content::WebContents* web_contents) override; | 112 content::WebContents* web_contents) override; |
| 113 KioskDelegate* GetKioskDelegate() override; |
| 112 scoped_refptr<update_client::UpdateClient> CreateUpdateClient( | 114 scoped_refptr<update_client::UpdateClient> CreateUpdateClient( |
| 113 content::BrowserContext* context) override; | 115 content::BrowserContext* context) override; |
| 114 | 116 |
| 115 ExtensionSystemProvider* extension_system_factory() { | 117 ExtensionSystemProvider* extension_system_factory() { |
| 116 return extension_system_factory_; | 118 return extension_system_factory_; |
| 117 } | 119 } |
| 118 | 120 |
| 119 private: | 121 private: |
| 120 content::BrowserContext* main_context_; // Not owned. | 122 content::BrowserContext* main_context_; // Not owned. |
| 121 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. | 123 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. |
| 122 | 124 |
| 123 // Not owned, defaults to NULL. | 125 // Not owned, defaults to NULL. |
| 124 ProcessManagerDelegate* process_manager_delegate_; | 126 ProcessManagerDelegate* process_manager_delegate_; |
| 125 | 127 |
| 126 // Not owned, defaults to NULL. | 128 // Not owned, defaults to NULL. |
| 127 ExtensionSystemProvider* extension_system_factory_; | 129 ExtensionSystemProvider* extension_system_factory_; |
| 128 | 130 |
| 129 std::unique_ptr<ExtensionCache> extension_cache_; | 131 std::unique_ptr<ExtensionCache> extension_cache_; |
| 130 | 132 |
| 131 base::Callback<update_client::UpdateClient*(void)> update_client_factory_; | 133 base::Callback<update_client::UpdateClient*(void)> update_client_factory_; |
| 132 | 134 |
| 133 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); | 135 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); |
| 134 }; | 136 }; |
| 135 | 137 |
| 136 } // namespace extensions | 138 } // namespace extensions |
| 137 | 139 |
| 138 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ | 140 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ |
| OLD | NEW |