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

Side by Side Diff: chrome/browser/extensions/active_tab_permission_granter.cc

Issue 12792005: Allow extensions on chrome:// URLs, when flag is set and permission is explicitly requested (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reinstate original pickle order; add scripts clause to content_script_chrome_url_invalid.json to av… Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/extensions/active_tab_permission_granter.h" 5 #include "chrome/browser/extensions/active_tab_permission_granter.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_system.h" 8 #include "chrome/browser/extensions/extension_system.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/session_id.h" 10 #include "chrome/browser/sessions/session_id.h"
(...skipping 23 matching lines...) Expand all
34 34
35 ActiveTabPermissionGranter::~ActiveTabPermissionGranter() {} 35 ActiveTabPermissionGranter::~ActiveTabPermissionGranter() {}
36 36
37 void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) { 37 void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) {
38 if (!extension->HasAPIPermission(extensions::APIPermission::kActiveTab)) 38 if (!extension->HasAPIPermission(extensions::APIPermission::kActiveTab))
39 return; 39 return;
40 40
41 if (IsGranted(extension)) 41 if (IsGranted(extension))
42 return; 42 return;
43 43
44 URLPattern pattern(UserScript::kValidUserScriptSchemes); 44 URLPattern pattern(UserScript::ValidUserScriptSchemes());
45 if (pattern.Parse(web_contents()->GetURL().spec()) != 45 if (pattern.Parse(web_contents()->GetURL().spec()) !=
46 URLPattern::PARSE_SUCCESS) { 46 URLPattern::PARSE_SUCCESS) {
47 // Pattern parsing could fail if this is an unsupported URL e.g. chrome://. 47 // Pattern parsing could fail if this is an unsupported URL e.g. chrome://.
48 return; 48 return;
49 } 49 }
50 50
51 APIPermissionSet new_apis; 51 APIPermissionSet new_apis;
52 new_apis.insert(APIPermission::kTab); 52 new_apis.insert(APIPermission::kTab);
53 URLPatternSet new_hosts; 53 URLPatternSet new_hosts;
54 new_hosts.AddPattern(pattern); 54 new_hosts.AddPattern(pattern);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids)); 108 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids));
109 granted_extensions_.Clear(); 109 granted_extensions_.Clear();
110 } 110 }
111 111
112 int32 ActiveTabPermissionGranter::GetPageID() { 112 int32 ActiveTabPermissionGranter::GetPageID() {
113 return web_contents()->GetController().GetActiveEntry()->GetPageID(); 113 return web_contents()->GetController().GetActiveEntry()->GetPageID();
114 } 114 }
115 115
116 } // namespace extensions 116 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/extensions/crx_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698