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/permissions/permission_set.h" | 5 #include "chrome/common/extensions/permissions/permission_set.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 "devtools", | 39 "devtools", |
40 "events", | 40 "events", |
41 "extension", | 41 "extension", |
42 "i18n", | 42 "i18n", |
43 "omnibox", | 43 "omnibox", |
44 "pageAction", | 44 "pageAction", |
45 "pageActions", | 45 "pageActions", |
46 "permissions", | 46 "permissions", |
47 "runtime", | 47 "runtime", |
48 "scriptBadge", | 48 "scriptBadge", |
| 49 "tabs", |
49 "test", | 50 "test", |
50 "types" | 51 "types" |
51 }; | 52 }; |
52 const size_t kNumNonPermissionModuleNames = | 53 const size_t kNumNonPermissionModuleNames = |
53 arraysize(kNonPermissionModuleNames); | 54 arraysize(kNonPermissionModuleNames); |
54 | 55 |
55 // Names of functions (within modules requiring permissions) that can be used | 56 // Names of functions (within modules requiring permissions) that can be used |
56 // without asking for the module permission. In other words, functions you can | 57 // without asking for the module permission. In other words, functions you can |
57 // use with no permissions specified. | 58 // use with no permissions specified. |
58 const char* kNonPermissionFunctionNames[] = { | 59 const char* kNonPermissionFunctionNames[] = { |
59 "app.getDetails", | 60 "app.getDetails", |
60 "app.getDetailsForFrame", | 61 "app.getDetailsForFrame", |
61 "app.getIsInstalled", | 62 "app.getIsInstalled", |
62 "app.install", | 63 "app.install", |
63 "app.installState", | 64 "app.installState", |
64 "app.runningState", | 65 "app.runningState", |
65 "management.getPermissionWarningsByManifest", | 66 "management.getPermissionWarningsByManifest", |
66 "tabs.create", | |
67 "tabs.onRemoved", | |
68 "tabs.remove", | |
69 "tabs.update", | |
70 }; | 67 }; |
71 const size_t kNumNonPermissionFunctionNames = | 68 const size_t kNumNonPermissionFunctionNames = |
72 arraysize(kNonPermissionFunctionNames); | 69 arraysize(kNonPermissionFunctionNames); |
73 | 70 |
74 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) { | 71 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) { |
75 DCHECK(out); | 72 DCHECK(out); |
76 for (URLPatternSet::const_iterator i = set.begin(); i != set.end(); ++i) { | 73 for (URLPatternSet::const_iterator i = set.begin(); i != set.end(); ++i) { |
77 URLPattern p = *i; | 74 URLPattern p = *i; |
78 p.SetPath("/*"); | 75 p.SetPath("/*"); |
79 out->AddPattern(p); | 76 out->AddPattern(p); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 std::set<std::string> new_hosts_only; | 590 std::set<std::string> new_hosts_only; |
594 | 591 |
595 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 592 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
596 old_hosts_set.begin(), old_hosts_set.end(), | 593 old_hosts_set.begin(), old_hosts_set.end(), |
597 std::inserter(new_hosts_only, new_hosts_only.begin())); | 594 std::inserter(new_hosts_only, new_hosts_only.begin())); |
598 | 595 |
599 return !new_hosts_only.empty(); | 596 return !new_hosts_only.empty(); |
600 } | 597 } |
601 | 598 |
602 } // namespace extensions | 599 } // namespace extensions |
OLD | NEW |