Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc

Issue 2551303003: Remove unused packaged app window controls code. (Closed)
Patch Set: Feedback Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 // Custom types sources. 255 // Custom types sources.
256 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); 256 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS);
257 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); 257 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS);
258 source_map->RegisterSource("ChromeDirectSetting", 258 source_map->RegisterSource("ChromeDirectSetting",
259 IDR_CHROME_DIRECT_SETTING_JS); 259 IDR_CHROME_DIRECT_SETTING_JS);
260 260
261 // Platform app sources that are not API-specific.. 261 // Platform app sources that are not API-specific..
262 source_map->RegisterSource("fileEntryBindingUtil", 262 source_map->RegisterSource("fileEntryBindingUtil",
263 IDR_FILE_ENTRY_BINDING_UTIL_JS); 263 IDR_FILE_ENTRY_BINDING_UTIL_JS);
264 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS);
265 source_map->RegisterSource("chromeWebViewInternal", 264 source_map->RegisterSource("chromeWebViewInternal",
266 IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); 265 IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS);
267 source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); 266 source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS);
268 } 267 }
269 268
270 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( 269 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules(
271 extensions::ScriptContext* context, 270 extensions::ScriptContext* context) {
272 bool is_within_platform_app) { 271 if (context->GetAvailability("webViewInternal").is_available()) {
273 extensions::ModuleSystem* module_system = context->module_system(); 272 // TODO(fsamuel): Eagerly calling Require on context startup is expensive.
274 extensions::Feature::Context context_type = context->context_type(); 273 // It would be better if there were a light way of detecting when a webview
274 // or appview is created and only then set up the infrastructure.
275 275
276 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is 276 // Note: setting up the WebView class here, not the chrome.webview API.
tapted 2016/12/16 03:07:09 optional nit: this comment could stay above the `i
benwells 2016/12/19 03:54:13 Done.
277 // expensive. It would be better if there were a light way of detecting when 277 // The API will be automatically set up when first used.
278 // a webview or appview is created and only then set up the infrastructure. 278 context->module_system()->Require("chromeWebView");
279 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT &&
280 is_within_platform_app &&
281 extensions::GetCurrentChannel() <= version_info::Channel::DEV &&
282 base::CommandLine::ForCurrentProcess()->HasSwitch(
283 extensions::switches::kEnableAppWindowControls)) {
284 module_system->Require("windowControls");
285 }
286
287 // Note: setting up the WebView class here, not the chrome.webview API.
288 // The API will be automatically set up when first used.
289 if (context->GetAvailability("webViewInternal").is_available()) {
290 module_system->Require("chromeWebView");
291 } 279 }
292 } 280 }
293 281
294 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( 282 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated(
295 const std::set<std::string>& extension_ids) { 283 const std::set<std::string>& extension_ids) {
296 // In single-process mode, the browser process reports the active extensions. 284 // In single-process mode, the browser process reports the active extensions.
297 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 285 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
298 ::switches::kSingleProcess)) 286 ::switches::kSingleProcess))
299 return; 287 return;
300 crash_keys::SetActiveExtensions(extension_ids); 288 crash_keys::SetActiveExtensions(extension_ids);
301 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698