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

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

Issue 353013007: Implement <appview> skeleton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_view_skeleton
Patch Set: Fixed PermissionsTest unit test Created 6 years, 5 months 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 "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
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("webViewInternal", 240 source_map->RegisterSource("webViewInternal",
240 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); 241 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS);
241 // Note: webView not webview so that this doesn't interfere with the 242 // Note: webView not webview so that this doesn't interfere with the
242 // chrome.webview API bindings. 243 // chrome.webview API bindings.
243 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); 244 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS);
244 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); 245 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS);
245 source_map->RegisterSource("webViewExperimental", 246 source_map->RegisterSource("webViewExperimental",
246 IDR_WEB_VIEW_EXPERIMENTAL_JS); 247 IDR_WEB_VIEW_EXPERIMENTAL_JS);
247 source_map->RegisterSource("webViewRequest", 248 source_map->RegisterSource("webViewRequest",
248 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS); 249 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS);
250 source_map->RegisterSource("denyAppView", IDR_APP_VIEW_DENY_JS);
249 source_map->RegisterSource("denyWebView", IDR_WEB_VIEW_DENY_JS); 251 source_map->RegisterSource("denyWebView", IDR_WEB_VIEW_DENY_JS);
250 source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); 252 source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS);
251 } 253 }
252 254
253 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( 255 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules(
254 extensions::ModuleSystem* module_system, 256 extensions::ModuleSystem* module_system,
255 const extensions::Extension* extension, 257 const extensions::Extension* extension,
256 extensions::Feature::Context context_type, 258 extensions::Feature::Context context_type,
257 bool is_within_platform_app) { 259 bool is_within_platform_app) {
260 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is
261 // expensive. It would be better if there were a light way of detecting when
262 // a webview or appview is created and only then set up the infrastructure.
258 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && 263 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT &&
259 is_within_platform_app && 264 is_within_platform_app &&
260 extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && 265 extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV &&
261 CommandLine::ForCurrentProcess()->HasSwitch( 266 CommandLine::ForCurrentProcess()->HasSwitch(
262 ::switches::kEnableAppWindowControls)) { 267 ::switches::kEnableAppWindowControls)) {
263 module_system->Require("windowControls"); 268 module_system->Require("windowControls");
264 } 269 }
265 270
266 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform 271 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform
267 // apps. An ext/app runs in a blessed extension context, if it is the active 272 // apps. An ext/app runs in a blessed extension context, if it is the active
(...skipping 19 matching lines...) Expand all
287 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || 292 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" ||
288 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || 293 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" ||
289 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") { 294 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") {
290 module_system->Require("webViewExperimental"); 295 module_system->Require("webViewExperimental");
291 } 296 }
292 } 297 }
293 } else { 298 } else {
294 module_system->Require("denyWebView"); 299 module_system->Require("denyWebView");
295 } 300 }
296 } 301 }
302
303 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
304 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) &&
305 extension->permissions_data()->HasAPIPermission(
306 extensions::APIPermission::kAppView)) {
307 module_system->Require("appView");
308 } else {
309 module_system->Require("denyAppView");
310 }
311 }
297 } 312 }
298 313
299 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( 314 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated(
300 const std::set<std::string>& extension_ids) { 315 const std::set<std::string>& extension_ids) {
301 // In single-process mode, the browser process reports the active extensions. 316 // In single-process mode, the browser process reports the active extensions.
302 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) 317 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess))
303 return; 318 return;
304 crash_keys::SetActiveExtensions(extension_ids); 319 crash_keys::SetActiveExtensions(extension_ids);
305 } 320 }
306 321
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 new extensions::PermissionSet(extensions::APIPermissionSet(), 363 new extensions::PermissionSet(extensions::APIPermissionSet(),
349 extensions::ManifestPermissionSet(), 364 extensions::ManifestPermissionSet(),
350 origin_set, 365 origin_set,
351 extensions::URLPatternSet())); 366 extensions::URLPatternSet()));
352 } 367 }
353 368
354 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( 369 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage(
355 bool webrequest_used) { 370 bool webrequest_used) {
356 webrequest_used_ = webrequest_used; 371 webrequest_used_ = webrequest_used;
357 } 372 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/resources/extensions/app_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698