| 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/send_request_natives.h" | 5 #include "chrome/renderer/extensions/send_request_natives.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "content/public/renderer/v8_value_converter.h" | 8 #include "content/public/renderer/v8_value_converter.h" |
| 9 #include "chrome/renderer/extensions/request_sender.h" | 9 #include "chrome/renderer/extensions/request_sender.h" |
| 10 | 10 |
| 11 using content::V8ValueConverter; | 11 using content::V8ValueConverter; |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 | 14 |
| 15 SendRequestNatives::SendRequestNatives(Dispatcher* dispatcher, | 15 SendRequestNatives::SendRequestNatives(Dispatcher* dispatcher, |
| 16 RequestSender* request_sender, | 16 RequestSender* request_sender, |
| 17 ChromeV8Context* context) | 17 ChromeV8Context* context) |
| 18 : ChromeV8Extension(dispatcher, context->v8_context()), | 18 : ChromeV8Extension(dispatcher, context), |
| 19 request_sender_(request_sender), | 19 request_sender_(request_sender) { |
| 20 context_(context) { | |
| 21 RouteFunction("GetNextRequestId", | 20 RouteFunction("GetNextRequestId", |
| 22 base::Bind(&SendRequestNatives::GetNextRequestId, | 21 base::Bind(&SendRequestNatives::GetNextRequestId, |
| 23 base::Unretained(this))); | 22 base::Unretained(this))); |
| 24 RouteFunction("StartRequest", | 23 RouteFunction("StartRequest", |
| 25 base::Bind(&SendRequestNatives::StartRequest, | 24 base::Bind(&SendRequestNatives::StartRequest, |
| 26 base::Unretained(this))); | 25 base::Unretained(this))); |
| 27 RouteFunction("GetGlobal", | 26 RouteFunction("GetGlobal", |
| 28 base::Bind(&SendRequestNatives::GetGlobal, | 27 base::Bind(&SendRequestNatives::GetGlobal, |
| 29 base::Unretained(this))); | 28 base::Unretained(this))); |
| 30 } | 29 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return v8::Undefined(); | 64 return v8::Undefined(); |
| 66 } | 65 } |
| 67 | 66 |
| 68 v8::Handle<v8::Value> SendRequestNatives::GetGlobal(const v8::Arguments& args) { | 67 v8::Handle<v8::Value> SendRequestNatives::GetGlobal(const v8::Arguments& args) { |
| 69 CHECK_EQ(1, args.Length()); | 68 CHECK_EQ(1, args.Length()); |
| 70 CHECK(args[0]->IsObject()); | 69 CHECK(args[0]->IsObject()); |
| 71 return v8::Handle<v8::Object>::Cast(args[0])->CreationContext()->Global(); | 70 return v8::Handle<v8::Object>::Cast(args[0])->CreationContext()->Global(); |
| 72 } | 71 } |
| 73 | 72 |
| 74 } // namespace extensions | 73 } // namespace extensions |
| OLD | NEW |