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

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc

Issue 315573003: Remove PermissionsData::ForExtension() completely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/browser/extensions/api/declarative_webrequest/webrequest_rules_ registry.h" 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_ registry.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 std::string* error) { 337 std::string* error) {
338 return (StageChecker(conditions, actions, error) && 338 return (StageChecker(conditions, actions, error) &&
339 HostPermissionsChecker(extension, actions, error)); 339 HostPermissionsChecker(extension, actions, error));
340 } 340 }
341 341
342 // static 342 // static
343 bool WebRequestRulesRegistry::HostPermissionsChecker( 343 bool WebRequestRulesRegistry::HostPermissionsChecker(
344 const Extension* extension, 344 const Extension* extension,
345 const WebRequestActionSet* actions, 345 const WebRequestActionSet* actions,
346 std::string* error) { 346 std::string* error) {
347 if (PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts()) 347 if (extension->permissions_data()->HasEffectiveAccessToAllHosts())
348 return true; 348 return true;
349 349
350 // Without the permission for all URLs, actions with the STRATEGY_DEFAULT 350 // Without the permission for all URLs, actions with the STRATEGY_DEFAULT
351 // should not be registered, they would never be able to execute. 351 // should not be registered, they would never be able to execute.
352 for (WebRequestActionSet::Actions::const_iterator action_iter = 352 for (WebRequestActionSet::Actions::const_iterator action_iter =
353 actions->actions().begin(); 353 actions->actions().begin();
354 action_iter != actions->actions().end(); 354 action_iter != actions->actions().end();
355 ++action_iter) { 355 ++action_iter) {
356 if ((*action_iter)->host_permissions_strategy() == 356 if ((*action_iter)->host_permissions_strategy() ==
357 WebRequestAction::STRATEGY_DEFAULT) { 357 WebRequestAction::STRATEGY_DEFAULT) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match); 404 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match);
405 CHECK(rule_trigger != rule_triggers_.end()); 405 CHECK(rule_trigger != rule_triggers_.end());
406 if (!ContainsKey(*result, rule_trigger->second) && 406 if (!ContainsKey(*result, rule_trigger->second) &&
407 rule_trigger->second->conditions().IsFulfilled(*url_match, 407 rule_trigger->second->conditions().IsFulfilled(*url_match,
408 request_data)) 408 request_data))
409 result->insert(rule_trigger->second); 409 result->insert(rule_trigger->second);
410 } 410 }
411 } 411 }
412 412
413 } // namespace extensions 413 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698