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 RenderView; | 27 class RenderView; |
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 // Dispatches mouse events directly to the owner of the mouse lock. | 190 // Dispatches mouse events directly to the owner of the mouse lock. |
177 // True indicates currently the mouse is locked and the event has been | 191 // True indicates currently the mouse is locked and the event has been |
178 // dispatched to the owner. | 192 // dispatched to the owner. |
179 bool DispatchLockedMouseEvent(const WebKit::WebMouseEvent& event); | 193 bool DispatchLockedMouseEvent(const WebKit::WebMouseEvent& event); |
180 | 194 |
181 // PluginDelegate implementation. | 195 // PluginDelegate implementation. |
182 virtual void PluginFocusChanged(bool focused) OVERRIDE; | 196 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, |
| 197 bool focused) OVERRIDE; |
| 198 virtual void PluginTextInputTypeChanged( |
| 199 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 200 virtual void PluginRequestedCancelComposition( |
| 201 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
183 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); | 202 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); |
184 virtual void InstanceCreated( | 203 virtual void InstanceCreated( |
185 webkit::ppapi::PluginInstance* instance); | 204 webkit::ppapi::PluginInstance* instance); |
186 virtual void InstanceDeleted( | 205 virtual void InstanceDeleted( |
187 webkit::ppapi::PluginInstance* instance); | 206 webkit::ppapi::PluginInstance* instance); |
188 virtual SkBitmap* GetSadPluginBitmap(); | 207 virtual SkBitmap* GetSadPluginBitmap(); |
189 virtual PlatformAudio* CreateAudio( | 208 virtual PlatformAudio* CreateAudio( |
190 uint32_t sample_rate, | 209 uint32_t sample_rate, |
191 uint32_t sample_count, | 210 uint32_t sample_count, |
192 PlatformAudio::Client* client); | 211 PlatformAudio::Client* client); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_NetConnector_Impl>, | 368 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_NetConnector_Impl>, |
350 IDMapOwnPointer> pending_connect_tcps_; | 369 IDMapOwnPointer> pending_connect_tcps_; |
351 | 370 |
352 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>, | 371 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>, |
353 IDMapOwnPointer> pending_context_menus_; | 372 IDMapOwnPointer> pending_context_menus_; |
354 | 373 |
355 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; | 374 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; |
356 BrokerMap pending_connect_broker_; | 375 BrokerMap pending_connect_broker_; |
357 | 376 |
358 // Whether or not the focus is on a PPAPI plugin | 377 // Whether or not the focus is on a PPAPI plugin |
359 bool is_pepper_plugin_focused_; | 378 webkit::ppapi::PluginInstance* focused_plugin_; |
| 379 |
| 380 // Current text input composition text. Empty if no composition is in |
| 381 // progress. |
| 382 string16 composition_text_; |
360 | 383 |
361 // Set of instances to receive a notification when the enterprise policy has | 384 // Set of instances to receive a notification when the enterprise policy has |
362 // been updated. | 385 // been updated. |
363 std::set<webkit::ppapi::PluginInstance*> subscribed_to_policy_updates_; | 386 std::set<webkit::ppapi::PluginInstance*> subscribed_to_policy_updates_; |
364 | 387 |
365 // |mouse_lock_owner_| is not owned by this class. We can know about when it | 388 // |mouse_lock_owner_| is not owned by this class. We can know about when it |
366 // is destroyed via InstanceDeleted(). | 389 // is destroyed via InstanceDeleted(). |
367 // |mouse_lock_owner_| being non-NULL doesn't indicate that currently the | 390 // |mouse_lock_owner_| being non-NULL doesn't indicate that currently the |
368 // mouse has been locked. It is possible that a request to lock the mouse has | 391 // mouse has been locked. It is possible that a request to lock the mouse has |
369 // been sent, but the response hasn't arrived yet. | 392 // been sent, but the response hasn't arrived yet. |
370 webkit::ppapi::PluginInstance* mouse_lock_owner_; | 393 webkit::ppapi::PluginInstance* mouse_lock_owner_; |
371 bool mouse_locked_; | 394 bool mouse_locked_; |
372 // If both |pending_lock_request_| and |pending_unlock_request_| are true, | 395 // If both |pending_lock_request_| and |pending_unlock_request_| are true, |
373 // it means a lock request was sent before an unlock request and we haven't | 396 // it means a lock request was sent before an unlock request and we haven't |
374 // received responses for them. | 397 // received responses for them. |
375 // The logic in LockMouse() makes sure that a lock request won't be sent when | 398 // The logic in LockMouse() makes sure that a lock request won't be sent when |
376 // there is a pending unlock request. | 399 // there is a pending unlock request. |
377 bool pending_lock_request_; | 400 bool pending_lock_request_; |
378 bool pending_unlock_request_; | 401 bool pending_unlock_request_; |
379 | 402 |
380 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 403 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
381 }; | 404 }; |
382 | 405 |
383 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 406 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |