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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 source_map->RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); | 231 source_map->RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); |
232 | 232 |
233 // Custom types sources. | 233 // Custom types sources. |
234 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); | 234 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); |
235 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); | 235 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); |
236 source_map->RegisterSource("ChromeDirectSetting", | 236 source_map->RegisterSource("ChromeDirectSetting", |
237 IDR_CHROME_DIRECT_SETTING_JS); | 237 IDR_CHROME_DIRECT_SETTING_JS); |
238 | 238 |
239 // Platform app sources that are not API-specific.. | 239 // Platform app sources that are not API-specific.. |
240 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); | 240 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); |
241 source_map->RegisterSource("extensionOptions", IDR_EXTENSION_OPTIONS_JS); | |
241 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); | 242 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); |
242 source_map->RegisterSource("webViewInternal", | 243 source_map->RegisterSource("webViewInternal", |
243 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); | 244 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); |
244 // Note: webView not webview so that this doesn't interfere with the | 245 // Note: webView not webview so that this doesn't interfere with the |
245 // chrome.webview API bindings. | 246 // chrome.webview API bindings. |
246 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); | 247 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); |
247 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); | 248 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); |
248 source_map->RegisterSource("webViewExperimental", | 249 source_map->RegisterSource("webViewExperimental", |
249 IDR_WEB_VIEW_EXPERIMENTAL_JS); | 250 IDR_WEB_VIEW_EXPERIMENTAL_JS); |
250 source_map->RegisterSource("webViewRequest", | 251 source_map->RegisterSource("webViewRequest", |
251 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS); | 252 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS); |
252 source_map->RegisterSource("denyAppView", IDR_APP_VIEW_DENY_JS); | 253 source_map->RegisterSource("denyAppView", IDR_APP_VIEW_DENY_JS); |
254 source_map->RegisterSource("denyExtensionOptions", | |
not at google - send to devlin
2014/07/08 15:43:39
I don't think we need this "deny" logic. As I unde
ericzeng
2014/07/08 18:10:48
Done.
| |
255 IDR_EXTENSION_OPTIONS_DENY_JS); | |
253 source_map->RegisterSource("denyWebView", IDR_WEB_VIEW_DENY_JS); | 256 source_map->RegisterSource("denyWebView", IDR_WEB_VIEW_DENY_JS); |
254 source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); | 257 source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); |
255 } | 258 } |
256 | 259 |
257 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( | 260 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( |
258 extensions::ModuleSystem* module_system, | 261 extensions::ModuleSystem* module_system, |
259 const extensions::Extension* extension, | 262 const extensions::Extension* extension, |
260 extensions::Feature::Context context_type, | 263 extensions::Feature::Context context_type, |
261 bool is_within_platform_app) { | 264 bool is_within_platform_app) { |
262 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is | 265 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 } | 305 } |
303 } | 306 } |
304 | 307 |
305 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { | 308 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { |
306 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) && | 309 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) && |
307 extension->permissions_data()->HasAPIPermission( | 310 extension->permissions_data()->HasAPIPermission( |
308 extensions::APIPermission::kAppView)) { | 311 extensions::APIPermission::kAppView)) { |
309 module_system->Require("appView"); | 312 module_system->Require("appView"); |
310 } else { | 313 } else { |
311 module_system->Require("denyAppView"); | 314 module_system->Require("denyAppView"); |
312 } | 315 } |
not at google - send to devlin
2014/07/08 15:43:39
you might as well add some observable behaviour fo
Fady Samuel
2014/07/08 15:46:48
I will be sending you the following for review sho
| |
313 } | 316 } |
314 } | 317 } |
315 | 318 |
316 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 319 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
317 const std::set<std::string>& extension_ids) { | 320 const std::set<std::string>& extension_ids) { |
318 // In single-process mode, the browser process reports the active extensions. | 321 // In single-process mode, the browser process reports the active extensions. |
319 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) | 322 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) |
320 return; | 323 return; |
321 crash_keys::SetActiveExtensions(extension_ids); | 324 crash_keys::SetActiveExtensions(extension_ids); |
322 } | 325 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 new extensions::PermissionSet(extensions::APIPermissionSet(), | 369 new extensions::PermissionSet(extensions::APIPermissionSet(), |
367 extensions::ManifestPermissionSet(), | 370 extensions::ManifestPermissionSet(), |
368 origin_set, | 371 origin_set, |
369 extensions::URLPatternSet())); | 372 extensions::URLPatternSet())); |
370 } | 373 } |
371 | 374 |
372 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( | 375 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( |
373 bool webrequest_used) { | 376 bool webrequest_used) { |
374 webrequest_used_ = webrequest_used; | 377 webrequest_used_ = webrequest_used; |
375 } | 378 } |
OLD | NEW |