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

Side by Side Diff: extensions/common/event_matcher.h

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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
« no previous file with comments | « extensions/common/event_filtering_info.cc ('k') | extensions/common/event_matcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef EXTENSIONS_COMMON_EVENT_MATCHER_H_ 5 #ifndef EXTENSIONS_COMMON_EVENT_MATCHER_H_
6 #define EXTENSIONS_COMMON_EVENT_MATCHER_H_ 6 #define EXTENSIONS_COMMON_EVENT_MATCHER_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 12
12 namespace extensions { 13 namespace extensions {
13 14
14 class EventFilteringInfo; 15 class EventFilteringInfo;
15 16
16 extern const char kEventFilterServiceTypeKey[]; 17 extern const char kEventFilterServiceTypeKey[];
17 18
18 // Matches EventFilteringInfos against a set of criteria. This is intended to 19 // Matches EventFilteringInfos against a set of criteria. This is intended to
19 // be used by EventFilter which performs efficient URL matching across 20 // be used by EventFilter which performs efficient URL matching across
20 // potentially many EventMatchers itself. This is why this class only exposes 21 // potentially many EventMatchers itself. This is why this class only exposes
21 // MatchNonURLCriteria() - URL matching is handled by EventFilter. 22 // MatchNonURLCriteria() - URL matching is handled by EventFilter.
22 class EventMatcher { 23 class EventMatcher {
23 public: 24 public:
24 EventMatcher(scoped_ptr<base::DictionaryValue> filter, 25 EventMatcher(std::unique_ptr<base::DictionaryValue> filter, int routing_id);
25 int routing_id);
26 ~EventMatcher(); 26 ~EventMatcher();
27 27
28 // Returns true if |event_info| satisfies this matcher's criteria, not taking 28 // Returns true if |event_info| satisfies this matcher's criteria, not taking
29 // into consideration any URL criteria. 29 // into consideration any URL criteria.
30 bool MatchNonURLCriteria(const EventFilteringInfo& event_info) const; 30 bool MatchNonURLCriteria(const EventFilteringInfo& event_info) const;
31 31
32 int GetURLFilterCount() const; 32 int GetURLFilterCount() const;
33 bool GetURLFilter(int i, base::DictionaryValue** url_filter_out); 33 bool GetURLFilter(int i, base::DictionaryValue** url_filter_out);
34 34
35 int GetWindowTypeCount() const; 35 int GetWindowTypeCount() const;
(...skipping 12 matching lines...) Expand all
48 base::DictionaryValue* value() const { 48 base::DictionaryValue* value() const {
49 return filter_.get(); 49 return filter_.get();
50 } 50 }
51 51
52 private: 52 private:
53 // Contains a dictionary that corresponds to a single event filter, eg: 53 // Contains a dictionary that corresponds to a single event filter, eg:
54 // 54 //
55 // {url: [{hostSuffix: 'google.com'}]} 55 // {url: [{hostSuffix: 'google.com'}]}
56 // 56 //
57 // The valid filter keys are event-specific. 57 // The valid filter keys are event-specific.
58 scoped_ptr<base::DictionaryValue> filter_; 58 std::unique_ptr<base::DictionaryValue> filter_;
59 59
60 int routing_id_; 60 int routing_id_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(EventMatcher); 62 DISALLOW_COPY_AND_ASSIGN(EventMatcher);
63 }; 63 };
64 64
65 } // namespace extensions 65 } // namespace extensions
66 66
67 #endif // EXTENSIONS_COMMON_EVENT_MATCHER_H_ 67 #endif // EXTENSIONS_COMMON_EVENT_MATCHER_H_
OLDNEW
« no previous file with comments | « extensions/common/event_filtering_info.cc ('k') | extensions/common/event_matcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698