OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/renderer/event_bindings.h" | 5 #include "extensions/renderer/event_bindings.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (object->Has(instance_id)) { | 90 if (object->Has(instance_id)) { |
91 v8::Local<v8::Value> instance_id_value(object->Get(instance_id)); | 91 v8::Local<v8::Value> instance_id_value(object->Get(instance_id)); |
92 info.SetInstanceID(instance_id_value->IntegerValue()); | 92 info.SetInstanceID(instance_id_value->IntegerValue()); |
93 } | 93 } |
94 v8::Local<v8::String> service_type( | 94 v8::Local<v8::String> service_type( |
95 v8::String::NewFromUtf8(isolate, "serviceType")); | 95 v8::String::NewFromUtf8(isolate, "serviceType")); |
96 if (object->Has(service_type)) { | 96 if (object->Has(service_type)) { |
97 v8::Local<v8::Value> service_type_value(object->Get(service_type)); | 97 v8::Local<v8::Value> service_type_value(object->Get(service_type)); |
98 info.SetServiceType(*v8::String::Utf8Value(service_type_value)); | 98 info.SetServiceType(*v8::String::Utf8Value(service_type_value)); |
99 } | 99 } |
| 100 v8::Local<v8::String> window_types( |
| 101 v8::String::NewFromUtf8(isolate, "windowType")); |
| 102 if (object->Has(window_types)) { |
| 103 v8::Local<v8::Value> window_types_value(object->Get(window_types)); |
| 104 info.SetWindowType(*v8::String::Utf8Value(window_types_value)); |
| 105 } |
100 return info; | 106 return info; |
101 } | 107 } |
102 | 108 |
103 // Add a filter to |event_name| in |extension_id|, returning true if it | 109 // Add a filter to |event_name| in |extension_id|, returning true if it |
104 // was the first filter for that event in that extension. | 110 // was the first filter for that event in that extension. |
105 bool AddFilter(const std::string& event_name, | 111 bool AddFilter(const std::string& event_name, |
106 const std::string& extension_id, | 112 const std::string& extension_id, |
107 const base::DictionaryValue& filter) { | 113 const base::DictionaryValue& filter) { |
108 FilteredEventListenerKey key(extension_id, event_name); | 114 FilteredEventListenerKey key(extension_id, event_name); |
109 FilteredEventListenerCounts& all_counts = g_filtered_listener_counts.Get(); | 115 FilteredEventListenerCounts& all_counts = g_filtered_listener_counts.Get(); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // Same for filtered events. | 347 // Same for filtered events. |
342 std::set<int> attached_matcher_ids_safe = attached_matcher_ids_; | 348 std::set<int> attached_matcher_ids_safe = attached_matcher_ids_; |
343 for (int matcher_id : attached_matcher_ids_safe) { | 349 for (int matcher_id : attached_matcher_ids_safe) { |
344 DetachFilteredEvent(matcher_id, false /* is_manual */); | 350 DetachFilteredEvent(matcher_id, false /* is_manual */); |
345 } | 351 } |
346 DCHECK(attached_matcher_ids_.empty()) | 352 DCHECK(attached_matcher_ids_.empty()) |
347 << "Filtered events cannot be attached during invalidation"; | 353 << "Filtered events cannot be attached during invalidation"; |
348 } | 354 } |
349 | 355 |
350 } // namespace extensions | 356 } // namespace extensions |
OLD | NEW |