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 #ifndef EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ |
6 #define EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ | 6 #define EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 // | 21 // |
22 // chrome.someApi.onSomeEvent.addListener(cb, | 22 // chrome.someApi.onSomeEvent.addListener(cb, |
23 // {url: [{hostSuffix: 'google.com'}], | 23 // {url: [{hostSuffix: 'google.com'}], |
24 // tabId: 1}); | 24 // tabId: 1}); |
25 class EventFilteringInfo { | 25 class EventFilteringInfo { |
26 public: | 26 public: |
27 EventFilteringInfo(); | 27 EventFilteringInfo(); |
28 ~EventFilteringInfo(); | 28 ~EventFilteringInfo(); |
29 void SetURL(const GURL& url); | 29 void SetURL(const GURL& url); |
30 void SetInstanceID(int instance_id); | 30 void SetInstanceID(int instance_id); |
| 31 void SetServiceType(const std::string& service_type) { |
| 32 service_type_ = service_type; |
| 33 } |
31 | 34 |
32 bool has_url() const { return has_url_; } | 35 bool has_url() const { return has_url_; } |
33 const GURL& url() const { return url_; } | 36 const GURL& url() const { return url_; } |
34 | 37 |
35 bool has_instance_id() const { return has_instance_id_; } | 38 bool has_instance_id() const { return has_instance_id_; } |
36 int instance_id() const { return instance_id_; } | 39 int instance_id() const { return instance_id_; } |
37 | 40 |
| 41 bool has_service_type() const { return !service_type_.empty(); } |
| 42 const std::string& service_type() const { return service_type_; } |
| 43 |
38 scoped_ptr<base::Value> AsValue() const; | 44 scoped_ptr<base::Value> AsValue() const; |
39 bool IsEmpty() const; | 45 bool IsEmpty() const; |
40 | 46 |
41 private: | 47 private: |
42 bool has_url_; | 48 bool has_url_; |
43 GURL url_; | 49 GURL url_; |
| 50 std::string service_type_; |
44 | 51 |
45 bool has_instance_id_; | 52 bool has_instance_id_; |
46 int instance_id_; | 53 int instance_id_; |
47 | 54 |
48 // Allow implicit copy and assignment. | 55 // Allow implicit copy and assignment. |
49 }; | 56 }; |
50 | 57 |
51 } // namespace extensions | 58 } // namespace extensions |
52 | 59 |
53 #endif // EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ | 60 #endif // EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ |
OLD | NEW |