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

Side by Side Diff: extensions/common/permissions/permissions_info.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
« no previous file with comments | « extensions/common/permissions/permission_set.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/permissions_info.h" 5 #include "extensions/common/permissions/permissions_info.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 bool PermissionsInfo::HasChildPermissions(const std::string& name) const { 58 bool PermissionsInfo::HasChildPermissions(const std::string& name) const {
59 NameMap::const_iterator i = name_map_.lower_bound(name + '.'); 59 NameMap::const_iterator i = name_map_.lower_bound(name + '.');
60 if (i == name_map_.end()) return false; 60 if (i == name_map_.end()) return false;
61 return StartsWithASCII(i->first, name + '.', true); 61 return StartsWithASCII(i->first, name + '.', true);
62 } 62 }
63 63
64 PermissionsInfo::PermissionsInfo() 64 PermissionsInfo::PermissionsInfo()
65 : hosted_app_permission_count_(0), 65 : hosted_app_permission_count_(0),
66 permission_count_(0) { 66 permission_count_(0) {
67 DCHECK(ExtensionsClient::Get());
68 InitializeWithProvider(ExtensionsClient::Get()->GetPermissionsProvider()); 67 InitializeWithProvider(ExtensionsClient::Get()->GetPermissionsProvider());
69 } 68 }
70 69
71 void PermissionsInfo::InitializeWithProvider( 70 void PermissionsInfo::InitializeWithProvider(
72 const PermissionsProvider& provider) { 71 const PermissionsProvider& provider) {
73 std::vector<APIPermissionInfo*> permissions = provider.GetAllPermissions(); 72 std::vector<APIPermissionInfo*> permissions = provider.GetAllPermissions();
74 std::vector<PermissionsProvider::AliasInfo> aliases = 73 std::vector<PermissionsProvider::AliasInfo> aliases =
75 provider.GetAllAliases(); 74 provider.GetAllAliases();
76 75
77 for (size_t i = 0; i < permissions.size(); ++i) 76 for (size_t i = 0; i < permissions.size(); ++i)
(...skipping 14 matching lines...) Expand all
92 DCHECK(!ContainsKey(id_map_, permission->id())); 91 DCHECK(!ContainsKey(id_map_, permission->id()));
93 DCHECK(!ContainsKey(name_map_, permission->name())); 92 DCHECK(!ContainsKey(name_map_, permission->name()));
94 93
95 id_map_[permission->id()] = permission; 94 id_map_[permission->id()] = permission;
96 name_map_[permission->name()] = permission; 95 name_map_[permission->name()] = permission;
97 96
98 permission_count_++; 97 permission_count_++;
99 } 98 }
100 99
101 } // namespace extensions 100 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/permission_set.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698