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/shared_impl/time_conversion.h" | 13 #include "ppapi/shared_impl/time_conversion.h" |
14 #include "ppapi/shared_impl/var.h" | 14 #include "ppapi/shared_impl/var.h" |
15 #include "ppapi/thunk/enter.h" | 15 #include "ppapi/thunk/enter.h" |
16 #include "webkit/plugins/ppapi/common.h" | 16 #include "webkit/plugins/ppapi/common.h" |
17 #include "webkit/plugins/ppapi/plugin_delegate.h" | 17 #include "webkit/plugins/ppapi/plugin_delegate.h" |
18 #include "webkit/plugins/ppapi/plugin_module.h" | 18 #include "webkit/plugins/ppapi/plugin_module.h" |
19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
20 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 20 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
| 21 #include "webkit/plugins/ppapi/resource_helper.h" |
21 #include "webkit/plugins/ppapi/resource_tracker.h" | 22 #include "webkit/plugins/ppapi/resource_tracker.h" |
22 | 23 |
23 using ppapi::PPTimeToTime; | 24 using ppapi::PPTimeToTime; |
24 using ppapi::StringVar; | 25 using ppapi::StringVar; |
25 using ppapi::thunk::EnterResource; | 26 using ppapi::thunk::EnterResource; |
26 using ppapi::thunk::PPB_URLRequestInfo_API; | 27 using ppapi::thunk::PPB_URLRequestInfo_API; |
27 | 28 |
28 namespace webkit { | 29 namespace webkit { |
29 namespace ppapi { | 30 namespace ppapi { |
30 | 31 |
(...skipping 26 matching lines...) Expand all Loading... |
57 bool from_user_action) { | 58 bool from_user_action) { |
58 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); | 59 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); |
59 if (enter.failed()) | 60 if (enter.failed()) |
60 return PP_ERROR_BADRESOURCE; | 61 return PP_ERROR_BADRESOURCE; |
61 PPB_URLRequestInfo_Impl* request = | 62 PPB_URLRequestInfo_Impl* request = |
62 static_cast<PPB_URLRequestInfo_Impl*>(enter.object()); | 63 static_cast<PPB_URLRequestInfo_Impl*>(enter.object()); |
63 | 64 |
64 if (!target) | 65 if (!target) |
65 return PP_ERROR_BADARGUMENT; | 66 return PP_ERROR_BADARGUMENT; |
66 | 67 |
67 PluginInstance* instance = request->instance(); | 68 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(request); |
68 if (!instance) | 69 if (!plugin_instance) |
69 return PP_ERROR_FAILED; | 70 return PP_ERROR_FAILED; |
70 | 71 return plugin_instance->Navigate(request, target, from_user_action); |
71 return instance->Navigate(request, target, from_user_action); | |
72 } | 72 } |
73 | 73 |
74 void RunMessageLoop(PP_Instance instance) { | 74 void RunMessageLoop(PP_Instance instance) { |
75 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 75 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
76 MessageLoop::current()->SetNestableTasksAllowed(true); | 76 MessageLoop::current()->SetNestableTasksAllowed(true); |
77 MessageLoop::current()->Run(); | 77 MessageLoop::current()->Run(); |
78 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 78 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
79 } | 79 } |
80 | 80 |
81 void QuitMessageLoop(PP_Instance instance) { | 81 void QuitMessageLoop(PP_Instance instance) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 } // namespace | 127 } // namespace |
128 | 128 |
129 // static | 129 // static |
130 const PPB_Flash* PPB_Flash_Impl::GetInterface() { | 130 const PPB_Flash* PPB_Flash_Impl::GetInterface() { |
131 return &ppb_flash; | 131 return &ppb_flash; |
132 } | 132 } |
133 | 133 |
134 } // namespace ppapi | 134 } // namespace ppapi |
135 } // namespace webkit | 135 } // namespace webkit |
OLD | NEW |