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

Side by Side Diff: chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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 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_DECLARATIVE_CONTENT_PA GE_URL_CONDITION_TRACKER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_PA GE_URL_CONDITION_TRACKER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_PA GE_URL_CONDITION_TRACKER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_PA GE_URL_CONDITION_TRACKER_H_
7 7
8 #include <memory>
8 #include <set> 9 #include <set>
9 #include <string> 10 #include <string>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/browser/extensions/api/declarative_content/content_predicate_ev aluator.h" 15 #include "chrome/browser/extensions/api/declarative_content/content_predicate_ev aluator.h"
16 #include "components/url_matcher/url_matcher.h" 16 #include "components/url_matcher/url_matcher.h"
17 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
18 18
19 namespace base { 19 namespace base {
20 class Value; 20 class Value;
21 } 21 }
22 22
23 namespace content { 23 namespace content {
24 struct FrameNavigateParams; 24 struct FrameNavigateParams;
25 struct LoadCommittedDetails; 25 struct LoadCommittedDetails;
26 class WebContents; 26 class WebContents;
27 } 27 }
28 28
29 namespace extensions { 29 namespace extensions {
30 30
31 class Extension; 31 class Extension;
32 32
33 // Tests the URL of a page against conditions specified with the 33 // Tests the URL of a page against conditions specified with the
34 // URLMatcherConditionSet. 34 // URLMatcherConditionSet.
35 class DeclarativeContentPageUrlPredicate : public ContentPredicate { 35 class DeclarativeContentPageUrlPredicate : public ContentPredicate {
36 public: 36 public:
37 ~DeclarativeContentPageUrlPredicate() override; 37 ~DeclarativeContentPageUrlPredicate() override;
38 38
39 url_matcher::URLMatcherConditionSet* url_matcher_condition_set() const { 39 url_matcher::URLMatcherConditionSet* url_matcher_condition_set() const {
40 return url_matcher_condition_set_.get(); 40 return url_matcher_condition_set_.get();
41 } 41 }
42 42
43 static scoped_ptr<DeclarativeContentPageUrlPredicate> Create( 43 static std::unique_ptr<DeclarativeContentPageUrlPredicate> Create(
44 ContentPredicateEvaluator* evaluator, 44 ContentPredicateEvaluator* evaluator,
45 url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory, 45 url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
46 const base::Value& value, 46 const base::Value& value,
47 std::string* error); 47 std::string* error);
48 48
49 // ContentPredicate: 49 // ContentPredicate:
50 ContentPredicateEvaluator* GetEvaluator() const override; 50 ContentPredicateEvaluator* GetEvaluator() const override;
51 51
52 private: 52 private:
53 DeclarativeContentPageUrlPredicate( 53 DeclarativeContentPageUrlPredicate(
(...skipping 12 matching lines...) Expand all
66 // Supports tracking of URL matches across tab contents in a browser context, 66 // Supports tracking of URL matches across tab contents in a browser context,
67 // and querying for the matching condition sets. 67 // and querying for the matching condition sets.
68 class DeclarativeContentPageUrlConditionTracker 68 class DeclarativeContentPageUrlConditionTracker
69 : public ContentPredicateEvaluator { 69 : public ContentPredicateEvaluator {
70 public: 70 public:
71 explicit DeclarativeContentPageUrlConditionTracker(Delegate* delegate); 71 explicit DeclarativeContentPageUrlConditionTracker(Delegate* delegate);
72 ~DeclarativeContentPageUrlConditionTracker() override; 72 ~DeclarativeContentPageUrlConditionTracker() override;
73 73
74 // ContentPredicateEvaluator: 74 // ContentPredicateEvaluator:
75 std::string GetPredicateApiAttributeName() const override; 75 std::string GetPredicateApiAttributeName() const override;
76 scoped_ptr<const ContentPredicate> CreatePredicate( 76 std::unique_ptr<const ContentPredicate> CreatePredicate(
77 const Extension* extension, 77 const Extension* extension,
78 const base::Value& value, 78 const base::Value& value,
79 std::string* error) override; 79 std::string* error) override;
80 void TrackPredicates( 80 void TrackPredicates(
81 const std::map<const void*, std::vector<const ContentPredicate*>>& 81 const std::map<const void*, std::vector<const ContentPredicate*>>&
82 predicates) override; 82 predicates) override;
83 void StopTrackingPredicates( 83 void StopTrackingPredicates(
84 const std::vector<const void*>& predicate_groups) override; 84 const std::vector<const void*>& predicate_groups) override;
85 void TrackForWebContents(content::WebContents* contents) override; 85 void TrackForWebContents(content::WebContents* contents) override;
86 void OnWebContentsNavigation( 86 void OnWebContentsNavigation(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Maps WebContents to the tracker for that WebContents state. 145 // Maps WebContents to the tracker for that WebContents state.
146 std::map<content::WebContents*, 146 std::map<content::WebContents*,
147 linked_ptr<PerWebContentsTracker>> per_web_contents_tracker_; 147 linked_ptr<PerWebContentsTracker>> per_web_contents_tracker_;
148 148
149 DISALLOW_COPY_AND_ASSIGN(DeclarativeContentPageUrlConditionTracker); 149 DISALLOW_COPY_AND_ASSIGN(DeclarativeContentPageUrlConditionTracker);
150 }; 150 };
151 151
152 } // namespace extensions 152 } // namespace extensions
153 153
154 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT _PAGE_URL_CONDITION_TRACKER_H_ 154 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT _PAGE_URL_CONDITION_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698