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

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

Issue 10920070: Remove permission warnings from most tabs and windows APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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 28 matching lines...) Expand all
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",
52 "windows"
51 }; 53 };
52 const size_t kNumNonPermissionModuleNames = 54 const size_t kNumNonPermissionModuleNames =
53 arraysize(kNonPermissionModuleNames); 55 arraysize(kNonPermissionModuleNames);
54 56
55 // Names of functions (within modules requiring permissions) that can be used 57 // Names of functions (within modules requiring permissions) that can be used
56 // 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
57 // use with no permissions specified. 59 // use with no permissions specified.
58 const char* kNonPermissionFunctionNames[] = { 60 const char* kNonPermissionFunctionNames[] = {
59 "app.getDetails", 61 "app.getDetails",
60 "app.getDetailsForFrame", 62 "app.getDetailsForFrame",
61 "app.getIsInstalled", 63 "app.getIsInstalled",
62 "app.install", 64 "app.install",
63 "app.installState", 65 "app.installState",
64 "app.runningState", 66 "app.runningState",
65 "management.getPermissionWarningsByManifest", 67 "management.getPermissionWarningsByManifest",
66 "tabs.create",
67 "tabs.onRemoved",
68 "tabs.remove",
69 "tabs.update",
70 }; 68 };
71 const size_t kNumNonPermissionFunctionNames = 69 const size_t kNumNonPermissionFunctionNames =
72 arraysize(kNonPermissionFunctionNames); 70 arraysize(kNonPermissionFunctionNames);
73 71
74 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) { 72 void AddPatternsAndRemovePaths(const URLPatternSet& set, URLPatternSet* out) {
75 DCHECK(out); 73 DCHECK(out);
76 for (URLPatternSet::const_iterator i = set.begin(); i != set.end(); ++i) { 74 for (URLPatternSet::const_iterator i = set.begin(); i != set.end(); ++i) {
77 URLPattern p = *i; 75 URLPattern p = *i;
78 p.SetPath("/*"); 76 p.SetPath("/*");
79 out->AddPattern(p); 77 out->AddPattern(p);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 std::set<std::string> new_hosts_only; 591 std::set<std::string> new_hosts_only;
594 592
595 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 593 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
596 old_hosts_set.begin(), old_hosts_set.end(), 594 old_hosts_set.begin(), old_hosts_set.end(),
597 std::inserter(new_hosts_only, new_hosts_only.begin())); 595 std::inserter(new_hosts_only, new_hosts_only.begin()));
598 596
599 return !new_hosts_only.empty(); 597 return !new_hosts_only.empty();
600 } 598 }
601 599
602 } // namespace extensions 600 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698