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

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: . 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 29 matching lines...) Expand all
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 std::set<std::string> new_hosts_only; 585 std::set<std::string> new_hosts_only;
589 586
590 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 587 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
591 old_hosts_set.begin(), old_hosts_set.end(), 588 old_hosts_set.begin(), old_hosts_set.end(),
592 std::inserter(new_hosts_only, new_hosts_only.begin())); 589 std::inserter(new_hosts_only, new_hosts_only.begin()));
593 590
594 return !new_hosts_only.empty(); 591 return !new_hosts_only.empty();
595 } 592 }
596 593
597 } // namespace extensions 594 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698