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

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

Issue 1349613003: [Extensions] Un-refcount PermissionSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 2 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 (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/active_script_controller.h" 7 #include "chrome/browser/extensions/active_script_controller.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "content/public/browser/navigation_details.h" 9 #include "content/public/browser/navigation_details.h"
10 #include "content/public/browser/navigation_entry.h" 10 #include "content/public/browser/navigation_entry.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 new_hosts.AddOrigin(UserScript::ValidUserScriptSchemes(), 97 new_hosts.AddOrigin(UserScript::ValidUserScriptSchemes(),
98 web_contents()->GetVisibleURL().GetOrigin()); 98 web_contents()->GetVisibleURL().GetOrigin());
99 new_apis.insert(APIPermission::kTab); 99 new_apis.insert(APIPermission::kTab);
100 } 100 }
101 101
102 if (permissions_data->HasAPIPermission(APIPermission::kTabCapture)) 102 if (permissions_data->HasAPIPermission(APIPermission::kTabCapture))
103 new_apis.insert(APIPermission::kTabCaptureForTab); 103 new_apis.insert(APIPermission::kTabCaptureForTab);
104 104
105 if (!new_apis.empty() || !new_hosts.is_empty()) { 105 if (!new_apis.empty() || !new_hosts.is_empty()) {
106 granted_extensions_.Insert(extension); 106 granted_extensions_.Insert(extension);
107 scoped_refptr<const PermissionSet> new_permissions = 107 PermissionSet new_permissions(new_apis, ManifestPermissionSet(), new_hosts,
108 new PermissionSet(new_apis, ManifestPermissionSet(), 108 URLPatternSet());
109 new_hosts, URLPatternSet());
110 permissions_data->UpdateTabSpecificPermissions(tab_id_, new_permissions); 109 permissions_data->UpdateTabSpecificPermissions(tab_id_, new_permissions);
111 const content::NavigationEntry* navigation_entry = 110 const content::NavigationEntry* navigation_entry =
112 web_contents()->GetController().GetVisibleEntry(); 111 web_contents()->GetController().GetVisibleEntry();
113 if (navigation_entry) { 112 if (navigation_entry) {
114 // We update all extension render views with the new tab permissions, and 113 // We update all extension render views with the new tab permissions, and
115 // also the tab itself. 114 // also the tab itself.
116 CreateMessageFunction update_message = 115 CreateMessageFunction update_message =
117 base::Bind(&CreateUpdateMessage, 116 base::Bind(&CreateUpdateMessage,
118 navigation_entry->GetURL(), 117 navigation_entry->GetURL(),
119 extension->id(), 118 extension->id(),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 CreateMessageFunction clear_message = 195 CreateMessageFunction clear_message =
197 base::Bind(&CreateClearMessage, extension_ids, tab_id_); 196 base::Bind(&CreateClearMessage, extension_ids, tab_id_);
198 SendMessageToProcesses(frame_hosts, 197 SendMessageToProcesses(frame_hosts,
199 web_contents()->GetRenderProcessHost(), 198 web_contents()->GetRenderProcessHost(),
200 clear_message); 199 clear_message);
201 200
202 granted_extensions_.Clear(); 201 granted_extensions_.Clear();
203 } 202 }
204 203
205 } // namespace extensions 204 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698