OLD | NEW |
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 27 matching lines...) Expand all Loading... |
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", | 45 "app", |
46 "browserAction", | 46 "browserAction", |
47 "devtools", | 47 "devtools", |
48 "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" |
56 }; | 55 }; |
57 const size_t kNumNonPermissionModuleNames = | 56 const size_t kNumNonPermissionModuleNames = |
58 arraysize(kNonPermissionModuleNames); | 57 arraysize(kNonPermissionModuleNames); |
59 | 58 |
60 // Names of functions (within modules requiring permissions) that can be used | 59 // Names of functions (within modules requiring permissions) that can be used |
61 // without asking for the module permission. In other words, functions you can | 60 // without asking for the module permission. In other words, functions you can |
62 // use with no permissions specified. | 61 // use with no permissions specified. |
63 const char* kNonPermissionFunctionNames[] = { | 62 const char* kNonPermissionFunctionNames[] = { |
64 "management.getPermissionWarningsByManifest", | 63 "management.getPermissionWarningsByManifest", |
65 "tabs.create", | |
66 "tabs.onRemoved", | |
67 "tabs.remove", | |
68 "tabs.update", | |
69 }; | 64 }; |
70 const size_t kNumNonPermissionFunctionNames = | 65 const size_t kNumNonPermissionFunctionNames = |
71 arraysize(kNonPermissionFunctionNames); | 66 arraysize(kNonPermissionFunctionNames); |
72 | 67 |
73 const char kOldUnlimitedStoragePermission[] = "unlimited_storage"; | 68 const char kOldUnlimitedStoragePermission[] = "unlimited_storage"; |
74 const char kWindowsPermission[] = "windows"; | 69 const char kWindowsPermission[] = "windows"; |
75 const char kTemporaryBackgroundAlias[] = "background_alias_do_not_use"; | 70 const char kTemporaryBackgroundAlias[] = "background_alias_do_not_use"; |
76 | 71 |
77 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) { | 72 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) { |
78 DCHECK(out); | 73 DCHECK(out); |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); | 878 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); |
884 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); | 879 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); |
885 std::set<std::string> new_hosts_only; | 880 std::set<std::string> new_hosts_only; |
886 | 881 |
887 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 882 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
888 old_hosts_set.begin(), old_hosts_set.end(), | 883 old_hosts_set.begin(), old_hosts_set.end(), |
889 std::inserter(new_hosts_only, new_hosts_only.begin())); | 884 std::inserter(new_hosts_only, new_hosts_only.begin())); |
890 | 885 |
891 return !new_hosts_only.empty(); | 886 return !new_hosts_only.empty(); |
892 } | 887 } |
OLD | NEW |