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.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/message_loop.h" |
10 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
13 #include "ppapi/c/dev/pp_file_info_dev.h" | 14 #include "ppapi/c/dev/pp_file_info_dev.h" |
14 #include "ppapi/c/dev/ppb_file_io_dev.h" | 15 #include "ppapi/c/dev/ppb_file_io_dev.h" |
15 #include "ppapi/c/pp_completion_callback.h" | 16 #include "ppapi/c/pp_completion_callback.h" |
16 #include "ppapi/c/private/ppb_flash.h" | 17 #include "ppapi/c/private/ppb_flash.h" |
17 #include "webkit/plugins/ppapi/common.h" | 18 #include "webkit/plugins/ppapi/common.h" |
18 #include "webkit/plugins/ppapi/error_util.h" | 19 #include "webkit/plugins/ppapi/error_util.h" |
19 #include "webkit/plugins/ppapi/plugin_delegate.h" | 20 #include "webkit/plugins/ppapi/plugin_delegate.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 211 |
211 PP_Bool NavigateToURL(PP_Instance pp_instance, | 212 PP_Bool NavigateToURL(PP_Instance pp_instance, |
212 const char* url, | 213 const char* url, |
213 const char* target) { | 214 const char* target) { |
214 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 215 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
215 if (!instance) | 216 if (!instance) |
216 return PP_FALSE; | 217 return PP_FALSE; |
217 return BoolToPPBool(instance->NavigateToURL(url, target)); | 218 return BoolToPPBool(instance->NavigateToURL(url, target)); |
218 } | 219 } |
219 | 220 |
| 221 void RunMessageLoop() { |
| 222 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
| 223 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 224 MessageLoop::current()->Run(); |
| 225 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
| 226 } |
| 227 |
| 228 void QuitMessageLoop() { |
| 229 MessageLoop::current()->QuitNow(); |
| 230 } |
| 231 |
220 const PPB_Flash ppb_flash = { | 232 const PPB_Flash ppb_flash = { |
221 &SetInstanceAlwaysOnTop, | 233 &SetInstanceAlwaysOnTop, |
222 &PPB_Flash_Impl::DrawGlyphs, | 234 &PPB_Flash_Impl::DrawGlyphs, |
223 &GetProxyForURL, | 235 &GetProxyForURL, |
224 &OpenModuleLocalFile, | 236 &OpenModuleLocalFile, |
225 &RenameModuleLocalFile, | 237 &RenameModuleLocalFile, |
226 &DeleteModuleLocalFileOrDir, | 238 &DeleteModuleLocalFileOrDir, |
227 &CreateModuleLocalDir, | 239 &CreateModuleLocalDir, |
228 &QueryModuleLocalFile, | 240 &QueryModuleLocalFile, |
229 &GetModuleLocalDirContents, | 241 &GetModuleLocalDirContents, |
230 &FreeModuleLocalDirContents, | 242 &FreeModuleLocalDirContents, |
231 &NavigateToURL, | 243 &NavigateToURL, |
| 244 &RunMessageLoop, |
| 245 &QuitMessageLoop, |
232 }; | 246 }; |
233 | 247 |
234 } // namespace | 248 } // namespace |
235 | 249 |
236 // static | 250 // static |
237 const PPB_Flash* PPB_Flash_Impl::GetInterface() { | 251 const PPB_Flash* PPB_Flash_Impl::GetInterface() { |
238 return &ppb_flash; | 252 return &ppb_flash; |
239 } | 253 } |
240 | 254 |
241 // PPB_Flash_NetConnector_Impl ------------------------------------------------- | 255 // PPB_Flash_NetConnector_Impl ------------------------------------------------- |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // Wipe everything else out for safety. | 435 // Wipe everything else out for safety. |
422 socket_out_ = NULL; | 436 socket_out_ = NULL; |
423 local_addr_out_ = NULL; | 437 local_addr_out_ = NULL; |
424 remote_addr_out_ = NULL; | 438 remote_addr_out_ = NULL; |
425 | 439 |
426 callback->Run(rv); // Will complete abortively if necessary. | 440 callback->Run(rv); // Will complete abortively if necessary. |
427 } | 441 } |
428 | 442 |
429 } // namespace ppapi | 443 } // namespace ppapi |
430 } // namespace webkit | 444 } // namespace webkit |
OLD | NEW |