| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (extension_id.empty()) | 184 if (extension_id.empty()) |
| 185 return v8::Integer::New(-1); | 185 return v8::Integer::New(-1); |
| 186 | 186 |
| 187 scoped_ptr<base::DictionaryValue> filter; | 187 scoped_ptr<base::DictionaryValue> filter; |
| 188 scoped_ptr<content::V8ValueConverter> converter( | 188 scoped_ptr<content::V8ValueConverter> converter( |
| 189 content::V8ValueConverter::create()); | 189 content::V8ValueConverter::create()); |
| 190 | 190 |
| 191 base::DictionaryValue* filter_dict = NULL; | 191 base::DictionaryValue* filter_dict = NULL; |
| 192 base::Value* filter_value = converter->FromV8Value(args[1]->ToObject(), | 192 base::Value* filter_value = converter->FromV8Value(args[1]->ToObject(), |
| 193 v8::Context::GetCurrent()); | 193 v8::Context::GetCurrent()); |
| 194 if (!filter_value) |
| 195 return v8::Integer::New(-1); |
| 194 if (!filter_value->GetAsDictionary(&filter_dict)) { | 196 if (!filter_value->GetAsDictionary(&filter_dict)) { |
| 195 delete filter_value; | 197 delete filter_value; |
| 196 return v8::Integer::New(-1); | 198 return v8::Integer::New(-1); |
| 197 } | 199 } |
| 198 | 200 |
| 199 filter.reset(filter_dict); | 201 filter.reset(filter_dict); |
| 200 extensions::EventFilter& event_filter = g_event_filter.Get(); | 202 extensions::EventFilter& event_filter = g_event_filter.Get(); |
| 201 int id = event_filter.AddEventMatcher(event_name, ParseEventMatcher( | 203 int id = event_filter.AddEventMatcher(event_name, ParseEventMatcher( |
| 202 filter.get())); | 204 filter.get())); |
| 203 | 205 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 }; | 331 }; |
| 330 | 332 |
| 331 } // namespace | 333 } // namespace |
| 332 | 334 |
| 333 // static | 335 // static |
| 334 ChromeV8Extension* EventBindings::Get(Dispatcher* dispatcher) { | 336 ChromeV8Extension* EventBindings::Get(Dispatcher* dispatcher) { |
| 335 return new ExtensionImpl(dispatcher); | 337 return new ExtensionImpl(dispatcher); |
| 336 } | 338 } |
| 337 | 339 |
| 338 } // namespace extensions | 340 } // namespace extensions |
| OLD | NEW |