| OLD | NEW |
| 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_content/chrome_content_rules
_registry.h" | 5 #include "chrome/browser/extensions/api/declarative_content/chrome_content_rules
_registry.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/api/declarative_content/content_action.h" | 10 #include "chrome/browser/extensions/api/declarative_content/content_action.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Creates a DeclarativeContentRule for |extension| given a json definition. | 75 // Creates a DeclarativeContentRule for |extension| given a json definition. |
| 76 // The format of each condition and action's json is up to the specific | 76 // The format of each condition and action's json is up to the specific |
| 77 // ContentCondition and ContentAction. |extension| may be NULL in tests. | 77 // ContentCondition and ContentAction. |extension| may be NULL in tests. |
| 78 // | 78 // |
| 79 // If |error| is empty, the translation was successful and the returned rule is | 79 // If |error| is empty, the translation was successful and the returned rule is |
| 80 // internally consistent. | 80 // internally consistent. |
| 81 scoped_ptr<DeclarativeContentRule> CreateRule( | 81 scoped_ptr<DeclarativeContentRule> CreateRule( |
| 82 url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory, | 82 url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory, |
| 83 content::BrowserContext* browser_context, | 83 content::BrowserContext* browser_context, |
| 84 const Extension* extension, | 84 const Extension* extension, |
| 85 const core_api::events::Rule& api_rule, | 85 const api::events::Rule& api_rule, |
| 86 std::string* error) { | 86 std::string* error) { |
| 87 scoped_ptr<DeclarativeContentRule> rule(new DeclarativeContentRule); | 87 scoped_ptr<DeclarativeContentRule> rule(new DeclarativeContentRule); |
| 88 | 88 |
| 89 rule->extension = extension; | 89 rule->extension = extension; |
| 90 | 90 |
| 91 CreateConditions(extension, url_matcher_condition_factory, | 91 CreateConditions(extension, url_matcher_condition_factory, |
| 92 api_rule.conditions, &rule->conditions, error); | 92 api_rule.conditions, &rule->conditions, error); |
| 93 if (!error->empty()) | 93 if (!error->empty()) |
| 94 return scoped_ptr<DeclarativeContentRule>(); | 94 return scoped_ptr<DeclarativeContentRule>(); |
| 95 | 95 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 size_t count = 0; | 500 size_t count = 0; |
| 501 for (auto web_contents_rules_pair : active_rules_) | 501 for (auto web_contents_rules_pair : active_rules_) |
| 502 count += web_contents_rules_pair.second.size(); | 502 count += web_contents_rules_pair.second.size(); |
| 503 return count; | 503 return count; |
| 504 } | 504 } |
| 505 | 505 |
| 506 ChromeContentRulesRegistry::~ChromeContentRulesRegistry() { | 506 ChromeContentRulesRegistry::~ChromeContentRulesRegistry() { |
| 507 } | 507 } |
| 508 | 508 |
| 509 } // namespace extensions | 509 } // namespace extensions |
| OLD | NEW |