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

Side by Side Diff: chrome/common/extensions/permissions/permission_set.cc

Issue 10829186: Tabs API is usable without tabs permission. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed failing browser/api tests Created 8 years, 4 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
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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 "types" 51 "types"
52 }; 52 };
53 const size_t kNumNonPermissionModuleNames = 53 const size_t kNumNonPermissionModuleNames =
54 arraysize(kNonPermissionModuleNames); 54 arraysize(kNonPermissionModuleNames);
55 55
56 // Names of functions (within modules requiring permissions) that can be used 56 // Names of functions (within modules requiring permissions) that can be used
57 // 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
58 // use with no permissions specified. 58 // use with no permissions specified.
59 const char* kNonPermissionFunctionNames[] = { 59 const char* kNonPermissionFunctionNames[] = {
60 "management.getPermissionWarningsByManifest", 60 "management.getPermissionWarningsByManifest",
61 "tabs.captureVisibleTab",
Aaron Boodman 2012/08/10 06:44:51 Are there any functions that require tabs permissi
62 "tabs.connect",
61 "tabs.create", 63 "tabs.create",
64 "tabs.detectLanguage",
65 "tabs.executeScript",
66 "tabs.get",
67 "tabs.getCurrent",
68 "tabs.getSelected",
69 "tabs.highlight",
70 "tabs.insertCSS",
71 "tabs.move",
72 "tabs.onActivated",
73 "tabs.onActiveChanged",
74 "tabs.onAttached",
75 "tabs.onCreated",
76 "tabs.onDetached",
77 "tabs.onHighlighted",
78 "tabs.onMoved",
79 "tabs.onSelectionChanged",
80 "tabs.onUpdated",
62 "tabs.onRemoved", 81 "tabs.onRemoved",
82 "tabs.query",
83 "tabs.reload",
63 "tabs.remove", 84 "tabs.remove",
85 "tabs.sendMessage",
64 "tabs.update", 86 "tabs.update",
65 }; 87 };
66 const size_t kNumNonPermissionFunctionNames = 88 const size_t kNumNonPermissionFunctionNames =
67 arraysize(kNonPermissionFunctionNames); 89 arraysize(kNonPermissionFunctionNames);
68 90
69 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) { 91 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) {
70 DCHECK(out); 92 DCHECK(out);
71 for (URLPatternSet::const_iterator i = set.begin(); i != set.end(); ++i) { 93 for (URLPatternSet::const_iterator i = set.begin(); i != set.end(); ++i) {
72 URLPattern p = *i; 94 URLPattern p = *i;
73 p.SetPath("/*"); 95 p.SetPath("/*");
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 std::set<std::string> new_hosts_only; 613 std::set<std::string> new_hosts_only;
592 614
593 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 615 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
594 old_hosts_set.begin(), old_hosts_set.end(), 616 old_hosts_set.begin(), old_hosts_set.end(),
595 std::inserter(new_hosts_only, new_hosts_only.begin())); 617 std::inserter(new_hosts_only, new_hosts_only.begin()));
596 618
597 return !new_hosts_only.empty(); 619 return !new_hosts_only.empty();
598 } 620 }
599 621
600 } // namespace extensions 622 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698