| 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 "ui/base/ime/text_input_type.h" |
| 34 #include "ui/gfx/rect.h" | 36 #include "ui/gfx/rect.h" |
| 35 #include "webkit/plugins/ppapi/plugin_delegate.h" | 37 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 36 | 38 |
| 37 struct PP_Var; | 39 struct PP_Var; |
| 38 struct PPP_Find_Dev; | 40 struct PPP_Find_Dev; |
| 39 struct PPP_InputEvent; | 41 struct PPP_InputEvent; |
| 40 struct PPP_Instance_Private; | 42 struct PPP_Instance_Private; |
| 41 struct PPP_Messaging; | 43 struct PPP_Messaging; |
| 42 struct PPP_MouseLock_Dev; | 44 struct PPP_MouseLock_Dev; |
| 43 struct PPP_Pdf; | 45 struct PPP_Pdf; |
| 44 struct PPP_PolicyUpdate_Dev; | 46 struct PPP_PolicyUpdate_Dev; |
| 45 struct PPP_Selection_Dev; | 47 struct PPP_Selection_Dev; |
| 46 struct PPP_Zoom_Dev; | 48 struct PPP_Zoom_Dev; |
| 47 | 49 |
| 48 class SkBitmap; | 50 class SkBitmap; |
| 49 class TransportDIB; | 51 class TransportDIB; |
| 50 | 52 |
| 51 namespace gfx { | |
| 52 class Rect; | |
| 53 } | |
| 54 | |
| 55 namespace WebKit { | 53 namespace WebKit { |
| 56 struct WebCursorInfo; | |
| 57 class WebInputEvent; | 54 class WebInputEvent; |
| 58 class WebPluginContainer; | 55 class WebPluginContainer; |
| 56 struct WebCompositionUnderline; |
| 57 struct WebCursorInfo; |
| 59 } | 58 } |
| 60 | 59 |
| 61 namespace ppapi { | 60 namespace ppapi { |
| 62 struct PPP_Instance_Combined; | 61 struct PPP_Instance_Combined; |
| 63 class Resource; | 62 class Resource; |
| 64 } | 63 } |
| 65 | 64 |
| 66 namespace webkit { | 65 namespace webkit { |
| 67 namespace ppapi { | 66 namespace ppapi { |
| 68 | 67 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 const std::vector<std::string>& arg_values, | 159 const std::vector<std::string>& arg_values, |
| 161 const GURL& plugin_url, | 160 const GURL& plugin_url, |
| 162 bool full_frame); | 161 bool full_frame); |
| 163 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); | 162 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); |
| 164 bool HandleInputEvent(const WebKit::WebInputEvent& event, | 163 bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| 165 WebKit::WebCursorInfo* cursor_info); | 164 WebKit::WebCursorInfo* cursor_info); |
| 166 void HandlePolicyUpdate(const std::string& policy_json); | 165 void HandlePolicyUpdate(const std::string& policy_json); |
| 167 PP_Var GetInstanceObject(); | 166 PP_Var GetInstanceObject(); |
| 168 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); | 167 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); |
| 169 | 168 |
| 169 // Handlers for composition events. |
| 170 bool HandleCompositionStart(const string16& text); |
| 171 bool HandleCompositionUpdate( |
| 172 const string16& text, |
| 173 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 174 int selection_start, |
| 175 int selection_end); |
| 176 bool HandleCompositionEnd(const string16& text); |
| 177 bool HandleTextInput(const string16& text); |
| 178 |
| 179 // Implementation of composition API. |
| 180 void UpdateCaretPosition(const gfx::Rect& caret, |
| 181 const gfx::Rect& bounding_box); |
| 182 void SetTextInputType(ui::TextInputType type); |
| 183 |
| 184 // Gets the current text input status. |
| 185 ui::TextInputType text_input_type() const { return text_input_type_; } |
| 186 gfx::Rect GetCaretBounds() const; |
| 187 bool IsPluginAcceptingCompositionEvents() const; |
| 188 |
| 170 // Notifications about focus changes, see has_webkit_focus_ below. | 189 // Notifications about focus changes, see has_webkit_focus_ below. |
| 171 void SetWebKitFocus(bool has_focus); | 190 void SetWebKitFocus(bool has_focus); |
| 172 void SetContentAreaFocus(bool has_focus); | 191 void SetContentAreaFocus(bool has_focus); |
| 173 | 192 |
| 174 // Notifications that the view has rendered the page and that it has been | 193 // 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 | 194 // flushed to the screen. These messages are used to send Flush callbacks to |
| 176 // the plugin for DeviceContext2D. | 195 // the plugin for DeviceContext2D. |
| 177 void ViewInitiatedPaint(); | 196 void ViewInitiatedPaint(); |
| 178 void ViewFlushedPaint(); | 197 void ViewFlushedPaint(); |
| 179 | 198 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // A value of zero indicates the plugin is not backed by a texture. | 424 // A value of zero indicates the plugin is not backed by a texture. |
| 406 void setBackingTextureId(unsigned int id); | 425 void setBackingTextureId(unsigned int id); |
| 407 | 426 |
| 408 // Internal helper function for PrintPage(). | 427 // Internal helper function for PrintPage(). |
| 409 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, | 428 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
| 410 int num_ranges, | 429 int num_ranges, |
| 411 WebKit::WebCanvas* canvas); | 430 WebKit::WebCanvas* canvas); |
| 412 | 431 |
| 413 void DoSetCursor(WebKit::WebCursorInfo* cursor); | 432 void DoSetCursor(WebKit::WebCursorInfo* cursor); |
| 414 | 433 |
| 434 // Internal helper functions for HandleCompositionXXX(). |
| 435 bool SendCompositionEventToPlugin( |
| 436 PP_InputEvent_Type type, |
| 437 const string16& text); |
| 438 bool SendCompositionEventWithUnderlineInformationToPlugin( |
| 439 PP_InputEvent_Type type, |
| 440 const string16& text, |
| 441 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 442 int selection_start, |
| 443 int selection_end); |
| 444 |
| 415 // Checks if the security origin of the document containing this instance can | 445 // Checks if the security origin of the document containing this instance can |
| 416 // assess the security origin of the main frame document. | 446 // assess the security origin of the main frame document. |
| 417 bool CanAccessMainFrame() const; | 447 bool CanAccessMainFrame() const; |
| 418 | 448 |
| 419 // Returns true if the WebView the plugin is in renders via the accelerated | 449 // Returns true if the WebView the plugin is in renders via the accelerated |
| 420 // compositing path. | 450 // compositing path. |
| 421 bool IsViewAccelerated(); | 451 bool IsViewAccelerated(); |
| 422 | 452 |
| 423 PluginDelegate* delegate_; | 453 PluginDelegate* delegate_; |
| 424 scoped_refptr<PluginModule> module_; | 454 scoped_refptr<PluginModule> module_; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 SkBitmap* sad_plugin_; | 578 SkBitmap* sad_plugin_; |
| 549 | 579 |
| 550 typedef std::set<PluginObject*> PluginObjectSet; | 580 typedef std::set<PluginObject*> PluginObjectSet; |
| 551 PluginObjectSet live_plugin_objects_; | 581 PluginObjectSet live_plugin_objects_; |
| 552 | 582 |
| 553 // Classes of events that the plugin has registered for, both for filtering | 583 // Classes of events that the plugin has registered for, both for filtering |
| 554 // and not. The bits are PP_INPUTEVENT_CLASS_*. | 584 // and not. The bits are PP_INPUTEVENT_CLASS_*. |
| 555 uint32_t input_event_mask_; | 585 uint32_t input_event_mask_; |
| 556 uint32_t filtered_input_event_mask_; | 586 uint32_t filtered_input_event_mask_; |
| 557 | 587 |
| 588 // Text composition status. |
| 589 ui::TextInputType text_input_type_; |
| 590 gfx::Rect text_input_caret_; |
| 591 gfx::Rect text_input_caret_bounds_; |
| 592 bool text_input_caret_set_; |
| 593 |
| 558 PP_CompletionCallback lock_mouse_callback_; | 594 PP_CompletionCallback lock_mouse_callback_; |
| 559 | 595 |
| 560 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 596 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 561 }; | 597 }; |
| 562 | 598 |
| 563 } // namespace ppapi | 599 } // namespace ppapi |
| 564 } // namespace webkit | 600 } // namespace webkit |
| 565 | 601 |
| 566 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 602 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |