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

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

Issue 795543002: Added PermissionIDSet to APIPermissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permissions_patch_1_static_initializer_fix
Patch Set: Rebase Created 6 years 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 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/api_permission.h" 5 #include "extensions/common/permissions/api_permission.h"
6 6
7 #include "extensions/common/permissions/api_permission_set.h"
7 #include "ui/base/l10n/l10n_util.h" 8 #include "ui/base/l10n/l10n_util.h"
8 9
9 namespace { 10 namespace {
10 11
11 using extensions::APIPermission; 12 using extensions::APIPermission;
12 using extensions::APIPermissionInfo; 13 using extensions::APIPermissionInfo;
13 using extensions::PermissionMessage; 14 using extensions::PermissionMessage;
14 using extensions::PermissionMessages; 15 using extensions::PermissionMessages;
15 16
16 class SimpleAPIPermission : public APIPermission { 17 class SimpleAPIPermission : public APIPermission {
17 public: 18 public:
18 explicit SimpleAPIPermission(const APIPermissionInfo* permission) 19 explicit SimpleAPIPermission(const APIPermissionInfo* permission)
19 : APIPermission(permission) { } 20 : APIPermission(permission) { }
20 21
21 ~SimpleAPIPermission() override {} 22 ~SimpleAPIPermission() override {}
22 23
24 extensions::PermissionIDSet GetPermissions() const override {
25 return extensions::PermissionIDSet(id());
26 }
27
23 bool HasMessages() const override { 28 bool HasMessages() const override {
24 return info()->message_id() > PermissionMessage::kNone; 29 return info()->message_id() > PermissionMessage::kNone;
25 } 30 }
26 31
27 PermissionMessages GetMessages() const override { 32 PermissionMessages GetMessages() const override {
28 DCHECK(HasMessages()); 33 DCHECK(HasMessages());
29 PermissionMessages result; 34 PermissionMessages result;
30 result.push_back(GetMessage_()); 35 result.push_back(GetMessage_());
31 return result; 36 return result;
32 } 37 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return api_permission_constructor_ ? 131 return api_permission_constructor_ ?
127 api_permission_constructor_(this) : new SimpleAPIPermission(this); 132 api_permission_constructor_(this) : new SimpleAPIPermission(this);
128 } 133 }
129 134
130 PermissionMessage APIPermissionInfo::GetMessage_() const { 135 PermissionMessage APIPermissionInfo::GetMessage_() const {
131 return PermissionMessage( 136 return PermissionMessage(
132 message_id_, l10n_util::GetStringUTF16(l10n_message_id_)); 137 message_id_, l10n_util::GetStringUTF16(l10n_message_id_));
133 } 138 }
134 139
135 } // namespace extensions 140 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/api_permission.h ('k') | extensions/common/permissions/api_permission_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698