| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/pepper/pepper_extensions_common_host.h" | 5 #include "chrome/renderer/pepper/pepper_extensions_common_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/renderer/extensions/chrome_v8_context.h" | 10 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 IPC_BEGIN_MESSAGE_MAP(PepperExtensionsCommonHost, msg) | 61 IPC_BEGIN_MESSAGE_MAP(PepperExtensionsCommonHost, msg) |
| 62 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Post, | 62 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Post, |
| 63 OnPost) | 63 OnPost) |
| 64 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Call, | 64 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Call, |
| 65 OnCall) | 65 OnCall) |
| 66 IPC_END_MESSAGE_MAP() | 66 IPC_END_MESSAGE_MAP() |
| 67 return PP_ERROR_FAILED; | 67 return PP_ERROR_FAILED; |
| 68 } | 68 } |
| 69 | 69 |
| 70 extensions::ChromeV8Context* PepperExtensionsCommonHost::GetContext() { | 70 extensions::ChromeV8Context* PepperExtensionsCommonHost::GetContext() { |
| 71 WebKit::WebPluginContainer* container = | 71 blink::WebPluginContainer* container = |
| 72 renderer_ppapi_host_->GetContainerForInstance(pp_instance()); | 72 renderer_ppapi_host_->GetContainerForInstance(pp_instance()); |
| 73 if (!container) | 73 if (!container) |
| 74 return NULL; | 74 return NULL; |
| 75 | 75 |
| 76 WebKit::WebFrame* frame = container->element().document().frame(); | 76 blink::WebFrame* frame = container->element().document().frame(); |
| 77 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 77 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 78 return dispatcher_->v8_context_set().GetByV8Context( | 78 return dispatcher_->v8_context_set().GetByV8Context( |
| 79 frame->mainWorldScriptContext()); | 79 frame->mainWorldScriptContext()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void PepperExtensionsCommonHost::OnResponseReceived( | 82 void PepperExtensionsCommonHost::OnResponseReceived( |
| 83 const std::string& /* name */, | 83 const std::string& /* name */, |
| 84 int request_id, | 84 int request_id, |
| 85 bool success, | 85 bool success, |
| 86 const base::ListValue& response, | 86 const base::ListValue& response, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 int request_id = dispatcher_->request_sender()->GetNextRequestId(); | 121 int request_id = dispatcher_->request_sender()->GetNextRequestId(); |
| 122 pending_request_map_[request_id] = | 122 pending_request_map_[request_id] = |
| 123 linked_ptr<ppapi::host::ReplyMessageContext>( | 123 linked_ptr<ppapi::host::ReplyMessageContext>( |
| 124 new ppapi::host::ReplyMessageContext( | 124 new ppapi::host::ReplyMessageContext( |
| 125 context->MakeReplyMessageContext())); | 125 context->MakeReplyMessageContext())); |
| 126 | 126 |
| 127 dispatcher_->request_sender()->StartRequest(this, request_name, request_id, | 127 dispatcher_->request_sender()->StartRequest(this, request_name, request_id, |
| 128 true, false, &args); | 128 true, false, &args); |
| 129 return PP_OK_COMPLETIONPENDING; | 129 return PP_OK_COMPLETIONPENDING; |
| 130 } | 130 } |
| OLD | NEW |