| 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 "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" | 5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 extensions::ScriptContext* context, | 225 extensions::ScriptContext* context, |
| 226 bool is_within_platform_app) { | 226 bool is_within_platform_app) { |
| 227 extensions::ModuleSystem* module_system = context->module_system(); | 227 extensions::ModuleSystem* module_system = context->module_system(); |
| 228 extensions::Feature::Context context_type = context->context_type(); | 228 extensions::Feature::Context context_type = context->context_type(); |
| 229 | 229 |
| 230 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is | 230 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is |
| 231 // expensive. It would be better if there were a light way of detecting when | 231 // expensive. It would be better if there were a light way of detecting when |
| 232 // a webview or appview is created and only then set up the infrastructure. | 232 // a webview or appview is created and only then set up the infrastructure. |
| 233 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && | 233 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && |
| 234 is_within_platform_app && | 234 is_within_platform_app && |
| 235 extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && | 235 extensions::GetCurrentChannel() <= version_info::CHANNEL_DEV && |
| 236 base::CommandLine::ForCurrentProcess()->HasSwitch( | 236 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 237 extensions::switches::kEnableAppWindowControls)) { | 237 extensions::switches::kEnableAppWindowControls)) { |
| 238 module_system->Require("windowControls"); | 238 module_system->Require("windowControls"); |
| 239 } | 239 } |
| 240 | 240 |
| 241 // Note: setting up the WebView class here, not the chrome.webview API. | 241 // Note: setting up the WebView class here, not the chrome.webview API. |
| 242 // The API will be automatically set up when first used. | 242 // The API will be automatically set up when first used. |
| 243 if (context->GetAvailability("webViewInternal").is_available()) { | 243 if (context->GetAvailability("webViewInternal").is_available()) { |
| 244 module_system->Require("chromeWebView"); | 244 module_system->Require("chromeWebView"); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 248 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
| 249 const std::set<std::string>& extension_ids) { | 249 const std::set<std::string>& extension_ids) { |
| 250 // In single-process mode, the browser process reports the active extensions. | 250 // In single-process mode, the browser process reports the active extensions. |
| 251 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 251 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 252 ::switches::kSingleProcess)) | 252 ::switches::kSingleProcess)) |
| 253 return; | 253 return; |
| 254 crash_keys::SetActiveExtensions(extension_ids); | 254 crash_keys::SetActiveExtensions(extension_ids); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) { | 257 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) { |
| 258 extensions::SetCurrentChannel( | 258 extensions::SetCurrentChannel(static_cast<version_info::Channel>(channel)); |
| 259 static_cast<chrome::VersionInfo::Channel>(channel)); | |
| 260 } | 259 } |
| OLD | NEW |