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

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

Issue 1140173003: Allow whitelisted content scripts to be injected in WebViews. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@document_has_focus
Patch Set: Don't assume extensions_->GetByID will succeed Created 5 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer_permissions_policy_delegate.h" 5 #include "chrome/renderer/extensions/renderer_permissions_policy_delegate.h"
6 6
7 #include "chrome/common/extensions/extension_constants.h" 7 #include "chrome/common/extensions/extension_constants.h"
8 #include "extensions/common/constants.h" 8 #include "extensions/common/constants.h"
9 #include "extensions/common/extensions_client.h" 9 #include "extensions/common/extensions_client.h"
10 #include "extensions/common/manifest_constants.h" 10 #include "extensions/common/manifest_constants.h"
(...skipping 12 matching lines...) Expand all
23 PermissionsData::SetPolicyDelegate(NULL); 23 PermissionsData::SetPolicyDelegate(NULL);
24 } 24 }
25 25
26 bool RendererPermissionsPolicyDelegate::CanExecuteScriptOnPage( 26 bool RendererPermissionsPolicyDelegate::CanExecuteScriptOnPage(
27 const Extension* extension, 27 const Extension* extension,
28 const GURL& document_url, 28 const GURL& document_url,
29 const GURL& top_document_url, 29 const GURL& top_document_url,
30 int tab_id, 30 int tab_id,
31 int process_id, 31 int process_id,
32 std::string* error) { 32 std::string* error) {
33 const ExtensionsClient::ScriptingWhitelist& whitelist = 33 if (PermissionsData::CanExecuteScriptEverywhere(extension))
34 ExtensionsClient::Get()->GetScriptingWhitelist();
35 if (std::find(whitelist.begin(), whitelist.end(), extension->id()) !=
36 whitelist.end()) {
37 return true; 34 return true;
38 }
39 35
40 if (dispatcher_->IsExtensionActive(kWebStoreAppId)) { 36 if (dispatcher_->IsExtensionActive(kWebStoreAppId)) {
41 if (error) 37 if (error)
42 *error = errors::kCannotScriptGallery; 38 *error = errors::kCannotScriptGallery;
43 return false; 39 return false;
44 } 40 }
45 41
46 return true; 42 return true;
47 } 43 }
48 44
49 } // namespace extensions 45 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698