Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: ppapi/proxy/ppb_flash_proxy.cc

Issue 6745021: Rename PPB_Flash::NavigateToURL() (to Navigate()) and make it take an URLRequestInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doh Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_flash_proxy.h" 5 #include "ppapi/proxy/ppb_flash_proxy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "ppapi/c/dev/ppb_font_dev.h" 9 #include "ppapi/c/dev/ppb_font_dev.h"
10 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/pp_resource.h" 11 #include "ppapi/c/pp_resource.h"
11 #include "ppapi/c/private/ppb_flash.h" 12 #include "ppapi/c/private/ppb_flash.h"
12 #include "ppapi/proxy/plugin_dispatcher.h" 13 #include "ppapi/proxy/plugin_dispatcher.h"
13 #include "ppapi/proxy/plugin_resource.h" 14 #include "ppapi/proxy/plugin_resource.h"
14 #include "ppapi/proxy/ppapi_messages.h" 15 #include "ppapi/proxy/ppapi_messages.h"
15 #include "ppapi/proxy/serialized_var.h" 16 #include "ppapi/proxy/serialized_var.h"
16 17
17 namespace pp { 18 namespace pp {
18 namespace proxy { 19 namespace proxy {
19 20
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 80 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
80 if (!dispatcher) 81 if (!dispatcher)
81 return PP_MakeUndefined(); 82 return PP_MakeUndefined();
82 83
83 ReceiveSerializedVarReturnValue result; 84 ReceiveSerializedVarReturnValue result;
84 dispatcher->Send(new PpapiHostMsg_PPBFlash_GetProxyForURL( 85 dispatcher->Send(new PpapiHostMsg_PPBFlash_GetProxyForURL(
85 INTERFACE_ID_PPB_FLASH, instance, url, &result)); 86 INTERFACE_ID_PPB_FLASH, instance, url, &result));
86 return result.Return(dispatcher); 87 return result.Return(dispatcher);
87 } 88 }
88 89
89 PP_Bool NavigateToURL(PP_Instance instance, 90 int32_t Navigate(PP_Resource request_id,
90 const char* url, 91 const char* target,
91 const char* target) { 92 bool from_user_action) {
92 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 93 PluginResource* request_object =
94 PluginResourceTracker::GetInstance()->GetResourceObject(request_id);
95 if (!request_object)
96 return PP_ERROR_BADRESOURCE;
97
98 PluginDispatcher* dispatcher =
99 PluginDispatcher::GetForInstance(request_object->instance());
93 if (!dispatcher) 100 if (!dispatcher)
94 return PP_FALSE; 101 return PP_ERROR_FAILED;
95 102
96 PP_Bool result = PP_FALSE; 103 int32_t result = PP_ERROR_FAILED;
97 dispatcher->Send(new PpapiHostMsg_PPBFlash_NavigateToURL( 104 dispatcher->Send(new PpapiHostMsg_PPBFlash_Navigate(
98 INTERFACE_ID_PPB_FLASH, instance, url, target, &result)); 105 INTERFACE_ID_PPB_FLASH,
106 request_object->host_resource(), target, from_user_action,
107 &result));
99 return result; 108 return result;
100 } 109 }
101 110
102 void RunMessageLoop(PP_Instance instance) { 111 void RunMessageLoop(PP_Instance instance) {
103 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 112 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
104 if (!dispatcher) 113 if (!dispatcher)
105 return; 114 return;
106 IPC::SyncMessage* msg = new PpapiHostMsg_PPBFlash_RunMessageLoop( 115 IPC::SyncMessage* msg = new PpapiHostMsg_PPBFlash_RunMessageLoop(
107 INTERFACE_ID_PPB_FLASH, instance); 116 INTERFACE_ID_PPB_FLASH, instance);
108 msg->EnableMessagePumping(); 117 msg->EnableMessagePumping();
109 dispatcher->Send(msg); 118 dispatcher->Send(msg);
110 } 119 }
111 120
112 void QuitMessageLoop(PP_Instance instance) { 121 void QuitMessageLoop(PP_Instance instance) {
113 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 122 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
114 if (!dispatcher) 123 if (!dispatcher)
115 return; 124 return;
116 dispatcher->Send(new PpapiHostMsg_PPBFlash_QuitMessageLoop( 125 dispatcher->Send(new PpapiHostMsg_PPBFlash_QuitMessageLoop(
117 INTERFACE_ID_PPB_FLASH, instance)); 126 INTERFACE_ID_PPB_FLASH, instance));
118 } 127 }
119 128
120 const PPB_Flash flash_interface = { 129 const PPB_Flash flash_interface = {
121 &SetInstanceAlwaysOnTop, 130 &SetInstanceAlwaysOnTop,
122 &DrawGlyphs, 131 &DrawGlyphs,
123 &GetProxyForURL, 132 &GetProxyForURL,
124 &NavigateToURL, 133 &Navigate,
125 &RunMessageLoop, 134 &RunMessageLoop,
126 &QuitMessageLoop, 135 &QuitMessageLoop,
127 }; 136 };
128 137
129 InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher, 138 InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher,
130 const void* target_interface) { 139 const void* target_interface) {
131 return new PPB_Flash_Proxy(dispatcher, target_interface); 140 return new PPB_Flash_Proxy(dispatcher, target_interface);
132 } 141 }
133 142
134 } // namespace 143 } // namespace
(...skipping 20 matching lines...) Expand all
155 164
156 bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { 165 bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
157 bool handled = true; 166 bool handled = true;
158 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg) 167 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg)
159 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop, 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop,
160 OnMsgSetInstanceAlwaysOnTop) 169 OnMsgSetInstanceAlwaysOnTop)
161 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs,
162 OnMsgDrawGlyphs) 171 OnMsgDrawGlyphs)
163 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL, 172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL,
164 OnMsgGetProxyForURL) 173 OnMsgGetProxyForURL)
165 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_NavigateToURL, OnMsgNavigateToURL) 174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnMsgNavigate)
166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_RunMessageLoop, 175 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_RunMessageLoop,
167 OnMsgRunMessageLoop) 176 OnMsgRunMessageLoop)
168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop, 177 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop,
169 OnMsgQuitMessageLoop) 178 OnMsgQuitMessageLoop)
170 IPC_MESSAGE_UNHANDLED(handled = false) 179 IPC_MESSAGE_UNHANDLED(handled = false)
171 IPC_END_MESSAGE_MAP() 180 IPC_END_MESSAGE_MAP()
172 // TODO(brettw) handle bad messages! 181 // TODO(brettw) handle bad messages!
173 return handled; 182 return handled;
174 } 183 }
175 184
(...skipping 25 matching lines...) Expand all
201 const_cast<PP_Point*>(&params.glyph_advances[0])); 210 const_cast<PP_Point*>(&params.glyph_advances[0]));
202 } 211 }
203 212
204 void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance, 213 void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance,
205 const std::string& url, 214 const std::string& url,
206 SerializedVarReturnValue result) { 215 SerializedVarReturnValue result) {
207 result.Return(dispatcher(), ppb_flash_target()->GetProxyForURL( 216 result.Return(dispatcher(), ppb_flash_target()->GetProxyForURL(
208 instance, url.c_str())); 217 instance, url.c_str()));
209 } 218 }
210 219
211 void PPB_Flash_Proxy::OnMsgNavigateToURL(PP_Instance instance, 220 void PPB_Flash_Proxy::OnMsgNavigate(const HostResource& request_info,
212 const std::string& url, 221 const std::string& target,
213 const std::string& target, 222 bool from_user_action,
214 PP_Bool* result) { 223 int32_t* result) {
215 *result = ppb_flash_target()->NavigateToURL(instance, url.c_str(), 224 *result = ppb_flash_target()->Navigate(request_info.host_resource(),
216 target.c_str()); 225 target.c_str(),
226 from_user_action);
217 } 227 }
218 228
219 void PPB_Flash_Proxy::OnMsgRunMessageLoop(PP_Instance instance) { 229 void PPB_Flash_Proxy::OnMsgRunMessageLoop(PP_Instance instance) {
220 ppb_flash_target()->RunMessageLoop(instance); 230 ppb_flash_target()->RunMessageLoop(instance);
221 } 231 }
222 232
223 void PPB_Flash_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) { 233 void PPB_Flash_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
224 ppb_flash_target()->QuitMessageLoop(instance); 234 ppb_flash_target()->QuitMessageLoop(instance);
225 } 235 }
226 236
227 } // namespace proxy 237 } // namespace proxy
228 } // namespace pp 238 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698