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