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

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

Issue 10913257: Convert url request info to new proxy API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 3 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') | ppapi/proxy/ppb_url_loader_proxy.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) 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 "ppapi/proxy/ppb_flash_proxy.h" 5 #include "ppapi/proxy/ppb_flash_proxy.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance, 197 int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance,
198 PP_Resource request_info, 198 PP_Resource request_info,
199 const char* target, 199 const char* target,
200 PP_Bool from_user_action) { 200 PP_Bool from_user_action) {
201 thunk::EnterResourceNoLock<thunk::PPB_URLRequestInfo_API> enter( 201 thunk::EnterResourceNoLock<thunk::PPB_URLRequestInfo_API> enter(
202 request_info, true); 202 request_info, true);
203 if (enter.failed()) 203 if (enter.failed())
204 return PP_ERROR_BADRESOURCE; 204 return PP_ERROR_BADRESOURCE;
205 return Navigate(instance, enter.object()->GetData(), target,
206 from_user_action);
207 }
205 208
209 int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance,
210 const URLRequestInfoData& data,
211 const char* target,
212 PP_Bool from_user_action) {
206 int32_t result = PP_ERROR_FAILED; 213 int32_t result = PP_ERROR_FAILED;
207 dispatcher()->Send(new PpapiHostMsg_PPBFlash_Navigate( 214 dispatcher()->Send(new PpapiHostMsg_PPBFlash_Navigate(
208 API_ID_PPB_FLASH, 215 API_ID_PPB_FLASH, instance, data, target, from_user_action, &result));
209 instance, enter.object()->GetData(), target, from_user_action,
210 &result));
211 return result; 216 return result;
212 } 217 }
213 218
214 void PPB_Flash_Proxy::RunMessageLoop(PP_Instance instance) { 219 void PPB_Flash_Proxy::RunMessageLoop(PP_Instance instance) {
215 IPC::SyncMessage* msg = new PpapiHostMsg_PPBFlash_RunMessageLoop( 220 IPC::SyncMessage* msg = new PpapiHostMsg_PPBFlash_RunMessageLoop(
216 API_ID_PPB_FLASH, instance); 221 API_ID_PPB_FLASH, instance);
217 msg->EnableMessagePumping(); 222 msg->EnableMessagePumping();
218 dispatcher()->Send(msg); 223 dispatcher()->Send(msg);
219 } 224 }
220 225
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 if (enter.succeeded()) { 656 if (enter.succeeded()) {
652 result.Return(dispatcher(), 657 result.Return(dispatcher(),
653 enter.functions()->GetFlashAPI()->GetProxyForURL( 658 enter.functions()->GetFlashAPI()->GetProxyForURL(
654 instance, url.c_str())); 659 instance, url.c_str()));
655 } else { 660 } else {
656 result.Return(dispatcher(), PP_MakeUndefined()); 661 result.Return(dispatcher(), PP_MakeUndefined());
657 } 662 }
658 } 663 }
659 664
660 void PPB_Flash_Proxy::OnHostMsgNavigate(PP_Instance instance, 665 void PPB_Flash_Proxy::OnHostMsgNavigate(PP_Instance instance,
661 const PPB_URLRequestInfo_Data& data, 666 const URLRequestInfoData& data,
662 const std::string& target, 667 const std::string& target,
663 PP_Bool from_user_action, 668 PP_Bool from_user_action,
664 int32_t* result) { 669 int32_t* result) {
665 EnterInstanceNoLock enter_instance(instance); 670 EnterInstanceNoLock enter_instance(instance);
666 if (enter_instance.failed()) { 671 if (enter_instance.failed()) {
667 *result = PP_ERROR_BADARGUMENT; 672 *result = PP_ERROR_BADARGUMENT;
668 return; 673 return;
669 } 674 }
670 DCHECK(!dispatcher()->IsPlugin()); 675 DCHECK(!dispatcher()->IsPlugin());
671 676
672 // Validate the PP_Instance since we'll be constructing resources on its 677 // Validate the PP_Instance since we'll be constructing resources on its
673 // behalf. 678 // behalf.
674 HostDispatcher* host_dispatcher = static_cast<HostDispatcher*>(dispatcher()); 679 HostDispatcher* host_dispatcher = static_cast<HostDispatcher*>(dispatcher());
675 if (HostDispatcher::GetForInstance(instance) != host_dispatcher) { 680 if (HostDispatcher::GetForInstance(instance) != host_dispatcher) {
676 NOTREACHED(); 681 NOTREACHED();
677 *result = PP_ERROR_BADARGUMENT; 682 *result = PP_ERROR_BADARGUMENT;
678 return; 683 return;
679 } 684 }
680 685
681 // We need to allow re-entrancy here, because this may call into Javascript 686 // We need to allow re-entrancy here, because this may call into Javascript
682 // (e.g. with a "javascript:" URL), or do things like navigate away from the 687 // (e.g. with a "javascript:" URL), or do things like navigate away from the
683 // page, either one of which will need to re-enter into the plugin. 688 // page, either one of which will need to re-enter into the plugin.
684 // It is safe, because it is essentially equivalent to NPN_GetURL, where Flash 689 // It is safe, because it is essentially equivalent to NPN_GetURL, where Flash
685 // would expect re-entrancy. When running in-process, it does re-enter here. 690 // would expect re-entrancy. When running in-process, it does re-enter here.
686 host_dispatcher->set_allow_plugin_reentrancy(); 691 host_dispatcher->set_allow_plugin_reentrancy();
687
688 // Make a temporary request resource.
689 thunk::EnterResourceCreation enter(instance);
690 if (enter.failed()) {
691 *result = PP_ERROR_FAILED;
692 return;
693 }
694 ScopedPPResource request_resource(
695 ScopedPPResource::PassRef(),
696 enter.functions()->CreateURLRequestInfo(instance, data));
697
698 *result = enter_instance.functions()->GetFlashAPI()->Navigate( 692 *result = enter_instance.functions()->GetFlashAPI()->Navigate(
699 instance, request_resource, target.c_str(), from_user_action); 693 instance, data, target.c_str(), from_user_action);
700 } 694 }
701 695
702 void PPB_Flash_Proxy::OnHostMsgRunMessageLoop(PP_Instance instance) { 696 void PPB_Flash_Proxy::OnHostMsgRunMessageLoop(PP_Instance instance) {
703 EnterInstanceNoLock enter(instance); 697 EnterInstanceNoLock enter(instance);
704 if (enter.succeeded()) 698 if (enter.succeeded())
705 enter.functions()->GetFlashAPI()->RunMessageLoop(instance); 699 enter.functions()->GetFlashAPI()->RunMessageLoop(instance);
706 } 700 }
707 701
708 void PPB_Flash_Proxy::OnHostMsgQuitMessageLoop(PP_Instance instance) { 702 void PPB_Flash_Proxy::OnHostMsgQuitMessageLoop(PP_Instance instance) {
709 EnterInstanceNoLock enter(instance); 703 EnterInstanceNoLock enter(instance);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 // It's rarely used enough that we just request this interface when needed. 875 // It's rarely used enough that we just request this interface when needed.
882 const PPB_Flash_Print_1_0* print_interface = 876 const PPB_Flash_Print_1_0* print_interface =
883 static_cast<const PPB_Flash_Print_1_0*>( 877 static_cast<const PPB_Flash_Print_1_0*>(
884 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); 878 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0));
885 if (print_interface) 879 if (print_interface)
886 print_interface->InvokePrinting(instance); 880 print_interface->InvokePrinting(instance);
887 } 881 }
888 882
889 } // namespace proxy 883 } // namespace proxy
890 } // namespace ppapi 884 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.h ('k') | ppapi/proxy/ppb_url_loader_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698