| OLD | NEW |
| 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 "webkit/plugins/ppapi/ppb_flash_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "ppapi/c/private/ppb_flash.h" | 12 #include "ppapi/c/private/ppb_flash.h" |
| 13 #include "ppapi/thunk/enter.h" |
| 13 #include "webkit/plugins/ppapi/common.h" | 14 #include "webkit/plugins/ppapi/common.h" |
| 14 #include "webkit/plugins/ppapi/plugin_delegate.h" | 15 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 15 #include "webkit/plugins/ppapi/plugin_module.h" | 16 #include "webkit/plugins/ppapi/plugin_module.h" |
| 16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 17 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 17 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 18 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
| 18 #include "webkit/plugins/ppapi/resource_tracker.h" | 19 #include "webkit/plugins/ppapi/resource_tracker.h" |
| 19 #include "webkit/plugins/ppapi/var.h" | 20 #include "webkit/plugins/ppapi/var.h" |
| 20 | 21 |
| 22 using ppapi::thunk::EnterResource; |
| 23 using ppapi::thunk::PPB_URLRequestInfo_API; |
| 24 |
| 21 namespace webkit { | 25 namespace webkit { |
| 22 namespace ppapi { | 26 namespace ppapi { |
| 23 | 27 |
| 24 namespace { | 28 namespace { |
| 25 | 29 |
| 26 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { | 30 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { |
| 27 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 31 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
| 28 if (!instance) | 32 if (!instance) |
| 29 return; | 33 return; |
| 30 instance->set_always_on_top(PPBoolToBool(on_top)); | 34 instance->set_always_on_top(PPBoolToBool(on_top)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 | 45 |
| 42 std::string proxy_host = instance->delegate()->ResolveProxy(gurl); | 46 std::string proxy_host = instance->delegate()->ResolveProxy(gurl); |
| 43 if (proxy_host.empty()) | 47 if (proxy_host.empty()) |
| 44 return PP_MakeUndefined(); // No proxy. | 48 return PP_MakeUndefined(); // No proxy. |
| 45 return StringVar::StringToPPVar(instance->module(), proxy_host); | 49 return StringVar::StringToPPVar(instance->module(), proxy_host); |
| 46 } | 50 } |
| 47 | 51 |
| 48 int32_t Navigate(PP_Resource request_id, | 52 int32_t Navigate(PP_Resource request_id, |
| 49 const char* target, | 53 const char* target, |
| 50 bool from_user_action) { | 54 bool from_user_action) { |
| 51 scoped_refptr<PPB_URLRequestInfo_Impl> request( | 55 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); |
| 52 Resource::GetAs<PPB_URLRequestInfo_Impl>(request_id)); | 56 if (enter.failed()) |
| 53 if (!request) | |
| 54 return PP_ERROR_BADRESOURCE; | 57 return PP_ERROR_BADRESOURCE; |
| 58 PPB_URLRequestInfo_Impl* request = |
| 59 static_cast<PPB_URLRequestInfo_Impl*>(enter.object()); |
| 55 | 60 |
| 56 if (!target) | 61 if (!target) |
| 57 return PP_ERROR_BADARGUMENT; | 62 return PP_ERROR_BADARGUMENT; |
| 58 | 63 |
| 59 PluginInstance* instance = request->instance(); | 64 PluginInstance* instance = request->instance(); |
| 60 if (!instance) | 65 if (!instance) |
| 61 return PP_ERROR_FAILED; | 66 return PP_ERROR_FAILED; |
| 62 | 67 |
| 63 return instance->Navigate(request, target, from_user_action); | 68 return instance->Navigate(request, target, from_user_action); |
| 64 } | 69 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 124 |
| 120 } // namespace | 125 } // namespace |
| 121 | 126 |
| 122 // static | 127 // static |
| 123 const PPB_Flash* PPB_Flash_Impl::GetInterface() { | 128 const PPB_Flash* PPB_Flash_Impl::GetInterface() { |
| 124 return &ppb_flash; | 129 return &ppb_flash; |
| 125 } | 130 } |
| 126 | 131 |
| 127 } // namespace ppapi | 132 } // namespace ppapi |
| 128 } // namespace webkit | 133 } // namespace webkit |
| OLD | NEW |