| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const std::vector<std::string>& arg_values, | 166 const std::vector<std::string>& arg_values, |
| 163 const GURL& plugin_url, | 167 const GURL& plugin_url, |
| 164 bool full_frame); | 168 bool full_frame); |
| 165 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); | 169 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); |
| 166 bool HandleInputEvent(const WebKit::WebInputEvent& event, | 170 bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| 167 WebKit::WebCursorInfo* cursor_info); | 171 WebKit::WebCursorInfo* cursor_info); |
| 168 void HandlePolicyUpdate(const std::string& policy_json); | 172 void HandlePolicyUpdate(const std::string& policy_json); |
| 169 PP_Var GetInstanceObject(); | 173 PP_Var GetInstanceObject(); |
| 170 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); | 174 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); |
| 171 | 175 |
| 176 // Handlers for composition events. |
| 177 bool HandleCompositionStart(const string16& text); |
| 178 bool HandleCompositionUpdate( |
| 179 const string16& text, |
| 180 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 181 int selection_start, |
| 182 int selection_end); |
| 183 bool HandleCompositionEnd(const string16& text); |
| 184 bool HandleTextInput(const string16& text); |
| 185 |
| 186 // Implementation of composition API. |
| 187 void UpdateCaretPosition(const PP_Rect& caret, const PP_Rect& boundingBox); |
| 188 void SetTextInputType(WebKit::WebTextInputType type); |
| 189 |
| 190 // Gets the current text input status. |
| 191 WebKit::WebTextInputType text_input_type() const { return text_input_type_; } |
| 192 WebKit::WebRect GetCaretBounds() const; |
| 193 bool CanComposeInline() const; |
| 194 |
| 172 // Notifications about focus changes, see has_webkit_focus_ below. | 195 // Notifications about focus changes, see has_webkit_focus_ below. |
| 173 void SetWebKitFocus(bool has_focus); | 196 void SetWebKitFocus(bool has_focus); |
| 174 void SetContentAreaFocus(bool has_focus); | 197 void SetContentAreaFocus(bool has_focus); |
| 175 | 198 |
| 176 // Notifications that the view has rendered the page and that it has been | 199 // Notifications that the view has rendered the page and that it has been |
| 177 // flushed to the screen. These messages are used to send Flush callbacks to | 200 // flushed to the screen. These messages are used to send Flush callbacks to |
| 178 // the plugin for DeviceContext2D. | 201 // the plugin for DeviceContext2D. |
| 179 void ViewInitiatedPaint(); | 202 void ViewInitiatedPaint(); |
| 180 void ViewFlushedPaint(); | 203 void ViewFlushedPaint(); |
| 181 | 204 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // A value of zero indicates the plugin is not backed by a texture. | 370 // A value of zero indicates the plugin is not backed by a texture. |
| 348 void setBackingTextureId(unsigned int id); | 371 void setBackingTextureId(unsigned int id); |
| 349 | 372 |
| 350 // Internal helper function for PrintPage(). | 373 // Internal helper function for PrintPage(). |
| 351 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, | 374 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
| 352 int num_ranges, | 375 int num_ranges, |
| 353 WebKit::WebCanvas* canvas); | 376 WebKit::WebCanvas* canvas); |
| 354 | 377 |
| 355 void DoSetCursor(WebKit::WebCursorInfo* cursor); | 378 void DoSetCursor(WebKit::WebCursorInfo* cursor); |
| 356 | 379 |
| 380 // Internal helper functions for HandleCompositionXXX(). |
| 381 bool SendCompositionEventToPlugin( |
| 382 PP_InputEvent_Type type, |
| 383 const string16& text); |
| 384 bool SendCompositionEventWithUnderlineInformationToPlugin( |
| 385 PP_InputEvent_Type type, |
| 386 const string16& text, |
| 387 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 388 int selection_start, |
| 389 int selection_end); |
| 390 |
| 357 PluginDelegate* delegate_; | 391 PluginDelegate* delegate_; |
| 358 scoped_refptr<PluginModule> module_; | 392 scoped_refptr<PluginModule> module_; |
| 359 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; | 393 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; |
| 360 | 394 |
| 361 PP_Instance pp_instance_; | 395 PP_Instance pp_instance_; |
| 362 | 396 |
| 363 // NULL until we have been initialized. | 397 // NULL until we have been initialized. |
| 364 WebKit::WebPluginContainer* container_; | 398 WebKit::WebPluginContainer* container_; |
| 365 | 399 |
| 366 // Plugin URL. | 400 // Plugin URL. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 SkBitmap* sad_plugin_; | 501 SkBitmap* sad_plugin_; |
| 468 | 502 |
| 469 typedef std::set<PluginObject*> PluginObjectSet; | 503 typedef std::set<PluginObject*> PluginObjectSet; |
| 470 PluginObjectSet live_plugin_objects_; | 504 PluginObjectSet live_plugin_objects_; |
| 471 | 505 |
| 472 // Classes of events that the plugin has registered for, both for filtering | 506 // Classes of events that the plugin has registered for, both for filtering |
| 473 // and not. The bits are PP_INPUTEVENT_CLASS_*. | 507 // and not. The bits are PP_INPUTEVENT_CLASS_*. |
| 474 uint32_t input_event_mask_; | 508 uint32_t input_event_mask_; |
| 475 uint32_t filtered_input_event_mask_; | 509 uint32_t filtered_input_event_mask_; |
| 476 | 510 |
| 511 // Text composition status. |
| 512 WebKit::WebTextInputType text_input_type_; |
| 513 PP_Rect text_input_caret_; |
| 514 PP_Rect text_input_caret_bounds_; |
| 515 bool text_input_caret_set_; |
| 516 |
| 477 PP_CompletionCallback lock_mouse_callback_; | 517 PP_CompletionCallback lock_mouse_callback_; |
| 478 | 518 |
| 479 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 519 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 480 }; | 520 }; |
| 481 | 521 |
| 482 } // namespace ppapi | 522 } // namespace ppapi |
| 483 } // namespace webkit | 523 } // namespace webkit |
| 484 | 524 |
| 485 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 525 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |