| 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/extension_request_sender.h" | 5 #include "chrome/renderer/extensions/extension_request_sender.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/common/extensions/extension_messages.h" | 8 #include "chrome/common/extensions/extension_messages.h" |
| 9 #include "chrome/renderer/extensions/chrome_v8_context.h" | 9 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| 10 #include "chrome/renderer/extensions/chrome_v8_context_set.h" | 10 #include "chrome/renderer/extensions/chrome_v8_context_set.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 WebKit::WebSecurityOrigin source_origin; | 89 WebKit::WebSecurityOrigin source_origin; |
| 90 WebKit::WebFrame* webframe = current_context->web_frame(); | 90 WebKit::WebFrame* webframe = current_context->web_frame(); |
| 91 if (webframe) { | 91 if (webframe) { |
| 92 source_url = webframe->document().url(); | 92 source_url = webframe->document().url(); |
| 93 source_origin = webframe->document().securityOrigin(); | 93 source_origin = webframe->document().securityOrigin(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 v8::Persistent<v8::Context> v8_context = | 96 v8::Persistent<v8::Context> v8_context = |
| 97 v8::Persistent<v8::Context>::New(v8::Context::GetCurrent()); | 97 v8::Persistent<v8::Context>::New(v8::Context::GetCurrent()); |
| 98 DCHECK(!v8_context.IsEmpty()); | 98 DCHECK(!v8_context.IsEmpty()); |
| 99 |
| 100 std::string extension_id = current_context->GetExtensionID(); |
| 99 InsertRequest(request_id, new PendingRequest( | 101 InsertRequest(request_id, new PendingRequest( |
| 100 v8_context, name, current_context->extension_id())); | 102 v8_context, name, extension_id)); |
| 101 | 103 |
| 102 ExtensionHostMsg_Request_Params params; | 104 ExtensionHostMsg_Request_Params params; |
| 103 params.name = name; | 105 params.name = name; |
| 104 params.arguments.Swap(value_args); | 106 params.arguments.Swap(value_args); |
| 105 params.extension_id = current_context->extension_id(); | 107 params.extension_id = extension_id; |
| 106 params.source_url = source_url; | 108 params.source_url = source_url; |
| 107 params.source_origin = source_origin.toString(); | 109 params.source_origin = source_origin.toString(); |
| 108 params.request_id = request_id; | 110 params.request_id = request_id; |
| 109 params.has_callback = has_callback; | 111 params.has_callback = has_callback; |
| 110 params.user_gesture = | 112 params.user_gesture = |
| 111 webframe ? webframe->isProcessingUserGesture() : false; | 113 webframe ? webframe->isProcessingUserGesture() : false; |
| 112 if (for_io_thread) { | 114 if (for_io_thread) { |
| 113 renderview->Send(new ExtensionHostMsg_RequestForIOThread( | 115 renderview->Send(new ExtensionHostMsg_RequestForIOThread( |
| 114 renderview->GetRoutingID(), params)); | 116 renderview->GetRoutingID(), params)); |
| 115 } else { | 117 } else { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 &retval)); | 152 &retval)); |
| 151 // In debug, the js will validate the callback parameters and return a | 153 // In debug, the js will validate the callback parameters and return a |
| 152 // string if a validation error has occured. | 154 // string if a validation error has occured. |
| 153 #ifndef NDEBUG | 155 #ifndef NDEBUG |
| 154 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 156 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
| 155 std::string error = *v8::String::AsciiValue(retval); | 157 std::string error = *v8::String::AsciiValue(retval); |
| 156 DCHECK(false) << error; | 158 DCHECK(false) << error; |
| 157 } | 159 } |
| 158 #endif | 160 #endif |
| 159 } | 161 } |
| OLD | NEW |