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

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

Issue 314113010: Remove deprecated permissions functions from Extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 v8_context, frame, extension, context_type)); 68 v8_context, frame, extension, context_type));
69 } 69 }
70 70
71 void ChromeExtensionsDispatcherDelegate::InitOriginPermissions( 71 void ChromeExtensionsDispatcherDelegate::InitOriginPermissions(
72 const extensions::Extension* extension, 72 const extensions::Extension* extension,
73 extensions::Feature::Context context_type) { 73 extensions::Feature::Context context_type) {
74 // TODO(jstritar): We should try to remove this special case. Also, these 74 // TODO(jstritar): We should try to remove this special case. Also, these
75 // whitelist entries need to be updated when the kManagement permission 75 // whitelist entries need to be updated when the kManagement permission
76 // changes. 76 // changes.
77 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && 77 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT &&
78 extension->HasAPIPermission(extensions::APIPermission::kManagement)) { 78 extension->permissions_data()->HasAPIPermission(
79 extensions::APIPermission::kManagement)) {
79 blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( 80 blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
80 extension->url(), 81 extension->url(),
81 blink::WebString::fromUTF8(content::kChromeUIScheme), 82 blink::WebString::fromUTF8(content::kChromeUIScheme),
82 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), 83 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost),
83 false); 84 false);
84 } 85 }
85 } 86 }
86 87
87 void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( 88 void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers(
88 extensions::Dispatcher* dispatcher, 89 extensions::Dispatcher* dispatcher,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 270
270 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform 271 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform
271 // 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
272 // extension in the current process, in other words, if it is loaded in a top 273 // extension in the current process, in other words, if it is loaded in a top
273 // frame. To support webview in a non-frame extension, we have to allow 274 // frame. To support webview in a non-frame extension, we have to allow
274 // unblessed extension context as well. 275 // unblessed extension context as well.
275 // Note: setting up the WebView class here, not the chrome.webview API. 276 // Note: setting up the WebView class here, not the chrome.webview API.
276 // The API will be automatically set up when first used. 277 // The API will be automatically set up when first used.
277 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT || 278 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT ||
278 context_type == extensions::Feature::UNBLESSED_EXTENSION_CONTEXT) { 279 context_type == extensions::Feature::UNBLESSED_EXTENSION_CONTEXT) {
279 if (extension->HasAPIPermission(extensions::APIPermission::kWebView)) { 280 if (extension->permissions_data()->HasAPIPermission(
281 extensions::APIPermission::kWebView)) {
280 module_system->Require("webView"); 282 module_system->Require("webView");
281 if (extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) { 283 if (extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) {
282 module_system->Require("webViewExperimental"); 284 module_system->Require("webViewExperimental");
283 } else { 285 } else {
284 // TODO(asargent) We need a whitelist for webview experimental. 286 // TODO(asargent) We need a whitelist for webview experimental.
285 // crbug.com/264852 287 // crbug.com/264852
286 std::string id_hash = base::SHA1HashString(extension->id()); 288 std::string id_hash = base::SHA1HashString(extension->id());
287 std::string hexencoded_id_hash = 289 std::string hexencoded_id_hash =
288 base::HexEncode(id_hash.c_str(), id_hash.length()); 290 base::HexEncode(id_hash.c_str(), id_hash.length());
289 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" || 291 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" ||
290 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || 292 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" ||
291 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || 293 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" ||
292 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") { 294 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") {
293 module_system->Require("webViewExperimental"); 295 module_system->Require("webViewExperimental");
294 } 296 }
295 } 297 }
296 } else { 298 } else {
297 module_system->Require("denyWebView"); 299 module_system->Require("denyWebView");
298 } 300 }
299 } 301 }
300 302
301 // Same comment as above for <adview> tag. 303 // Same comment as above for <adview> tag.
302 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && 304 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT &&
303 is_within_platform_app) { 305 is_within_platform_app) {
304 if (CommandLine::ForCurrentProcess()->HasSwitch( 306 if (CommandLine::ForCurrentProcess()->HasSwitch(
305 ::switches::kEnableAdview)) { 307 ::switches::kEnableAdview)) {
306 if (extension->HasAPIPermission(extensions::APIPermission::kAdView)) { 308 if (extension->permissions_data()->HasAPIPermission(
309 extensions::APIPermission::kAdView)) {
307 module_system->Require("adView"); 310 module_system->Require("adView");
308 } else { 311 } else {
309 module_system->Require("denyAdView"); 312 module_system->Require("denyAdView");
310 } 313 }
311 } 314 }
312 } 315 }
313 } 316 }
314 317
315 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( 318 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated(
316 const std::set<std::string>& extension_ids) { 319 const std::set<std::string>& extension_ids) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 371 }
369 372
370 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( 373 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage(
371 bool adblock, 374 bool adblock,
372 bool adblock_plus, 375 bool adblock_plus,
373 bool other) { 376 bool other) {
374 webrequest_adblock_ = adblock; 377 webrequest_adblock_ = adblock;
375 webrequest_adblock_plus_ = adblock_plus; 378 webrequest_adblock_plus_ = adblock_plus;
376 webrequest_other_ = other; 379 webrequest_other_ = other;
377 } 380 }
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer.cc ('k') | extensions/browser/api/storage/local_value_store_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698