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 "ppapi/proxy/broker_dispatcher.h" | 18 #include "ppapi/proxy/broker_dispatcher.h" |
19 #include "ppapi/proxy/proxy_channel.h" | 19 #include "ppapi/proxy/proxy_channel.h" |
| 20 #include "ui/base/ime/text_input_type.h" |
20 #include "webkit/plugins/ppapi/plugin_delegate.h" | 21 #include "webkit/plugins/ppapi/plugin_delegate.h" |
21 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 22 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
22 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" | 23 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
23 | 24 |
24 class FilePath; | 25 class FilePath; |
25 class PepperPluginDelegateImpl; | 26 class PepperPluginDelegateImpl; |
26 class RenderViewImpl; | 27 class RenderViewImpl; |
27 | 28 |
28 namespace gfx { | 29 namespace gfx { |
29 class Point; | 30 class Point; |
30 class Rect; | 31 class Rect; |
31 } | 32 } |
32 | 33 |
33 namespace IPC { | 34 namespace IPC { |
34 struct ChannelHandle; | 35 struct ChannelHandle; |
35 } | 36 } |
36 | 37 |
37 namespace webkit { | 38 namespace webkit { |
38 struct WebPluginInfo; | 39 struct WebPluginInfo; |
39 namespace ppapi { | 40 namespace ppapi { |
40 class PepperFilePath; | 41 class PepperFilePath; |
41 class PluginInstance; | 42 class PluginInstance; |
42 class PluginModule; | 43 class PluginModule; |
43 } | 44 } |
44 } | 45 } |
45 | 46 |
46 namespace WebKit { | 47 namespace WebKit { |
47 class WebFileChooserCompletion; | 48 class WebFileChooserCompletion; |
48 class WebMouseEvent; | 49 class WebMouseEvent; |
| 50 struct WebCompositionUnderline; |
49 struct WebFileChooserParams; | 51 struct WebFileChooserParams; |
50 } | 52 } |
51 | 53 |
52 namespace webkit_glue { | 54 namespace webkit_glue { |
53 struct CustomContextMenuContext; | 55 struct CustomContextMenuContext; |
54 } | 56 } |
55 | 57 |
56 class TransportDIB; | 58 class TransportDIB; |
57 | 59 |
58 // This object is NOT thread-safe. | 60 // This object is NOT thread-safe. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 base::ProcessHandle broker_process_handle, | 161 base::ProcessHandle broker_process_handle, |
160 const IPC::ChannelHandle& handle); | 162 const IPC::ChannelHandle& handle); |
161 | 163 |
162 // Removes broker from pending_connect_broker_ if present. Returns true if so. | 164 // Removes broker from pending_connect_broker_ if present. Returns true if so. |
163 bool StopWaitingForPpapiBrokerConnection(PpapiBrokerImpl* broker); | 165 bool StopWaitingForPpapiBrokerConnection(PpapiBrokerImpl* broker); |
164 | 166 |
165 // Notification that the render view has been focused or defocused. This | 167 // Notification that the render view has been focused or defocused. This |
166 // notifies all of the plugins. | 168 // notifies all of the plugins. |
167 void OnSetFocus(bool has_focus); | 169 void OnSetFocus(bool has_focus); |
168 | 170 |
169 // Returns whether or not a Pepper plugin is focused. | 171 // IME status. |
170 bool IsPluginFocused() const; | 172 bool IsPluginFocused() const; |
| 173 gfx::Rect GetCaretBounds() const; |
| 174 ui::TextInputType GetTextInputType() const; |
| 175 bool IsPluginAcceptingCompositionEvents() const; |
| 176 bool CanComposeInline() const; |
| 177 |
| 178 // IME events. |
| 179 void OnImeSetComposition( |
| 180 const string16& text, |
| 181 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 182 int selection_start, |
| 183 int selection_end); |
| 184 void OnImeConfirmComposition(const string16& text); |
171 | 185 |
172 // Notification that the request to lock the mouse has completed. | 186 // Notification that the request to lock the mouse has completed. |
173 void OnLockMouseACK(bool succeeded); | 187 void OnLockMouseACK(bool succeeded); |
174 // Notification that the plugin instance has lost the mouse lock. | 188 // Notification that the plugin instance has lost the mouse lock. |
175 void OnMouseLockLost(); | 189 void OnMouseLockLost(); |
176 // Notification that a mouse event has arrived at the render view. | 190 // Notification that a mouse event has arrived at the render view. |
177 // Returns true if no further handling is needed. For example, if the mouse is | 191 // Returns true if no further handling is needed. For example, if the mouse is |
178 // currently locked, this method directly dispatches the event to the owner of | 192 // currently locked, this method directly dispatches the event to the owner of |
179 // the mouse lock and returns true. | 193 // the mouse lock and returns true. |
180 bool HandleMouseEvent(const WebKit::WebMouseEvent& event); | 194 bool HandleMouseEvent(const WebKit::WebMouseEvent& event); |
181 | 195 |
182 // PluginDelegate implementation. | 196 // PluginDelegate implementation. |
183 virtual void PluginFocusChanged(bool focused) OVERRIDE; | 197 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, |
| 198 bool focused) OVERRIDE; |
| 199 virtual void PluginTextInputTypeChanged( |
| 200 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 201 virtual void PluginRequestedCancelComposition( |
| 202 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
184 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); | 203 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); |
185 virtual void InstanceCreated( | 204 virtual void InstanceCreated( |
186 webkit::ppapi::PluginInstance* instance); | 205 webkit::ppapi::PluginInstance* instance); |
187 virtual void InstanceDeleted( | 206 virtual void InstanceDeleted( |
188 webkit::ppapi::PluginInstance* instance); | 207 webkit::ppapi::PluginInstance* instance); |
189 virtual SkBitmap* GetSadPluginBitmap(); | 208 virtual SkBitmap* GetSadPluginBitmap(); |
190 virtual PlatformAudio* CreateAudio( | 209 virtual PlatformAudio* CreateAudio( |
191 uint32_t sample_rate, | 210 uint32_t sample_rate, |
192 uint32_t sample_count, | 211 uint32_t sample_count, |
193 PlatformAudio::Client* client); | 212 PlatformAudio::Client* client); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_NetConnector_Impl>, | 371 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_NetConnector_Impl>, |
353 IDMapOwnPointer> pending_connect_tcps_; | 372 IDMapOwnPointer> pending_connect_tcps_; |
354 | 373 |
355 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>, | 374 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>, |
356 IDMapOwnPointer> pending_context_menus_; | 375 IDMapOwnPointer> pending_context_menus_; |
357 | 376 |
358 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; | 377 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; |
359 BrokerMap pending_connect_broker_; | 378 BrokerMap pending_connect_broker_; |
360 | 379 |
361 // Whether or not the focus is on a PPAPI plugin | 380 // Whether or not the focus is on a PPAPI plugin |
362 bool is_pepper_plugin_focused_; | 381 webkit::ppapi::PluginInstance* focused_plugin_; |
| 382 |
| 383 // Current text input composition text. Empty if no composition is in |
| 384 // progress. |
| 385 string16 composition_text_; |
363 | 386 |
364 // Set of instances to receive a notification when the enterprise policy has | 387 // Set of instances to receive a notification when the enterprise policy has |
365 // been updated. | 388 // been updated. |
366 std::set<webkit::ppapi::PluginInstance*> subscribed_to_policy_updates_; | 389 std::set<webkit::ppapi::PluginInstance*> subscribed_to_policy_updates_; |
367 | 390 |
368 // |mouse_lock_owner_| is not owned by this class. We can know about when it | 391 // |mouse_lock_owner_| is not owned by this class. We can know about when it |
369 // is destroyed via InstanceDeleted(). | 392 // is destroyed via InstanceDeleted(). |
370 // |mouse_lock_owner_| being non-NULL doesn't indicate that currently the | 393 // |mouse_lock_owner_| being non-NULL doesn't indicate that currently the |
371 // mouse has been locked. It is possible that a request to lock the mouse has | 394 // mouse has been locked. It is possible that a request to lock the mouse has |
372 // been sent, but the response hasn't arrived yet. | 395 // been sent, but the response hasn't arrived yet. |
(...skipping 10 matching lines...) Expand all Loading... |
383 // The plugin instance that received the last mouse event. It is set to NULL | 406 // The plugin instance that received the last mouse event. It is set to NULL |
384 // if the last mouse event went to elements other than Pepper plugins. | 407 // if the last mouse event went to elements other than Pepper plugins. |
385 // |last_mouse_event_target_| is not owned by this class. We can know about | 408 // |last_mouse_event_target_| is not owned by this class. We can know about |
386 // when it is destroyed via InstanceDeleted(). | 409 // when it is destroyed via InstanceDeleted(). |
387 webkit::ppapi::PluginInstance* last_mouse_event_target_; | 410 webkit::ppapi::PluginInstance* last_mouse_event_target_; |
388 | 411 |
389 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 412 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
390 }; | 413 }; |
391 | 414 |
392 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 415 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |