| 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 #ifndef CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
| 6 #define CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 6 #define CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "base/weak_ptr.h" | 15 #include "base/weak_ptr.h" |
| 16 #include "ppapi/c/pp_errors.h" | 16 #include "ppapi/c/pp_errors.h" |
| 17 #include "webkit/glue/plugins/pepper_plugin_delegate.h" | 17 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 18 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 18 #include "webkit/plugins/ppapi/plugin_instance.h" |
| 19 | 19 |
| 20 class FilePath; | 20 class FilePath; |
| 21 class RenderView; | 21 class RenderView; |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class Rect; | 24 class Rect; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace pepper { | 27 namespace webkit { |
| 28 class FileIO; | 28 namespace ppapi { |
| 29 |
| 29 class PluginInstance; | 30 class PluginInstance; |
| 30 class PluginModule; | 31 class PluginModule; |
| 31 } | 32 |
| 33 } // namespace ppapi |
| 34 } // namespace webkit |
| 32 | 35 |
| 33 namespace WebKit { | 36 namespace WebKit { |
| 34 class WebFileChooserCompletion; | 37 class WebFileChooserCompletion; |
| 35 struct WebFileChooserParams; | 38 struct WebFileChooserParams; |
| 36 } | 39 } |
| 37 | 40 |
| 38 class TransportDIB; | 41 class TransportDIB; |
| 39 | 42 |
| 40 class PepperPluginDelegateImpl | 43 class PepperPluginDelegateImpl |
| 41 : public pepper::PluginDelegate, | 44 : public webkit::ppapi::PluginDelegate, |
| 42 public base::SupportsWeakPtr<PepperPluginDelegateImpl> { | 45 public base::SupportsWeakPtr<PepperPluginDelegateImpl> { |
| 43 public: | 46 public: |
| 44 explicit PepperPluginDelegateImpl(RenderView* render_view); | 47 explicit PepperPluginDelegateImpl(RenderView* render_view); |
| 45 virtual ~PepperPluginDelegateImpl(); | 48 virtual ~PepperPluginDelegateImpl(); |
| 46 | 49 |
| 47 scoped_refptr<pepper::PluginModule> CreatePepperPlugin(const FilePath& path); | 50 scoped_refptr<webkit::ppapi::PluginModule> CreatePepperPlugin( |
| 51 const FilePath& path); |
| 48 | 52 |
| 49 // Called by RenderView to tell us about painting events, these two functions | 53 // Called by RenderView to tell us about painting events, these two functions |
| 50 // just correspond to the DidInitiatePaint and DidFlushPaint in R.V.. | 54 // just correspond to the DidInitiatePaint and DidFlushPaint in R.V.. |
| 51 void ViewInitiatedPaint(); | 55 void ViewInitiatedPaint(); |
| 52 void ViewFlushedPaint(); | 56 void ViewFlushedPaint(); |
| 53 | 57 |
| 54 // Called by RenderView to implement the corresponding function in its base | 58 // Called by RenderView to implement the corresponding function in its base |
| 55 // class RenderWidget (see that for more). | 59 // class RenderWidget (see that for more). |
| 56 bool GetBitmapForOptimizedPluginPaint( | 60 bool GetBitmapForOptimizedPluginPaint( |
| 57 const gfx::Rect& paint_bounds, | 61 const gfx::Rect& paint_bounds, |
| 58 TransportDIB** dib, | 62 TransportDIB** dib, |
| 59 gfx::Rect* location, | 63 gfx::Rect* location, |
| 60 gfx::Rect* clip); | 64 gfx::Rect* clip); |
| 61 | 65 |
| 62 // Called by RenderView when ViewMsg_AsyncOpenFile_ACK. | 66 // Called by RenderView when ViewMsg_AsyncOpenFile_ACK. |
| 63 void OnAsyncFileOpened(base::PlatformFileError error_code, | 67 void OnAsyncFileOpened(base::PlatformFileError error_code, |
| 64 base::PlatformFile file, | 68 base::PlatformFile file, |
| 65 int message_id); | 69 int message_id); |
| 66 | 70 |
| 67 // Notification that the render view has been focused or defocused. This | 71 // Notification that the render view has been focused or defocused. This |
| 68 // notifies all of the plugins. | 72 // notifies all of the plugins. |
| 69 void OnSetFocus(bool has_focus); | 73 void OnSetFocus(bool has_focus); |
| 70 | 74 |
| 71 // pepper::PluginDelegate implementation. | 75 // PluginDelegate implementation. |
| 72 virtual void InstanceCreated(pepper::PluginInstance* instance); | 76 virtual void InstanceCreated( |
| 73 virtual void InstanceDeleted(pepper::PluginInstance* instance); | 77 webkit::ppapi::PluginInstance* instance); |
| 78 virtual void InstanceDeleted( |
| 79 webkit::ppapi::PluginInstance* instance); |
| 74 virtual PlatformAudio* CreateAudio( | 80 virtual PlatformAudio* CreateAudio( |
| 75 uint32_t sample_rate, | 81 uint32_t sample_rate, |
| 76 uint32_t sample_count, | 82 uint32_t sample_count, |
| 77 pepper::PluginDelegate::PlatformAudio::Client* client); | 83 PlatformAudio::Client* client); |
| 78 virtual PlatformImage2D* CreateImage2D(int width, int height); | 84 virtual PlatformImage2D* CreateImage2D(int width, int height); |
| 79 virtual PlatformContext3D* CreateContext3D(); | 85 virtual PlatformContext3D* CreateContext3D(); |
| 80 virtual PlatformVideoDecoder* CreateVideoDecoder( | 86 virtual PlatformVideoDecoder* CreateVideoDecoder( |
| 81 const PP_VideoDecoderConfig_Dev& decoder_config); | 87 const PP_VideoDecoderConfig_Dev& decoder_config); |
| 82 virtual void NumberOfFindResultsChanged(int identifier, | 88 virtual void NumberOfFindResultsChanged(int identifier, |
| 83 int total, | 89 int total, |
| 84 bool final_result); | 90 bool final_result); |
| 85 virtual void SelectedFindResultChanged(int identifier, int index); | 91 virtual void SelectedFindResultChanged(int identifier, int index); |
| 86 virtual bool RunFileChooser( | 92 virtual bool RunFileChooser( |
| 87 const WebKit::WebFileChooserParams& params, | 93 const WebKit::WebFileChooserParams& params, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 virtual base::PlatformFileError CreateModuleLocalDir( | 132 virtual base::PlatformFileError CreateModuleLocalDir( |
| 127 const std::string& module_name, | 133 const std::string& module_name, |
| 128 const FilePath& path); | 134 const FilePath& path); |
| 129 virtual base::PlatformFileError QueryModuleLocalFile( | 135 virtual base::PlatformFileError QueryModuleLocalFile( |
| 130 const std::string& module_name, | 136 const std::string& module_name, |
| 131 const FilePath& path, | 137 const FilePath& path, |
| 132 base::PlatformFileInfo* info); | 138 base::PlatformFileInfo* info); |
| 133 virtual base::PlatformFileError GetModuleLocalDirContents( | 139 virtual base::PlatformFileError GetModuleLocalDirContents( |
| 134 const std::string& module_name, | 140 const std::string& module_name, |
| 135 const FilePath& path, | 141 const FilePath& path, |
| 136 PepperDirContents* contents); | 142 webkit::ppapi::DirContents* contents); |
| 137 virtual scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); | 143 virtual scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); |
| 138 virtual pepper::FullscreenContainer* CreateFullscreenContainer( | 144 virtual webkit::ppapi::FullscreenContainer* |
| 139 pepper::PluginInstance* instance); | 145 CreateFullscreenContainer( |
| 146 webkit::ppapi::PluginInstance* instance); |
| 140 virtual std::string GetDefaultEncoding(); | 147 virtual std::string GetDefaultEncoding(); |
| 141 virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor); | 148 virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor); |
| 142 virtual std::string ResolveProxy(const GURL& url); | 149 virtual std::string ResolveProxy(const GURL& url); |
| 143 virtual void DidStartLoading(); | 150 virtual void DidStartLoading(); |
| 144 virtual void DidStopLoading(); | 151 virtual void DidStopLoading(); |
| 145 virtual void SetContentRestriction(int restrictions); | 152 virtual void SetContentRestriction(int restrictions); |
| 146 | 153 |
| 147 private: | 154 private: |
| 148 // Pointer to the RenderView that owns us. | 155 // Pointer to the RenderView that owns us. |
| 149 RenderView* render_view_; | 156 RenderView* render_view_; |
| 150 | 157 |
| 151 std::set<pepper::PluginInstance*> active_instances_; | 158 std::set<webkit::ppapi::PluginInstance*> active_instances_; |
| 152 | 159 |
| 153 int id_generator_; | 160 int id_generator_; |
| 154 IDMap<AsyncOpenFileCallback> messages_waiting_replies_; | 161 IDMap<AsyncOpenFileCallback> messages_waiting_replies_; |
| 155 | 162 |
| 156 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 163 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
| 157 }; | 164 }; |
| 158 | 165 |
| 159 #endif // CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 166 #endif // CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
| OLD | NEW |