OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/pepper_plugin_delegate_impl.h" | 5 #include "chrome/renderer/pepper_plugin_delegate_impl.h" |
6 | 6 |
7 #include "app/surface/transport_dib.h" | 7 #include "app/surface/transport_dib.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "base/time.h" |
| 13 #include "chrome/common/child_thread.h" |
| 14 #include "chrome/common/file_system/file_system_dispatcher.h" |
12 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
13 #include "chrome/common/render_messages_params.h" | 16 #include "chrome/common/render_messages_params.h" |
14 #include "chrome/renderer/audio_message_filter.h" | 17 #include "chrome/renderer/audio_message_filter.h" |
15 #include "chrome/renderer/command_buffer_proxy.h" | 18 #include "chrome/renderer/command_buffer_proxy.h" |
16 #include "chrome/renderer/render_thread.h" | 19 #include "chrome/renderer/render_thread.h" |
17 #include "chrome/renderer/render_view.h" | 20 #include "chrome/renderer/render_view.h" |
18 #include "chrome/renderer/webplugin_delegate_proxy.h" | 21 #include "chrome/renderer/webplugin_delegate_proxy.h" |
19 #include "third_party/ppapi/c/dev/pp_video_dev.h" | 22 #include "third_party/ppapi/c/dev/pp_video_dev.h" |
20 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" |
21 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" |
22 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" |
| 26 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
23 #include "webkit/glue/plugins/pepper_file_io.h" | 27 #include "webkit/glue/plugins/pepper_file_io.h" |
24 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 28 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
25 #include "webkit/glue/plugins/webplugin.h" | 29 #include "webkit/glue/plugins/webplugin.h" |
26 | 30 |
27 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
28 #include "chrome/common/render_messages.h" | 32 #include "chrome/common/render_messages.h" |
29 #include "chrome/renderer/render_thread.h" | 33 #include "chrome/renderer/render_thread.h" |
30 #endif | 34 #endif |
31 | 35 |
32 namespace { | 36 namespace { |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 base::PlatformFile file, | 634 base::PlatformFile file, |
631 int message_id) { | 635 int message_id) { |
632 AsyncOpenFileCallback* callback = | 636 AsyncOpenFileCallback* callback = |
633 messages_waiting_replies_.Lookup(message_id); | 637 messages_waiting_replies_.Lookup(message_id); |
634 DCHECK(callback); | 638 DCHECK(callback); |
635 messages_waiting_replies_.Remove(message_id); | 639 messages_waiting_replies_.Remove(message_id); |
636 callback->Run(error_code, file); | 640 callback->Run(error_code, file); |
637 delete callback; | 641 delete callback; |
638 } | 642 } |
639 | 643 |
| 644 bool PepperPluginDelegateImpl::MakeDirectory( |
| 645 const FilePath& path, |
| 646 bool recursive, |
| 647 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 648 FileSystemDispatcher* file_system_dispatcher = |
| 649 ChildThread::current()->file_system_dispatcher(); |
| 650 return file_system_dispatcher->Create( |
| 651 path, false, true, recursive, dispatcher); |
| 652 } |
| 653 |
| 654 bool PepperPluginDelegateImpl::Query( |
| 655 const FilePath& path, |
| 656 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 657 FileSystemDispatcher* file_system_dispatcher = |
| 658 ChildThread::current()->file_system_dispatcher(); |
| 659 return file_system_dispatcher->ReadMetadata(path, dispatcher); |
| 660 } |
| 661 |
| 662 bool PepperPluginDelegateImpl::Touch( |
| 663 const FilePath& path, |
| 664 const base::Time& last_access_time, |
| 665 const base::Time& last_modified_time, |
| 666 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 667 FileSystemDispatcher* file_system_dispatcher = |
| 668 ChildThread::current()->file_system_dispatcher(); |
| 669 return file_system_dispatcher->TouchFile(path, last_access_time, |
| 670 last_modified_time, dispatcher); |
| 671 } |
| 672 |
| 673 bool PepperPluginDelegateImpl::Delete( |
| 674 const FilePath& path, |
| 675 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 676 FileSystemDispatcher* file_system_dispatcher = |
| 677 ChildThread::current()->file_system_dispatcher(); |
| 678 return file_system_dispatcher->Remove(path, dispatcher); |
| 679 } |
| 680 |
| 681 bool PepperPluginDelegateImpl::Rename( |
| 682 const FilePath& file_path, |
| 683 const FilePath& new_file_path, |
| 684 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 685 FileSystemDispatcher* file_system_dispatcher = |
| 686 ChildThread::current()->file_system_dispatcher(); |
| 687 return file_system_dispatcher->Move(file_path, new_file_path, dispatcher); |
| 688 } |
| 689 |
640 scoped_refptr<base::MessageLoopProxy> | 690 scoped_refptr<base::MessageLoopProxy> |
641 PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { | 691 PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { |
642 return RenderThread::current()->GetFileThreadMessageLoopProxy(); | 692 return RenderThread::current()->GetFileThreadMessageLoopProxy(); |
643 } | 693 } |
644 | 694 |
645 pepper::FullscreenContainer* | 695 pepper::FullscreenContainer* |
646 PepperPluginDelegateImpl::CreateFullscreenContainer( | 696 PepperPluginDelegateImpl::CreateFullscreenContainer( |
647 pepper::PluginInstance* instance) { | 697 pepper::PluginInstance* instance) { |
648 return render_view_->CreatePepperFullscreenContainer(instance); | 698 return render_view_->CreatePepperFullscreenContainer(instance); |
649 } | 699 } |
OLD | NEW |