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

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

Issue 10388135: Add common code for extensions event filtering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self review Created 8 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_EXTENSIONS_EVENT_MATCHER_H_
6 #define CHROME_COMMON_EXTENSIONS_EVENT_MATCHER_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
battre 2012/05/15 13:12:32 not necessary
koz (OOO until 15th September) 2012/05/16 00:14:00 Done.
10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h"
12 #include "chrome/common/extensions/event_filtering_info.h"
battre 2012/05/15 13:12:32 forward declaration?
koz (OOO until 15th September) 2012/05/16 00:14:00 Done.
13
14 namespace extensions {
15
16 // Matches EventFilteringInfos against a set of criteria. This is intended to
17 // be used by EventRouter which performs efficient URL matching across
18 // potentially many EventMatchers itself. This is why this class only exposes
19 // MatchNonURLCriteria() - URL matching is handled by EventRouter.
20 class EventMatcher {
21 public:
22 EventMatcher();
23 virtual ~EventMatcher();
battre 2012/05/15 13:12:32 why virtual?
koz (OOO until 15th September) 2012/05/16 00:14:00 Ah, cheers. Done. Originally I had implemented thi
24
25 // Returns true if |event_info| satisfies this matcher's criteria, not taking
26 // into consideration any URL criteria.
27 bool MatchNonURLCriteria(const EventFilteringInfo& event_info) const;
28
29 void set_url_filters(scoped_ptr<base::ListValue> url_filters) {
30 url_filters_ = url_filters.Pass();
31 }
32
33 // Returns NULL if no url_filters have been specified.
34 base::ListValue* url_filters() const {
35 return url_filters_.get();
36 }
37
38 private:
39 scoped_ptr<base::ListValue> url_filters_;
battre 2012/05/15 13:12:32 DISALLOW_COPY_AND_ASSIGN
koz (OOO until 15th September) 2012/05/16 00:14:00 Done.
40 };
41
42 } // namespace extensions
43
44 #endif // CHROME_COMMON_EXTENSIONS_EVENT_MATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698