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 #include "chrome/renderer/extensions/event_bindings.h" | 5 #include "chrome/renderer/extensions/event_bindings.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // A map of extension IDs to filtered listener counts for that extension. | 64 // A map of extension IDs to filtered listener counts for that extension. |
65 base::LazyInstance<std::map<std::string, FilteredEventListenerCounts> > | 65 base::LazyInstance<std::map<std::string, FilteredEventListenerCounts> > |
66 g_filtered_listener_counts = LAZY_INSTANCE_INITIALIZER; | 66 g_filtered_listener_counts = LAZY_INSTANCE_INITIALIZER; |
67 | 67 |
68 base::LazyInstance<EventFilter> g_event_filter = LAZY_INSTANCE_INITIALIZER; | 68 base::LazyInstance<EventFilter> g_event_filter = LAZY_INSTANCE_INITIALIZER; |
69 | 69 |
70 // TODO(koz): Merge this into EventBindings. | 70 // TODO(koz): Merge this into EventBindings. |
71 class ExtensionImpl : public ChromeV8Extension { | 71 class ExtensionImpl : public ChromeV8Extension { |
72 public: | 72 public: |
73 explicit ExtensionImpl(Dispatcher* dispatcher, | 73 explicit ExtensionImpl(Dispatcher* dispatcher, ChromeV8Context* context) |
74 v8::Handle<v8::Context> v8_context) | 74 : ChromeV8Extension(dispatcher, context) { |
75 : ChromeV8Extension(dispatcher, v8_context) { | |
76 RouteFunction("AttachEvent", | 75 RouteFunction("AttachEvent", |
77 base::Bind(&ExtensionImpl::AttachEvent, base::Unretained(this))); | 76 base::Bind(&ExtensionImpl::AttachEvent, base::Unretained(this))); |
78 RouteFunction("DetachEvent", | 77 RouteFunction("DetachEvent", |
79 base::Bind(&ExtensionImpl::DetachEvent, base::Unretained(this))); | 78 base::Bind(&ExtensionImpl::DetachEvent, base::Unretained(this))); |
80 RouteFunction("AttachFilteredEvent", | 79 RouteFunction("AttachFilteredEvent", |
81 base::Bind(&ExtensionImpl::AttachFilteredEvent, | 80 base::Bind(&ExtensionImpl::AttachFilteredEvent, |
82 base::Unretained(this))); | 81 base::Unretained(this))); |
83 RouteFunction("DetachFilteredEvent", | 82 RouteFunction("DetachFilteredEvent", |
84 base::Bind(&ExtensionImpl::DetachFilteredEvent, | 83 base::Bind(&ExtensionImpl::DetachFilteredEvent, |
85 base::Unretained(this))); | 84 base::Unretained(this))); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 base::DictionaryValue* filter_dict) { | 323 base::DictionaryValue* filter_dict) { |
325 return scoped_ptr<EventMatcher>(new EventMatcher( | 324 return scoped_ptr<EventMatcher>(new EventMatcher( |
326 scoped_ptr<base::DictionaryValue>(filter_dict->DeepCopy()))); | 325 scoped_ptr<base::DictionaryValue>(filter_dict->DeepCopy()))); |
327 } | 326 } |
328 }; | 327 }; |
329 | 328 |
330 } // namespace | 329 } // namespace |
331 | 330 |
332 // static | 331 // static |
333 ChromeV8Extension* EventBindings::Create(Dispatcher* dispatcher, | 332 ChromeV8Extension* EventBindings::Create(Dispatcher* dispatcher, |
334 v8::Handle<v8::Context> context) { | 333 ChromeV8Context* context) { |
335 return new ExtensionImpl(dispatcher, context); | 334 return new ExtensionImpl(dispatcher, context); |
336 } | 335 } |
337 | 336 |
338 } // namespace extensions | 337 } // namespace extensions |
OLD | NEW |