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 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/id_map.h" | 14 #include "base/id_map.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "content/renderer/pepper_parent_context_provider.h" |
18 #include "ppapi/proxy/broker_dispatcher.h" | 19 #include "ppapi/proxy/broker_dispatcher.h" |
19 #include "ppapi/proxy/proxy_channel.h" | 20 #include "ppapi/proxy/proxy_channel.h" |
20 #include "ui/base/ime/text_input_type.h" | 21 #include "ui/base/ime/text_input_type.h" |
21 #include "webkit/plugins/ppapi/plugin_delegate.h" | 22 #include "webkit/plugins/ppapi/plugin_delegate.h" |
22 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 23 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
23 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" | 24 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
24 | 25 |
25 class FilePath; | 26 class FilePath; |
26 class PepperPluginDelegateImpl; | 27 class PepperPluginDelegateImpl; |
27 class RenderViewImpl; | 28 class RenderViewImpl; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Always set and cleared at the same time as the module's pointer to this. | 113 // Always set and cleared at the same time as the module's pointer to this. |
113 webkit::ppapi::PluginModule* plugin_module_; | 114 webkit::ppapi::PluginModule* plugin_module_; |
114 | 115 |
115 base::WeakPtr<PepperPluginDelegateImpl> delegate_; | 116 base::WeakPtr<PepperPluginDelegateImpl> delegate_; |
116 | 117 |
117 DISALLOW_COPY_AND_ASSIGN(PpapiBrokerImpl); | 118 DISALLOW_COPY_AND_ASSIGN(PpapiBrokerImpl); |
118 }; | 119 }; |
119 | 120 |
120 class PepperPluginDelegateImpl | 121 class PepperPluginDelegateImpl |
121 : public webkit::ppapi::PluginDelegate, | 122 : public webkit::ppapi::PluginDelegate, |
122 public base::SupportsWeakPtr<PepperPluginDelegateImpl> { | 123 public base::SupportsWeakPtr<PepperPluginDelegateImpl>, |
| 124 public PepperParentContextProvider { |
123 public: | 125 public: |
124 explicit PepperPluginDelegateImpl(RenderViewImpl* render_view); | 126 explicit PepperPluginDelegateImpl(RenderViewImpl* render_view); |
125 virtual ~PepperPluginDelegateImpl(); | 127 virtual ~PepperPluginDelegateImpl(); |
126 | 128 |
127 // Attempts to create a PPAPI plugin for the given filepath. On success, it | 129 // Attempts to create a PPAPI plugin for the given filepath. On success, it |
128 // will return the newly-created module. | 130 // will return the newly-created module. |
129 // | 131 // |
130 // There are two reasons for failure. The first is that the plugin isn't | 132 // There are two reasons for failure. The first is that the plugin isn't |
131 // a PPAPI plugin. In this case, |*pepper_plugin_was_registered| will be set | 133 // a PPAPI plugin. In this case, |*pepper_plugin_was_registered| will be set |
132 // to false and the caller may want to fall back on creating an NPAPI plugin. | 134 // to false and the caller may want to fall back on creating an NPAPI plugin. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 const std::string& policy); | 353 const std::string& policy); |
352 | 354 |
353 // Asynchronously attempts to create a PPAPI broker for the given plugin. | 355 // Asynchronously attempts to create a PPAPI broker for the given plugin. |
354 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( | 356 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( |
355 webkit::ppapi::PluginModule* plugin_module); | 357 webkit::ppapi::PluginModule* plugin_module); |
356 | 358 |
357 bool MouseLockedOrPending() const { | 359 bool MouseLockedOrPending() const { |
358 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; | 360 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; |
359 } | 361 } |
360 | 362 |
| 363 // Implementation of PepperParentContextProvider. |
| 364 virtual RendererGLContext* GetParentContextForPlatformContext3D(); |
| 365 |
361 // Pointer to the RenderView that owns us. | 366 // Pointer to the RenderView that owns us. |
362 RenderViewImpl* render_view_; | 367 RenderViewImpl* render_view_; |
363 | 368 |
364 std::set<webkit::ppapi::PluginInstance*> active_instances_; | 369 std::set<webkit::ppapi::PluginInstance*> active_instances_; |
365 | 370 |
366 // Used to send a single context menu "completion" upon menu close. | 371 // Used to send a single context menu "completion" upon menu close. |
367 bool has_saved_context_menu_action_; | 372 bool has_saved_context_menu_action_; |
368 unsigned saved_context_menu_action_; | 373 unsigned saved_context_menu_action_; |
369 | 374 |
370 IDMap<AsyncOpenFileCallback> pending_async_open_files_; | 375 IDMap<AsyncOpenFileCallback> pending_async_open_files_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // The plugin instance that received the last mouse event. It is set to NULL | 412 // The plugin instance that received the last mouse event. It is set to NULL |
408 // if the last mouse event went to elements other than Pepper plugins. | 413 // if the last mouse event went to elements other than Pepper plugins. |
409 // |last_mouse_event_target_| is not owned by this class. We can know about | 414 // |last_mouse_event_target_| is not owned by this class. We can know about |
410 // when it is destroyed via InstanceDeleted(). | 415 // when it is destroyed via InstanceDeleted(). |
411 webkit::ppapi::PluginInstance* last_mouse_event_target_; | 416 webkit::ppapi::PluginInstance* last_mouse_event_target_; |
412 | 417 |
413 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 418 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
414 }; | 419 }; |
415 | 420 |
416 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 421 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |