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