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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 source_map->RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); | 228 source_map->RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); |
229 source_map->RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); | 229 source_map->RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); |
230 | 230 |
231 // Custom types sources. | 231 // Custom types sources. |
232 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); | 232 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); |
233 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); | 233 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); |
234 source_map->RegisterSource("ChromeDirectSetting", | 234 source_map->RegisterSource("ChromeDirectSetting", |
235 IDR_CHROME_DIRECT_SETTING_JS); | 235 IDR_CHROME_DIRECT_SETTING_JS); |
236 | 236 |
237 // Platform app sources that are not API-specific.. | 237 // Platform app sources that are not API-specific.. |
| 238 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); |
238 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); | 239 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); |
239 source_map->RegisterSource("webview", IDR_WEBVIEW_CUSTOM_BINDINGS_JS); | 240 source_map->RegisterSource("webview", IDR_WEBVIEW_CUSTOM_BINDINGS_JS); |
240 // Note: webView not webview so that this doesn't interfere with the | 241 // Note: webView not webview so that this doesn't interfere with the |
241 // chrome.webview API bindings. | 242 // chrome.webview API bindings. |
242 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); | 243 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); |
243 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); | 244 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); |
244 source_map->RegisterSource("webViewExperimental", | 245 source_map->RegisterSource("webViewExperimental", |
245 IDR_WEB_VIEW_EXPERIMENTAL_JS); | 246 IDR_WEB_VIEW_EXPERIMENTAL_JS); |
246 source_map->RegisterSource("webViewRequest", | 247 source_map->RegisterSource("webViewRequest", |
247 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS); | 248 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || | 287 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || |
287 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || | 288 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || |
288 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") { | 289 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") { |
289 module_system->Require("webViewExperimental"); | 290 module_system->Require("webViewExperimental"); |
290 } | 291 } |
291 } | 292 } |
292 } else { | 293 } else { |
293 module_system->Require("denyWebView"); | 294 module_system->Require("denyWebView"); |
294 } | 295 } |
295 } | 296 } |
| 297 |
| 298 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { |
| 299 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) && |
| 300 extension->permissions_data()->HasAPIPermission( |
| 301 extensions::APIPermission::kAppView)) { |
| 302 module_system->Require("appView"); |
| 303 } |
| 304 } |
296 } | 305 } |
297 | 306 |
298 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 307 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
299 const std::set<std::string>& extension_ids) { | 308 const std::set<std::string>& extension_ids) { |
300 // In single-process mode, the browser process reports the active extensions. | 309 // In single-process mode, the browser process reports the active extensions. |
301 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) | 310 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) |
302 return; | 311 return; |
303 crash_keys::SetActiveExtensions(extension_ids); | 312 crash_keys::SetActiveExtensions(extension_ids); |
304 } | 313 } |
305 | 314 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 new extensions::PermissionSet(extensions::APIPermissionSet(), | 356 new extensions::PermissionSet(extensions::APIPermissionSet(), |
348 extensions::ManifestPermissionSet(), | 357 extensions::ManifestPermissionSet(), |
349 origin_set, | 358 origin_set, |
350 extensions::URLPatternSet())); | 359 extensions::URLPatternSet())); |
351 } | 360 } |
352 | 361 |
353 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( | 362 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( |
354 bool webrequest_used) { | 363 bool webrequest_used) { |
355 webrequest_used_ = webrequest_used; | 364 webrequest_used_ = webrequest_used; |
356 } | 365 } |
OLD | NEW |