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

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

Issue 23819020: Gives ChromeVox access to the web store again. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments. Use whitelist. Created 7 years, 3 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/extensions/extension_constants.h" 9 #include "chrome/common/extensions/extension_constants.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 bool RendererPermissionsPolicyDelegate::CanExecuteScriptOnPage( 25 bool RendererPermissionsPolicyDelegate::CanExecuteScriptOnPage(
26 const Extension* extension, 26 const Extension* extension,
27 const GURL& document_url, 27 const GURL& document_url,
28 const GURL& top_document_url, 28 const GURL& top_document_url,
29 int tab_id, 29 int tab_id,
30 const UserScript* script, 30 const UserScript* script,
31 int process_id, 31 int process_id,
32 std::string* error) { 32 std::string* error) {
33 const Extension::ScriptingWhitelist* whitelist =
34 Extension::GetScriptingWhitelist();
35 if (std::find(whitelist->begin(), whitelist->end(), extension->id()) !=
36 whitelist->end()) {
37 return true;
38 }
39
33 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSigninProcess)) { 40 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSigninProcess)) {
34 if (error) 41 if (error)
35 *error = errors::kCannotScriptSigninPage; 42 *error = errors::kCannotScriptSigninPage;
36 return false; 43 return false;
37 } 44 }
38 45
39 if (dispatcher_->IsExtensionActive(extension_misc::kWebStoreAppId)) { 46 if (dispatcher_->IsExtensionActive(extension_misc::kWebStoreAppId)) {
40 if (error) 47 if (error)
41 *error = errors::kCannotScriptGallery; 48 *error = errors::kCannotScriptGallery;
42 return false; 49 return false;
43 } 50 }
44 51
45 return true; 52 return true;
46 } 53 }
47 54
48 } // namespace extensions 55 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698