Chromium Code Reviews| 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 |
| 11 namespace base { | 11 namespace base { |
| 12 class Value; | 12 class Value; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 // Extra information about an event that is used in event filtering. | 17 // Extra information about an event that is used in event filtering. |
| 18 // | 18 // |
| 19 // This is the information that is matched against criteria specified in JS | 19 // This is the information that is matched against criteria specified in JS |
| 20 // extension event listeners. Eg: | 20 // extension event listeners. Eg: |
| 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 SetWindowType(const std::string& window_type); | |
| 29 void SetURL(const GURL& url); | 30 void SetURL(const GURL& url); |
| 30 void SetInstanceID(int instance_id); | 31 void SetInstanceID(int instance_id); |
| 31 void SetServiceType(const std::string& service_type) { | 32 void SetServiceType(const std::string& service_type) { |
| 32 service_type_ = service_type; | 33 service_type_ = service_type; |
| 33 } | 34 } |
| 34 | 35 |
| 36 bool has_window_type() const { return has_window_type_; } | |
|
not at google - send to devlin
2015/07/31 21:48:03
Could you add a comment:
Note: window type is a C
llandwerlin-old
2015/08/03 10:11:54
Done.
| |
| 37 const std::string& window_type() const { return window_type_; } | |
| 38 | |
| 35 bool has_url() const { return has_url_; } | 39 bool has_url() const { return has_url_; } |
| 36 const GURL& url() const { return url_; } | 40 const GURL& url() const { return url_; } |
| 37 | 41 |
| 38 bool has_instance_id() const { return has_instance_id_; } | 42 bool has_instance_id() const { return has_instance_id_; } |
| 39 int instance_id() const { return instance_id_; } | 43 int instance_id() const { return instance_id_; } |
| 40 | 44 |
| 41 bool has_service_type() const { return !service_type_.empty(); } | 45 bool has_service_type() const { return !service_type_.empty(); } |
| 42 const std::string& service_type() const { return service_type_; } | 46 const std::string& service_type() const { return service_type_; } |
| 43 | 47 |
| 44 scoped_ptr<base::Value> AsValue() const; | 48 scoped_ptr<base::Value> AsValue() const; |
| 45 bool IsEmpty() const; | 49 bool IsEmpty() const; |
| 46 | 50 |
| 47 private: | 51 private: |
| 48 bool has_url_; | 52 bool has_url_; |
| 49 GURL url_; | 53 GURL url_; |
| 50 std::string service_type_; | 54 std::string service_type_; |
| 51 | 55 |
| 52 bool has_instance_id_; | 56 bool has_instance_id_; |
| 53 int instance_id_; | 57 int instance_id_; |
| 54 | 58 |
| 59 bool has_window_type_; | |
| 60 std::string window_type_; | |
| 61 | |
| 55 // Allow implicit copy and assignment. | 62 // Allow implicit copy and assignment. |
| 56 }; | 63 }; |
| 57 | 64 |
| 58 } // namespace extensions | 65 } // namespace extensions |
| 59 | 66 |
| 60 #endif // EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ | 67 #endif // EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ |
| OLD | NEW |