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

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

Issue 2950263003: Use ContainsValue() instead of std::find() in extensions/ (Closed)
Patch Set: Rebase patch. Created 3 years, 5 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/extension_l10n_util.cc ('k') | extensions/common/url_pattern_set_unittest.cc » ('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 <algorithm>
8 #include <utility> 7 #include <utility>
9 8
10 #include "base/command_line.h" 9 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
12 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/stl_util.h"
13 #include "content/public/common/url_constants.h" 13 #include "content/public/common/url_constants.h"
14 #include "extensions/common/constants.h" 14 #include "extensions/common/constants.h"
15 #include "extensions/common/error_utils.h" 15 #include "extensions/common/error_utils.h"
16 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
17 #include "extensions/common/extensions_client.h" 17 #include "extensions/common/extensions_client.h"
18 #include "extensions/common/manifest.h" 18 #include "extensions/common/manifest.h"
19 #include "extensions/common/manifest_constants.h" 19 #include "extensions/common/manifest_constants.h"
20 #include "extensions/common/manifest_handlers/permissions_parser.h" 20 #include "extensions/common/manifest_handlers/permissions_parser.h"
21 #include "extensions/common/permissions/api_permission.h" 21 #include "extensions/common/permissions/api_permission.h"
22 #include "extensions/common/permissions/permission_message_provider.h" 22 #include "extensions/common/permissions/permission_message_provider.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 // static 79 // static
80 bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) { 80 bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) {
81 if (extension->location() == Manifest::COMPONENT) 81 if (extension->location() == Manifest::COMPONENT)
82 return true; 82 return true;
83 83
84 const ExtensionsClient::ScriptingWhitelist& whitelist = 84 const ExtensionsClient::ScriptingWhitelist& whitelist =
85 ExtensionsClient::Get()->GetScriptingWhitelist(); 85 ExtensionsClient::Get()->GetScriptingWhitelist();
86 86
87 return std::find(whitelist.begin(), whitelist.end(), extension->id()) != 87 return base::ContainsValue(whitelist, extension->id());
88 whitelist.end();
89 } 88 }
90 89
91 // static 90 // static
92 bool PermissionsData::ShouldSkipPermissionWarnings( 91 bool PermissionsData::ShouldSkipPermissionWarnings(
93 const std::string& extension_id) { 92 const std::string& extension_id) {
94 // See http://b/4946060 for more details. 93 // See http://b/4946060 for more details.
95 return extension_id == extension_misc::kProdHangoutsExtensionId; 94 return extension_id == extension_misc::kProdHangoutsExtensionId;
96 } 95 }
97 96
98 // static 97 // static
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 manifest_errors::kCannotAccessPageWithUrl, document_url.spec()); 455 manifest_errors::kCannotAccessPageWithUrl, document_url.spec());
457 } else { 456 } else {
458 *error = manifest_errors::kCannotAccessPage; 457 *error = manifest_errors::kCannotAccessPage;
459 } 458 }
460 } 459 }
461 460
462 return ACCESS_DENIED; 461 return ACCESS_DENIED;
463 } 462 }
464 463
465 } // namespace extensions 464 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_l10n_util.cc ('k') | extensions/common/url_pattern_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698