| 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 WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 19 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
| 20 #include "ppapi/c/dev/ppp_printing_dev.h" | 20 #include "ppapi/c/dev/ppp_printing_dev.h" |
| 21 #include "ppapi/c/pp_completion_callback.h" | 21 #include "ppapi/c/pp_completion_callback.h" |
| 22 #include "ppapi/c/pp_instance.h" | 22 #include "ppapi/c/pp_instance.h" |
| 23 #include "ppapi/c/pp_resource.h" | 23 #include "ppapi/c/pp_resource.h" |
| 24 #include "ppapi/c/pp_var.h" | 24 #include "ppapi/c/pp_var.h" |
| 25 #include "ppapi/c/ppb_input_event.h" |
| 25 #include "ppapi/c/ppp_graphics_3d.h" | 26 #include "ppapi/c/ppp_graphics_3d.h" |
| 26 #include "ppapi/c/ppp_instance.h" | 27 #include "ppapi/c/ppp_instance.h" |
| 27 #include "ppapi/shared_impl/function_group_base.h" | 28 #include "ppapi/shared_impl/function_group_base.h" |
| 28 #include "ppapi/shared_impl/instance_impl.h" | 29 #include "ppapi/shared_impl/instance_impl.h" |
| 29 #include "ppapi/shared_impl/ppp_instance_combined.h" | 30 #include "ppapi/shared_impl/ppp_instance_combined.h" |
| 30 #include "ppapi/thunk/ppb_instance_api.h" | 31 #include "ppapi/thunk/ppb_instance_api.h" |
| 31 #include "third_party/skia/include/core/SkBitmap.h" | 32 #include "third_party/skia/include/core/SkBitmap.h" |
| 32 #include "third_party/skia/include/core/SkRefCnt.h" | 33 #include "third_party/skia/include/core/SkRefCnt.h" |
| 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" |
| 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" |
| 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 34 #include "ui/gfx/rect.h" | 37 #include "ui/gfx/rect.h" |
| 35 #include "webkit/plugins/ppapi/plugin_delegate.h" | 38 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 36 | 39 |
| 37 struct PP_Var; | 40 struct PP_Var; |
| 38 struct PPP_Find_Dev; | 41 struct PPP_Find_Dev; |
| 39 struct PPP_InputEvent; | 42 struct PPP_InputEvent; |
| 40 struct PPP_Instance_Private; | 43 struct PPP_Instance_Private; |
| 41 struct PPP_Messaging; | 44 struct PPP_Messaging; |
| 42 struct PPP_MouseLock_Dev; | 45 struct PPP_MouseLock_Dev; |
| 43 struct PPP_Pdf; | 46 struct PPP_Pdf; |
| 44 struct PPP_PolicyUpdate_Dev; | 47 struct PPP_PolicyUpdate_Dev; |
| 45 struct PPP_Selection_Dev; | 48 struct PPP_Selection_Dev; |
| 46 struct PPP_Zoom_Dev; | 49 struct PPP_Zoom_Dev; |
| 47 | 50 |
| 48 class SkBitmap; | 51 class SkBitmap; |
| 49 class TransportDIB; | 52 class TransportDIB; |
| 50 | 53 |
| 51 namespace gfx { | 54 namespace gfx { |
| 52 class Rect; | 55 class Rect; |
| 53 } | 56 } |
| 54 | 57 |
| 55 namespace WebKit { | 58 namespace WebKit { |
| 56 struct WebCursorInfo; | 59 struct WebCursorInfo; |
| 57 class WebInputEvent; | 60 class WebInputEvent; |
| 58 class WebPluginContainer; | 61 class WebPluginContainer; |
| 62 struct WebCompositionUnderline; |
| 59 } | 63 } |
| 60 | 64 |
| 61 namespace ppapi { | 65 namespace ppapi { |
| 62 struct PPP_Instance_Combined; | 66 struct PPP_Instance_Combined; |
| 63 class Resource; | 67 class Resource; |
| 64 } | 68 } |
| 65 | 69 |
| 66 namespace webkit { | 70 namespace webkit { |
| 67 namespace ppapi { | 71 namespace ppapi { |
| 68 | 72 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 const std::vector<std::string>& arg_values, | 164 const std::vector<std::string>& arg_values, |
| 161 const GURL& plugin_url, | 165 const GURL& plugin_url, |
| 162 bool full_frame); | 166 bool full_frame); |
| 163 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); | 167 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); |
| 164 bool HandleInputEvent(const WebKit::WebInputEvent& event, | 168 bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| 165 WebKit::WebCursorInfo* cursor_info); | 169 WebKit::WebCursorInfo* cursor_info); |
| 166 void HandlePolicyUpdate(const std::string& policy_json); | 170 void HandlePolicyUpdate(const std::string& policy_json); |
| 167 PP_Var GetInstanceObject(); | 171 PP_Var GetInstanceObject(); |
| 168 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); | 172 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); |
| 169 | 173 |
| 174 // Handlers for composition events. |
| 175 bool HandleCompositionStart(const string16& text); |
| 176 bool HandleCompositionUpdate( |
| 177 const string16& text, |
| 178 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 179 int selection_start, |
| 180 int selection_end); |
| 181 bool HandleCompositionEnd(const string16& text); |
| 182 bool HandleTextInput(const string16& text); |
| 183 |
| 184 // Implementation of composition API. |
| 185 void UpdateCaretPosition(const PP_Rect& caret, const PP_Rect& boundingBox); |
| 186 void SetTextInputType(WebKit::WebTextInputType type); |
| 187 |
| 188 // Gets the current text input status. |
| 189 WebKit::WebTextInputType text_input_type() const { return text_input_type_; } |
| 190 WebKit::WebRect GetCaretBounds() const; |
| 191 bool CanComposeInline() const; |
| 192 |
| 170 // Notifications about focus changes, see has_webkit_focus_ below. | 193 // Notifications about focus changes, see has_webkit_focus_ below. |
| 171 void SetWebKitFocus(bool has_focus); | 194 void SetWebKitFocus(bool has_focus); |
| 172 void SetContentAreaFocus(bool has_focus); | 195 void SetContentAreaFocus(bool has_focus); |
| 173 | 196 |
| 174 // Notifications that the view has rendered the page and that it has been | 197 // Notifications that the view has rendered the page and that it has been |
| 175 // flushed to the screen. These messages are used to send Flush callbacks to | 198 // flushed to the screen. These messages are used to send Flush callbacks to |
| 176 // the plugin for DeviceContext2D. | 199 // the plugin for DeviceContext2D. |
| 177 void ViewInitiatedPaint(); | 200 void ViewInitiatedPaint(); |
| 178 void ViewFlushedPaint(); | 201 void ViewFlushedPaint(); |
| 179 | 202 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 // A value of zero indicates the plugin is not backed by a texture. | 381 // A value of zero indicates the plugin is not backed by a texture. |
| 359 void setBackingTextureId(unsigned int id); | 382 void setBackingTextureId(unsigned int id); |
| 360 | 383 |
| 361 // Internal helper function for PrintPage(). | 384 // Internal helper function for PrintPage(). |
| 362 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, | 385 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
| 363 int num_ranges, | 386 int num_ranges, |
| 364 WebKit::WebCanvas* canvas); | 387 WebKit::WebCanvas* canvas); |
| 365 | 388 |
| 366 void DoSetCursor(WebKit::WebCursorInfo* cursor); | 389 void DoSetCursor(WebKit::WebCursorInfo* cursor); |
| 367 | 390 |
| 391 // Internal helper functions for HandleCompositionXXX(). |
| 392 bool SendCompositionEventToPlugin( |
| 393 PP_InputEvent_Type type, |
| 394 const string16& text); |
| 395 bool SendCompositionEventWithUnderlineInformationToPlugin( |
| 396 PP_InputEvent_Type type, |
| 397 const string16& text, |
| 398 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 399 int selection_start, |
| 400 int selection_end); |
| 401 |
| 368 PluginDelegate* delegate_; | 402 PluginDelegate* delegate_; |
| 369 scoped_refptr<PluginModule> module_; | 403 scoped_refptr<PluginModule> module_; |
| 370 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; | 404 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; |
| 371 | 405 |
| 372 PP_Instance pp_instance_; | 406 PP_Instance pp_instance_; |
| 373 | 407 |
| 374 // NULL until we have been initialized. | 408 // NULL until we have been initialized. |
| 375 WebKit::WebPluginContainer* container_; | 409 WebKit::WebPluginContainer* container_; |
| 376 | 410 |
| 377 // Plugin URL. | 411 // Plugin URL. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 SkBitmap* sad_plugin_; | 512 SkBitmap* sad_plugin_; |
| 479 | 513 |
| 480 typedef std::set<PluginObject*> PluginObjectSet; | 514 typedef std::set<PluginObject*> PluginObjectSet; |
| 481 PluginObjectSet live_plugin_objects_; | 515 PluginObjectSet live_plugin_objects_; |
| 482 | 516 |
| 483 // Classes of events that the plugin has registered for, both for filtering | 517 // Classes of events that the plugin has registered for, both for filtering |
| 484 // and not. The bits are PP_INPUTEVENT_CLASS_*. | 518 // and not. The bits are PP_INPUTEVENT_CLASS_*. |
| 485 uint32_t input_event_mask_; | 519 uint32_t input_event_mask_; |
| 486 uint32_t filtered_input_event_mask_; | 520 uint32_t filtered_input_event_mask_; |
| 487 | 521 |
| 522 // Text composition status. |
| 523 WebKit::WebTextInputType text_input_type_; |
| 524 PP_Rect text_input_caret_; |
| 525 PP_Rect text_input_caret_bounds_; |
| 526 bool text_input_caret_set_; |
| 527 |
| 488 PP_CompletionCallback lock_mouse_callback_; | 528 PP_CompletionCallback lock_mouse_callback_; |
| 489 | 529 |
| 490 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 530 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 491 }; | 531 }; |
| 492 | 532 |
| 493 } // namespace ppapi | 533 } // namespace ppapi |
| 494 } // namespace webkit | 534 } // namespace webkit |
| 495 | 535 |
| 496 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 536 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |