| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 public: | 74 public: |
| 75 explicit ExtensionImpl(Dispatcher* dispatcher) | 75 explicit ExtensionImpl(Dispatcher* dispatcher) |
| 76 : ChromeV8Extension(dispatcher) { | 76 : ChromeV8Extension(dispatcher) { |
| 77 RouteStaticFunction("AttachEvent", &AttachEvent); | 77 RouteStaticFunction("AttachEvent", &AttachEvent); |
| 78 RouteStaticFunction("DetachEvent", &DetachEvent); | 78 RouteStaticFunction("DetachEvent", &DetachEvent); |
| 79 RouteStaticFunction("AttachFilteredEvent", &AttachFilteredEvent); | 79 RouteStaticFunction("AttachFilteredEvent", &AttachFilteredEvent); |
| 80 RouteStaticFunction("DetachFilteredEvent", &DetachFilteredEvent); | 80 RouteStaticFunction("DetachFilteredEvent", &DetachFilteredEvent); |
| 81 RouteStaticFunction("MatchAgainstEventFilter", &MatchAgainstEventFilter); | 81 RouteStaticFunction("MatchAgainstEventFilter", &MatchAgainstEventFilter); |
| 82 } | 82 } |
| 83 | 83 |
| 84 ~ExtensionImpl() {} | 84 virtual ~ExtensionImpl() {} |
| 85 | 85 |
| 86 // Attach an event name to an object. | 86 // Attach an event name to an object. |
| 87 static v8::Handle<v8::Value> AttachEvent(const v8::Arguments& args) { | 87 static v8::Handle<v8::Value> AttachEvent(const v8::Arguments& args) { |
| 88 DCHECK(args.Length() == 1); | 88 DCHECK(args.Length() == 1); |
| 89 // TODO(erikkay) should enforce that event name is a string in the bindings | 89 // TODO(erikkay) should enforce that event name is a string in the bindings |
| 90 DCHECK(args[0]->IsString() || args[0]->IsUndefined()); | 90 DCHECK(args[0]->IsString() || args[0]->IsUndefined()); |
| 91 | 91 |
| 92 if (args[0]->IsString()) { | 92 if (args[0]->IsString()) { |
| 93 ExtensionImpl* self = GetFromArguments<ExtensionImpl>(args); | 93 ExtensionImpl* self = GetFromArguments<ExtensionImpl>(args); |
| 94 std::string event_name = *v8::String::AsciiValue(args[0]->ToString()); | 94 std::string event_name = *v8::String::AsciiValue(args[0]->ToString()); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 } // namespace | 332 } // namespace |
| 333 | 333 |
| 334 // static | 334 // static |
| 335 ChromeV8Extension* EventBindings::Get(Dispatcher* dispatcher) { | 335 ChromeV8Extension* EventBindings::Get(Dispatcher* dispatcher) { |
| 336 return new ExtensionImpl(dispatcher); | 336 return new ExtensionImpl(dispatcher); |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace extensions | 339 } // namespace extensions |
| OLD | NEW |