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 "googleurl/src/gurl.h" | 9 #include "googleurl/src/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 SetURL(const GURL& url); | 29 void SetURL(const GURL& url); |
| 30 void SetInstanceID(int instance_id); | |
| 30 | 31 |
| 31 bool has_url() const { return has_url_; } | 32 bool has_url() const { return has_url_; } |
| 32 const GURL& url() const { return url_; } | 33 const GURL& url() const { return url_; } |
| 33 | 34 |
| 35 bool has_instance_id() const { return has_instance_id_; } | |
| 36 int instance_id() const { return instance_id_; } | |
| 37 | |
| 34 std::string AsJSONString() const; | 38 std::string AsJSONString() const; |
|
Matt Perry
2013/06/18 23:29:02
This is unused. Can you remove it while you're in
Fady Samuel
2013/06/19 01:15:16
Done.
| |
| 35 scoped_ptr<base::Value> AsValue() const; | 39 scoped_ptr<base::Value> AsValue() const; |
| 36 bool IsEmpty() const; | 40 bool IsEmpty() const; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 bool has_url_; | 43 bool has_url_; |
| 40 GURL url_; | 44 GURL url_; |
| 41 | 45 |
| 46 bool has_instance_id_; | |
| 47 int instance_id_; | |
| 48 | |
| 42 // Allow implicit copy and assignment. | 49 // Allow implicit copy and assignment. |
| 43 }; | 50 }; |
| 44 | 51 |
| 45 } // namespace extensions | 52 } // namespace extensions |
| 46 | 53 |
| 47 #endif // EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ | 54 #endif // EXTENSIONS_COMMON_EVENT_FILTERING_INFO_H_ |
| OLD | NEW |