| 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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/extensions/activity_log/activity_log.h" | 12 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 13 #include "chrome/browser/extensions/api/preference/chrome_direct_setting.h" | 13 #include "chrome/browser/extensions/api/preference/chrome_direct_setting.h" |
| 14 #include "chrome/browser/extensions/api/preference/preference_api.h" | 14 #include "chrome/browser/extensions/api/preference/preference_api.h" |
| 15 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 15 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 16 #include "chrome/browser/extensions/chrome_app_sorting.h" | 16 #include "chrome/browser/extensions/chrome_app_sorting.h" |
| 17 #include "chrome/browser/extensions/chrome_extension_host_delegate.h" | 17 #include "chrome/browser/extensions/chrome_extension_host_delegate.h" |
| 18 #include "chrome/browser/extensions/extension_system_factory.h" | 18 #include "chrome/browser/extensions/extension_system_factory.h" |
| 19 #include "chrome/browser/extensions/extension_util.h" | 19 #include "chrome/browser/extensions/extension_util.h" |
| 20 #include "chrome/browser/extensions/url_request_util.h" |
| 20 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 21 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" | 24 #include "chrome/browser/ui/browser_finder.h" |
| 24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
| 26 #include "chrome/common/extensions/api/generated_api.h" | 27 #include "chrome/common/extensions/api/generated_api.h" |
| 27 #include "chrome/common/extensions/features/feature_channel.h" | 28 #include "chrome/common/extensions/features/feature_channel.h" |
| 28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 29 #include "extensions/browser/extension_function_registry.h" | 30 #include "extensions/browser/extension_function_registry.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 || util::IsIncognitoEnabled(extension_id, context); | 106 || util::IsIncognitoEnabled(extension_id, context); |
| 106 } | 107 } |
| 107 | 108 |
| 108 bool ChromeExtensionsBrowserClient::CanExtensionCrossIncognito( | 109 bool ChromeExtensionsBrowserClient::CanExtensionCrossIncognito( |
| 109 const extensions::Extension* extension, | 110 const extensions::Extension* extension, |
| 110 content::BrowserContext* context) const { | 111 content::BrowserContext* context) const { |
| 111 return IsGuestSession(context) | 112 return IsGuestSession(context) |
| 112 || util::CanCrossIncognito(extension, context); | 113 || util::CanCrossIncognito(extension, context); |
| 113 } | 114 } |
| 114 | 115 |
| 116 net::URLRequestJob* |
| 117 ChromeExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob( |
| 118 net::URLRequest* request, |
| 119 net::NetworkDelegate* network_delegate, |
| 120 const base::FilePath& directory_path, |
| 121 const std::string& content_security_policy, |
| 122 bool send_cors_header) { |
| 123 return url_request_util::MaybeCreateURLRequestResourceBundleJob( |
| 124 request, |
| 125 network_delegate, |
| 126 directory_path, |
| 127 content_security_policy, |
| 128 send_cors_header); |
| 129 } |
| 130 |
| 131 bool ChromeExtensionsBrowserClient::AllowCrossRendererResourceLoad( |
| 132 net::URLRequest* request, |
| 133 bool is_incognito, |
| 134 const Extension* extension, |
| 135 InfoMap* extension_info_map) { |
| 136 return url_request_util::AllowCrossRendererResourceLoad( |
| 137 request, is_incognito, extension, extension_info_map); |
| 138 } |
| 139 |
| 115 PrefService* ChromeExtensionsBrowserClient::GetPrefServiceForContext( | 140 PrefService* ChromeExtensionsBrowserClient::GetPrefServiceForContext( |
| 116 content::BrowserContext* context) { | 141 content::BrowserContext* context) { |
| 117 return static_cast<Profile*>(context)->GetPrefs(); | 142 return static_cast<Profile*>(context)->GetPrefs(); |
| 118 } | 143 } |
| 119 | 144 |
| 120 void ChromeExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( | 145 void ChromeExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( |
| 121 content::BrowserContext* context, | 146 content::BrowserContext* context, |
| 122 std::vector<ExtensionPrefsObserver*>* observers) const { | 147 std::vector<ExtensionPrefsObserver*>* observers) const { |
| 123 #if defined(ENABLE_EXTENSIONS) | 148 #if defined(ENABLE_EXTENSIONS) |
| 124 observers->push_back(ContentSettingsService::Get(context)); | 149 observers->push_back(ContentSettingsService::Get(context)); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // Generated APIs from lower-level modules. | 258 // Generated APIs from lower-level modules. |
| 234 extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry); | 259 extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry); |
| 235 apps::api::GeneratedFunctionRegistry::RegisterAll(registry); | 260 apps::api::GeneratedFunctionRegistry::RegisterAll(registry); |
| 236 | 261 |
| 237 // Generated APIs from Chrome. | 262 // Generated APIs from Chrome. |
| 238 extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); | 263 extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); |
| 239 #endif | 264 #endif |
| 240 } | 265 } |
| 241 | 266 |
| 242 } // namespace extensions | 267 } // namespace extensions |
| OLD | NEW |