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

Side by Side Diff: extensions/common/permissions/permission_set.cc

Issue 149163002: app_shell: Add ShellContentRendererClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (content_renderer_client) Created 6 years, 10 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 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 "extensions/common/permissions/permission_set.h" 5 #include "extensions/common/permissions/permission_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <string> 9 #include <string>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 bool PermissionSet::HasAPIPermission( 175 bool PermissionSet::HasAPIPermission(
176 APIPermission::ID id) const { 176 APIPermission::ID id) const {
177 return apis().find(id) != apis().end(); 177 return apis().find(id) != apis().end();
178 } 178 }
179 179
180 bool PermissionSet::HasAPIPermission(const std::string& permission_name) const { 180 bool PermissionSet::HasAPIPermission(const std::string& permission_name) const {
181 const APIPermissionInfo* permission = 181 const APIPermissionInfo* permission =
182 PermissionsInfo::GetInstance()->GetByName(permission_name); 182 PermissionsInfo::GetInstance()->GetByName(permission_name);
183 // Ensure our PermissionsProvider is aware of this permission.
183 CHECK(permission) << permission_name; 184 CHECK(permission) << permission_name;
184 return (permission && apis_.count(permission->id())); 185 return (permission && apis_.count(permission->id()));
185 } 186 }
186 187
187 bool PermissionSet::CheckAPIPermission(APIPermission::ID permission) const { 188 bool PermissionSet::CheckAPIPermission(APIPermission::ID permission) const {
188 return CheckAPIPermissionWithParam(permission, NULL); 189 return CheckAPIPermissionWithParam(permission, NULL);
189 } 190 }
190 191
191 bool PermissionSet::CheckAPIPermissionWithParam( 192 bool PermissionSet::CheckAPIPermissionWithParam(
192 APIPermission::ID permission, 193 APIPermission::ID permission,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 265 }
265 266
266 void PermissionSet::InitEffectiveHosts() { 267 void PermissionSet::InitEffectiveHosts() {
267 effective_hosts_.ClearPatterns(); 268 effective_hosts_.ClearPatterns();
268 269
269 URLPatternSet::CreateUnion( 270 URLPatternSet::CreateUnion(
270 explicit_hosts(), scriptable_hosts(), &effective_hosts_); 271 explicit_hosts(), scriptable_hosts(), &effective_hosts_);
271 } 272 }
272 273
273 } // namespace extensions 274 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/api_permission.h ('k') | extensions/common/permissions/permissions_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698