OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/chrome_extensions_browser_client.h" | 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
6 | 6 |
7 #include "apps/common/api/generated_api.h" | 7 #include "apps/common/api/generated_api.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/version.h" | 9 #include "base/version.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "extensions/browser/extension_prefs.h" | 30 #include "extensions/browser/extension_prefs.h" |
31 #include "extensions/browser/pref_names.h" | 31 #include "extensions/browser/pref_names.h" |
32 #include "extensions/common/api/generated_api.h" | 32 #include "extensions/common/api/generated_api.h" |
33 | 33 |
34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
35 #include "chromeos/chromeos_switches.h" | 35 #include "chromeos/chromeos_switches.h" |
36 #endif | 36 #endif |
37 | 37 |
38 #if defined(ENABLE_EXTENSIONS) | 38 #if defined(ENABLE_EXTENSIONS) |
39 #include "chrome/browser/extensions/api/chrome_extensions_api_client.h" | 39 #include "chrome/browser/extensions/api/chrome_extensions_api_client.h" |
| 40 #include "chrome/browser/extensions/api/content_settings/content_settings_servic
e.h" |
40 #endif | 41 #endif |
41 | 42 |
42 namespace extensions { | 43 namespace extensions { |
43 | 44 |
44 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { | 45 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { |
45 #if defined(ENABLE_EXTENSIONS) | 46 #if defined(ENABLE_EXTENSIONS) |
46 api_client_.reset(new ChromeExtensionsAPIClient); | 47 api_client_.reset(new ChromeExtensionsAPIClient); |
47 #endif | 48 #endif |
48 // Only set if it hasn't already been set (e.g. by a test). | 49 // Only set if it hasn't already been set (e.g. by a test). |
49 if (GetCurrentChannel() == GetDefaultChannel()) | 50 if (GetCurrentChannel() == GetDefaultChannel()) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 content::BrowserContext* context) const { | 110 content::BrowserContext* context) const { |
110 return IsGuestSession(context) | 111 return IsGuestSession(context) |
111 || util::CanCrossIncognito(extension, context); | 112 || util::CanCrossIncognito(extension, context); |
112 } | 113 } |
113 | 114 |
114 PrefService* ChromeExtensionsBrowserClient::GetPrefServiceForContext( | 115 PrefService* ChromeExtensionsBrowserClient::GetPrefServiceForContext( |
115 content::BrowserContext* context) { | 116 content::BrowserContext* context) { |
116 return static_cast<Profile*>(context)->GetPrefs(); | 117 return static_cast<Profile*>(context)->GetPrefs(); |
117 } | 118 } |
118 | 119 |
| 120 void ChromeExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( |
| 121 content::BrowserContext* context, |
| 122 std::vector<ExtensionPrefsObserver*>* observers) const { |
| 123 #if defined(ENABLE_EXTENSIONS) |
| 124 observers->push_back(ContentSettingsService::Get(context)); |
| 125 #endif |
| 126 } |
| 127 |
119 bool ChromeExtensionsBrowserClient::DeferLoadingBackgroundHosts( | 128 bool ChromeExtensionsBrowserClient::DeferLoadingBackgroundHosts( |
120 content::BrowserContext* context) const { | 129 content::BrowserContext* context) const { |
121 Profile* profile = static_cast<Profile*>(context); | 130 Profile* profile = static_cast<Profile*>(context); |
122 | 131 |
123 // The profile may not be valid yet if it is still being initialized. | 132 // The profile may not be valid yet if it is still being initialized. |
124 // In that case, defer loading, since it depends on an initialized profile. | 133 // In that case, defer loading, since it depends on an initialized profile. |
125 // http://crbug.com/222473 | 134 // http://crbug.com/222473 |
126 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 135 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
127 return true; | 136 return true; |
128 | 137 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // Generated APIs from lower-level modules. | 241 // Generated APIs from lower-level modules. |
233 extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry); | 242 extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry); |
234 apps::api::GeneratedFunctionRegistry::RegisterAll(registry); | 243 apps::api::GeneratedFunctionRegistry::RegisterAll(registry); |
235 | 244 |
236 // Generated APIs from Chrome. | 245 // Generated APIs from Chrome. |
237 extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); | 246 extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); |
238 #endif | 247 #endif |
239 } | 248 } |
240 | 249 |
241 } // namespace extensions | 250 } // namespace extensions |
OLD | NEW |