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

Side by Side Diff: chrome/common/extensions/extension_permission_set.cc

Issue 9653022: Revert 125811 - Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension_permission_set.h ('k') | chrome/common/extensions/feature.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/extensions/extension_permission_set.h" 5 #include "chrome/common/extensions/extension_permission_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 24 matching lines...) Expand all
35 if (a == "net") 35 if (a == "net")
36 return b != "com"; 36 return b != "com";
37 if (a == "org") 37 if (a == "org")
38 return b != "com" && b != "net"; 38 return b != "com" && b != "net";
39 return false; 39 return false;
40 } 40 }
41 41
42 // Names of API modules that can be used without listing it in the 42 // Names of API modules that can be used without listing it in the
43 // permissions section of the manifest. 43 // permissions section of the manifest.
44 const char* kNonPermissionModuleNames[] = { 44 const char* kNonPermissionModuleNames[] = {
45 "app",
46 "browserAction", 45 "browserAction",
47 "devtools", 46 "devtools",
48 "extension", 47 "extension",
49 "i18n", 48 "i18n",
50 "omnibox", 49 "omnibox",
51 "pageAction", 50 "pageAction",
52 "pageActions", 51 "pageActions",
53 "permissions", 52 "permissions",
54 "test", 53 "test",
55 "types" 54 "types"
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 std::set<std::string> apis_str; 609 std::set<std::string> apis_str;
611 for (ExtensionAPIPermissionSet::const_iterator i = apis_.begin(); 610 for (ExtensionAPIPermissionSet::const_iterator i = apis_.begin();
612 i != apis_.end(); ++i) { 611 i != apis_.end(); ++i) {
613 ExtensionAPIPermission* permission = info->GetByID(*i); 612 ExtensionAPIPermission* permission = info->GetByID(*i);
614 if (permission) 613 if (permission)
615 apis_str.insert(permission->name()); 614 apis_str.insert(permission->name());
616 } 615 }
617 return apis_str; 616 return apis_str;
618 } 617 }
619 618
620 std::set<std::string> ExtensionPermissionSet::
621 GetAPIsWithAnyAccessAsStrings() const {
622 std::set<std::string> result = GetAPIsAsStrings();
623 for (size_t i = 0; i < kNumNonPermissionModuleNames; ++i)
624 result.insert(kNonPermissionModuleNames[i]);
625 for (size_t i = 0; i < kNumNonPermissionFunctionNames; ++i)
626 result.insert(GetPermissionName(kNonPermissionFunctionNames[i]));
627 return result;
628 }
629
630 bool ExtensionPermissionSet::HasAnyAccessToAPI( 619 bool ExtensionPermissionSet::HasAnyAccessToAPI(
631 const std::string& api_name) const { 620 const std::string& api_name) const {
632 if (HasAccessToFunction(api_name)) 621 if (HasAccessToFunction(api_name))
633 return true; 622 return true;
634 623
635 for (size_t i = 0; i < kNumNonPermissionFunctionNames; ++i) { 624 for (size_t i = 0; i < kNumNonPermissionFunctionNames; ++i) {
636 if (api_name == GetPermissionName(kNonPermissionFunctionNames[i])) 625 if (api_name == GetPermissionName(kNonPermissionFunctionNames[i]))
637 return true; 626 return true;
638 } 627 }
639 628
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); 925 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false));
937 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); 926 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false));
938 std::set<std::string> new_hosts_only; 927 std::set<std::string> new_hosts_only;
939 928
940 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 929 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
941 old_hosts_set.begin(), old_hosts_set.end(), 930 old_hosts_set.begin(), old_hosts_set.end(),
942 std::inserter(new_hosts_only, new_hosts_only.begin())); 931 std::inserter(new_hosts_only, new_hosts_only.begin()));
943 932
944 return !new_hosts_only.empty(); 933 return !new_hosts_only.empty();
945 } 934 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_permission_set.h ('k') | chrome/common/extensions/feature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698