OLD | NEW |
---|---|
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 30 matching lines...) Expand all Loading... | |
41 !extension->HasAPIPermission(extensions::APIPermission::kTabCapture)) { | 41 !extension->HasAPIPermission(extensions::APIPermission::kTabCapture)) { |
42 return; | 42 return; |
43 } | 43 } |
44 | 44 |
45 if (IsGranted(extension)) | 45 if (IsGranted(extension)) |
46 return; | 46 return; |
47 | 47 |
48 URLPattern pattern(UserScript::ValidUserScriptSchemes()); | 48 URLPattern pattern(UserScript::ValidUserScriptSchemes()); |
49 if (pattern.Parse(web_contents()->GetURL().spec()) != | 49 if (pattern.Parse(web_contents()->GetURL().spec()) != |
50 URLPattern::PARSE_SUCCESS) { | 50 URLPattern::PARSE_SUCCESS) { |
51 // Allow tabCapture API to be granted access to chrome:// pages since it | |
52 // already requests all hosts permissions on extension install. | |
53 if (extension->HasAPIPermission(extensions::APIPermission::kTabCapture)) { | |
54 granted_extensions_.Insert(extension); | |
not at google - send to devlin
2013/06/17 18:14:13
this means that an extension with the tab capture
not at google - send to devlin
2013/06/17 18:16:09
checking it elsewhere wouldn't work either. maybe
justinlin
2013/06/17 18:22:20
Does it actually do that? I thought the injection
not at google - send to devlin
2013/06/17 18:44:45
I see; IsGranted is only used in the tab capture A
| |
55 } | |
56 | |
51 // Pattern parsing could fail if this is an unsupported URL e.g. chrome://. | 57 // Pattern parsing could fail if this is an unsupported URL e.g. chrome://. |
52 return; | 58 return; |
53 } | 59 } |
54 | 60 |
55 APIPermissionSet new_apis; | 61 APIPermissionSet new_apis; |
56 new_apis.insert(APIPermission::kTab); | 62 new_apis.insert(APIPermission::kTab); |
57 URLPatternSet new_hosts; | 63 URLPatternSet new_hosts; |
58 new_hosts.AddPattern(pattern); | 64 new_hosts.AddPattern(pattern); |
59 scoped_refptr<const PermissionSet> new_permissions = | 65 scoped_refptr<const PermissionSet> new_permissions = |
60 new PermissionSet(new_apis, new_hosts, URLPatternSet()); | 66 new PermissionSet(new_apis, new_hosts, URLPatternSet()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 119 |
114 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids)); | 120 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids)); |
115 granted_extensions_.Clear(); | 121 granted_extensions_.Clear(); |
116 } | 122 } |
117 | 123 |
118 int32 ActiveTabPermissionGranter::GetPageID() { | 124 int32 ActiveTabPermissionGranter::GetPageID() { |
119 return web_contents()->GetController().GetActiveEntry()->GetPageID(); | 125 return web_contents()->GetController().GetActiveEntry()->GetPageID(); |
120 } | 126 } |
121 | 127 |
122 } // namespace extensions | 128 } // namespace extensions |
OLD | NEW |