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

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

Issue 980353003: Extensions: Switch to new permission message system, part I (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 9 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
« no previous file with comments | « extensions/common/permissions/permissions_data.h ('k') | extensions/extensions.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_data.h" 5 #include "extensions/common/permissions/permissions_data.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/public/common/url_constants.h" 8 #include "content/public/common/url_constants.h"
9 #include "extensions/common/constants.h" 9 #include "extensions/common/constants.h"
10 #include "extensions/common/error_utils.h" 10 #include "extensions/common/error_utils.h"
11 #include "extensions/common/extension.h" 11 #include "extensions/common/extension.h"
12 #include "extensions/common/extensions_client.h" 12 #include "extensions/common/extensions_client.h"
13 #include "extensions/common/manifest.h" 13 #include "extensions/common/manifest.h"
14 #include "extensions/common/manifest_constants.h" 14 #include "extensions/common/manifest_constants.h"
15 #include "extensions/common/manifest_handlers/permissions_parser.h" 15 #include "extensions/common/manifest_handlers/permissions_parser.h"
16 #include "extensions/common/permissions/permission_message_provider.h"
17 #include "extensions/common/permissions/permission_message_util.h" 16 #include "extensions/common/permissions/permission_message_util.h"
18 #include "extensions/common/switches.h" 17 #include "extensions/common/switches.h"
19 #include "extensions/common/url_pattern_set.h" 18 #include "extensions/common/url_pattern_set.h"
20 #include "url/gurl.h" 19 #include "url/gurl.h"
21 #include "url/url_constants.h" 20 #include "url/url_constants.h"
22 21
23 namespace extensions { 22 namespace extensions {
24 23
25 namespace { 24 namespace {
26 25
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 197
199 PermissionMessageIDs PermissionsData::GetLegacyPermissionMessageIDs() const { 198 PermissionMessageIDs PermissionsData::GetLegacyPermissionMessageIDs() const {
200 if (ShouldSkipPermissionWarnings(extension_id_)) { 199 if (ShouldSkipPermissionWarnings(extension_id_)) {
201 return PermissionMessageIDs(); 200 return PermissionMessageIDs();
202 } else { 201 } else {
203 return PermissionMessageProvider::Get()->GetLegacyPermissionMessageIDs( 202 return PermissionMessageProvider::Get()->GetLegacyPermissionMessageIDs(
204 active_permissions().get(), manifest_type_); 203 active_permissions().get(), manifest_type_);
205 } 204 }
206 } 205 }
207 206
208 std::vector<base::string16> PermissionsData::GetPermissionMessageStrings() 207 PermissionMessageStrings PermissionsData::GetPermissionMessageStrings() const {
208 if (ShouldSkipPermissionWarnings(extension_id_))
209 return PermissionMessageStrings();
210 return PermissionMessageProvider::Get()->GetPermissionMessageStrings(
211 active_permissions().get(), manifest_type_);
212 }
213
214 std::vector<base::string16> PermissionsData::GetLegacyPermissionMessageStrings()
209 const { 215 const {
210 if (ShouldSkipPermissionWarnings(extension_id_)) 216 if (ShouldSkipPermissionWarnings(extension_id_))
211 return std::vector<base::string16>(); 217 return std::vector<base::string16>();
212 return PermissionMessageProvider::Get()->GetLegacyWarningMessages( 218 return PermissionMessageProvider::Get()->GetLegacyWarningMessages(
213 active_permissions().get(), manifest_type_); 219 active_permissions().get(), manifest_type_);
214 } 220 }
215 221
216 std::vector<base::string16> 222 std::vector<base::string16>
217 PermissionsData::GetPermissionMessageDetailsStrings() const { 223 PermissionsData::GetLegacyPermissionMessageDetailsStrings() const {
218 if (ShouldSkipPermissionWarnings(extension_id_)) 224 if (ShouldSkipPermissionWarnings(extension_id_))
219 return std::vector<base::string16>(); 225 return std::vector<base::string16>();
220 return PermissionMessageProvider::Get()->GetLegacyWarningMessagesDetails( 226 return PermissionMessageProvider::Get()->GetLegacyWarningMessagesDetails(
221 active_permissions().get(), manifest_type_); 227 active_permissions().get(), manifest_type_);
222 } 228 }
223 229
224 CoalescedPermissionMessages PermissionsData::GetCoalescedPermissionMessages() 230 CoalescedPermissionMessages PermissionsData::GetCoalescedPermissionMessages()
225 const { 231 const {
226 return PermissionMessageProvider::Get()->GetCoalescedPermissionMessages( 232 return PermissionMessageProvider::Get()->GetCoalescedPermissionMessages(
227 PermissionMessageProvider::Get()->GetAllPermissionIDs( 233 PermissionMessageProvider::Get()->GetAllPermissionIDs(
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 return ACCESS_WITHHELD; 387 return ACCESS_WITHHELD;
382 388
383 if (error) { 389 if (error) {
384 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage, 390 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage,
385 document_url.spec()); 391 document_url.spec());
386 } 392 }
387 return ACCESS_DENIED; 393 return ACCESS_DENIED;
388 } 394 }
389 395
390 } // namespace extensions 396 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/permissions_data.h ('k') | extensions/extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698