| 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/request_sender.h" | 5 #include "chrome/renderer/extensions/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/dispatcher.h" | 10 #include "chrome/renderer/extensions/dispatcher.h" |
| 11 #include "content/public/renderer/render_view.h" | 11 #include "content/public/renderer/render_view.h" |
| 12 #include "content/public/renderer/v8_value_converter.h" | 12 #include "content/public/renderer/v8_value_converter.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserGestureIndicat
or.h" |
| 16 | 17 |
| 17 using content::V8ValueConverter; | 18 using content::V8ValueConverter; |
| 18 | 19 |
| 19 namespace extensions { | 20 namespace extensions { |
| 20 | 21 |
| 21 // Contains info relevant to a pending API request. | 22 // Contains info relevant to a pending API request. |
| 22 struct PendingRequest { | 23 struct PendingRequest { |
| 23 public : | 24 public : |
| 24 PendingRequest(const std::string& name, ChromeV8Context* context) | 25 PendingRequest(const std::string& name, ChromeV8Context* context) |
| 25 : name(name), context(context) { | 26 : name(name), context(context) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 86 |
| 86 ExtensionHostMsg_Request_Params params; | 87 ExtensionHostMsg_Request_Params params; |
| 87 params.name = name; | 88 params.name = name; |
| 88 params.arguments.Swap(value_args); | 89 params.arguments.Swap(value_args); |
| 89 params.extension_id = context->GetExtensionID(); | 90 params.extension_id = context->GetExtensionID(); |
| 90 params.source_url = source_url; | 91 params.source_url = source_url; |
| 91 params.source_origin = source_origin.toString(); | 92 params.source_origin = source_origin.toString(); |
| 92 params.request_id = request_id; | 93 params.request_id = request_id; |
| 93 params.has_callback = has_callback; | 94 params.has_callback = has_callback; |
| 94 params.user_gesture = | 95 params.user_gesture = |
| 95 webframe ? webframe->isProcessingUserGesture() : false; | 96 WebKit::WebUserGestureIndicator::isProcessingUserGesture(); |
| 96 if (for_io_thread) { | 97 if (for_io_thread) { |
| 97 renderview->Send(new ExtensionHostMsg_RequestForIOThread( | 98 renderview->Send(new ExtensionHostMsg_RequestForIOThread( |
| 98 renderview->GetRoutingID(), params)); | 99 renderview->GetRoutingID(), params)); |
| 99 } else { | 100 } else { |
| 100 renderview->Send(new ExtensionHostMsg_Request( | 101 renderview->Send(new ExtensionHostMsg_Request( |
| 101 renderview->GetRoutingID(), params)); | 102 renderview->GetRoutingID(), params)); |
| 102 } | 103 } |
| 103 } | 104 } |
| 104 | 105 |
| 105 void RequestSender::HandleResponse(int request_id, | 106 void RequestSender::HandleResponse(int request_id, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 for (PendingRequestMap::iterator it = pending_requests_.begin(); | 144 for (PendingRequestMap::iterator it = pending_requests_.begin(); |
| 144 it != pending_requests_.end();) { | 145 it != pending_requests_.end();) { |
| 145 if (it->second->context == context) | 146 if (it->second->context == context) |
| 146 pending_requests_.erase(it++); | 147 pending_requests_.erase(it++); |
| 147 else | 148 else |
| 148 ++it; | 149 ++it; |
| 149 } | 150 } |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace extensions | 153 } // namespace extensions |
| OLD | NEW |