| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_EVAL
UATOR_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_EVAL
UATOR_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_EVAL
UATOR_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_EVAL
UATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/extensions/api/declarative_content/content_predicate.h" | 12 #include "chrome/browser/extensions/api/declarative_content/content_predicate.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class BrowserContext; | 15 class BrowserContext; |
| 16 struct FrameNavigateParams; | 16 class NavigationHandle; |
| 17 struct LoadCommittedDetails; | |
| 18 class WebContents; | 17 class WebContents; |
| 19 } // namespace content | 18 } // namespace content |
| 20 | 19 |
| 21 namespace extensions { | 20 namespace extensions { |
| 22 | 21 |
| 23 // Creates and manages instances of an associated ContentPredicate subclass and | 22 // Creates and manages instances of an associated ContentPredicate subclass and |
| 24 // tracks the url and browser context state required to evaluate the predicates. | 23 // tracks the url and browser context state required to evaluate the predicates. |
| 25 // | 24 // |
| 26 // A ContentPredicateEvaluator corresponds to a single attribute name across all | 25 // A ContentPredicateEvaluator corresponds to a single attribute name across all |
| 27 // chrome.declarativeContent.PageStateMatchers provided in all rules in the | 26 // chrome.declarativeContent.PageStateMatchers provided in all rules in the |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 84 |
| 86 // Handles navigation of |contents|. We depend on the caller to notify us of | 85 // Handles navigation of |contents|. We depend on the caller to notify us of |
| 87 // this event rather than having each evaluator listen to it, so that the | 86 // this event rather than having each evaluator listen to it, so that the |
| 88 // caller can coordinate evaluation with all the evaluators that respond to | 87 // caller can coordinate evaluation with all the evaluators that respond to |
| 89 // it. If an evaluator listened and requested rule evaluation before another | 88 // it. If an evaluator listened and requested rule evaluation before another |
| 90 // evaluator received the notification, the first evaluator's predicates would | 89 // evaluator received the notification, the first evaluator's predicates would |
| 91 // be evaluated based on the new URL while the other evaluator's conditions | 90 // be evaluated based on the new URL while the other evaluator's conditions |
| 92 // would still be evaluated based on the previous URL. | 91 // would still be evaluated based on the previous URL. |
| 93 virtual void OnWebContentsNavigation( | 92 virtual void OnWebContentsNavigation( |
| 94 content::WebContents* contents, | 93 content::WebContents* contents, |
| 95 const content::LoadCommittedDetails& details, | 94 content::NavigationHandle* navigation_handle) = 0; |
| 96 const content::FrameNavigateParams& params) = 0; | |
| 97 | 95 |
| 98 // Returns true if |predicate| evaluates to true on the state associated with | 96 // Returns true if |predicate| evaluates to true on the state associated with |
| 99 // |tab|. It must be the case that predicate->GetEvaluator() == this object, | 97 // |tab|. It must be the case that predicate->GetEvaluator() == this object, |
| 100 // |predicate| was previously passed to TrackPredicates(), and | 98 // |predicate| was previously passed to TrackPredicates(), and |
| 101 // StopTrackingPredicates has not yet been called with the group containing | 99 // StopTrackingPredicates has not yet been called with the group containing |
| 102 // |predicate|. | 100 // |predicate|. |
| 103 virtual bool EvaluatePredicate(const ContentPredicate* predicate, | 101 virtual bool EvaluatePredicate(const ContentPredicate* predicate, |
| 104 content::WebContents* tab) const = 0; | 102 content::WebContents* tab) const = 0; |
| 105 | 103 |
| 106 protected: | 104 protected: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 130 Delegate(); | 128 Delegate(); |
| 131 virtual ~Delegate(); | 129 virtual ~Delegate(); |
| 132 | 130 |
| 133 private: | 131 private: |
| 134 DISALLOW_COPY_AND_ASSIGN(Delegate); | 132 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 135 }; | 133 }; |
| 136 | 134 |
| 137 } // namespace extensions | 135 } // namespace extensions |
| 138 | 136 |
| 139 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_E
VALUATOR_H_ | 137 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_E
VALUATOR_H_ |
| OLD | NEW |