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

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

Issue 377553003: Create a ManifestPermission implementation for Automation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Revert changes to automation_apitest.cc Created 6 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/permissions/permission_set.h" 5 #include "extensions/common/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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // We only need to check our host list to verify access. The host list should 207 // We only need to check our host list to verify access. The host list should
208 // already reflect any special rules (such as chrome://favicon, all hosts 208 // already reflect any special rules (such as chrome://favicon, all hosts
209 // access, etc.). 209 // access, etc.).
210 return scriptable_hosts().MatchesURL(origin); 210 return scriptable_hosts().MatchesURL(origin);
211 } 211 }
212 212
213 bool PermissionSet::HasEffectiveAccessToAllHosts() const { 213 bool PermissionSet::HasEffectiveAccessToAllHosts() const {
214 // There are two ways this set can have effective access to all hosts: 214 // There are two ways this set can have effective access to all hosts:
215 // 1) it has an <all_urls> URL pattern. 215 // 1) it has an <all_urls> URL pattern.
216 // 2) it has a named permission with implied full URL access. 216 // 2) it has a named permission with implied full URL access.
217 for (URLPatternSet::const_iterator host = effective_hosts().begin(); 217 if (effective_hosts().MatchesAllURLs())
218 host != effective_hosts().end(); ++host) { 218 return true;
219 if (host->match_all_urls() ||
220 (host->match_subdomains() && host->host().empty()))
221 return true;
222 }
223 219
224 for (APIPermissionSet::const_iterator i = apis().begin(); 220 for (APIPermissionSet::const_iterator i = apis().begin();
225 i != apis().end(); ++i) { 221 i != apis().end(); ++i) {
226 if (i->info()->implies_full_url_access()) 222 if (i->info()->implies_full_url_access())
227 return true; 223 return true;
228 } 224 }
229 return false; 225 return false;
230 } 226 }
231 227
232 bool PermissionSet::ShouldWarnAllHosts() const { 228 bool PermissionSet::ShouldWarnAllHosts() const {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (iter->ImpliesAllHosts()) { 275 if (iter->ImpliesAllHosts()) {
280 should_warn_all_hosts_ = WARN_ALL_HOSTS; 276 should_warn_all_hosts_ = WARN_ALL_HOSTS;
281 return; 277 return;
282 } 278 }
283 } 279 }
284 280
285 should_warn_all_hosts_ = DONT_WARN_ALL_HOSTS; 281 should_warn_all_hosts_ = DONT_WARN_ALL_HOSTS;
286 } 282 }
287 283
288 } // namespace extensions 284 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698