| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // A value of zero indicates the plugin is not backed by a texture. | 411 // A value of zero indicates the plugin is not backed by a texture. |
| 393 void setBackingTextureId(unsigned int id); | 412 void setBackingTextureId(unsigned int id); |
| 394 | 413 |
| 395 // Internal helper function for PrintPage(). | 414 // Internal helper function for PrintPage(). |
| 396 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, | 415 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
| 397 int num_ranges, | 416 int num_ranges, |
| 398 WebKit::WebCanvas* canvas); | 417 WebKit::WebCanvas* canvas); |
| 399 | 418 |
| 400 void DoSetCursor(WebKit::WebCursorInfo* cursor); | 419 void DoSetCursor(WebKit::WebCursorInfo* cursor); |
| 401 | 420 |
| 421 // Internal helper functions for HandleCompositionXXX(). |
| 422 bool SendCompositionEventToPlugin( |
| 423 PP_InputEvent_Type type, |
| 424 const string16& text); |
| 425 bool SendCompositionEventWithUnderlineInformationToPlugin( |
| 426 PP_InputEvent_Type type, |
| 427 const string16& text, |
| 428 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 429 int selection_start, |
| 430 int selection_end); |
| 431 |
| 402 // Checks if the security origin of the document containing this instance can | 432 // Checks if the security origin of the document containing this instance can |
| 403 // assess the security origin of the main frame document. | 433 // assess the security origin of the main frame document. |
| 404 bool CanAccessMainFrame() const; | 434 bool CanAccessMainFrame() const; |
| 405 | 435 |
| 406 // Returns true if the WebView the plugin is in renders via the accelerated | 436 // Returns true if the WebView the plugin is in renders via the accelerated |
| 407 // compositing path. | 437 // compositing path. |
| 408 bool IsViewAccelerated(); | 438 bool IsViewAccelerated(); |
| 409 | 439 |
| 410 PluginDelegate* delegate_; | 440 PluginDelegate* delegate_; |
| 411 scoped_refptr<PluginModule> module_; | 441 scoped_refptr<PluginModule> module_; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 SkBitmap* sad_plugin_; | 565 SkBitmap* sad_plugin_; |
| 536 | 566 |
| 537 typedef std::set<PluginObject*> PluginObjectSet; | 567 typedef std::set<PluginObject*> PluginObjectSet; |
| 538 PluginObjectSet live_plugin_objects_; | 568 PluginObjectSet live_plugin_objects_; |
| 539 | 569 |
| 540 // Classes of events that the plugin has registered for, both for filtering | 570 // Classes of events that the plugin has registered for, both for filtering |
| 541 // and not. The bits are PP_INPUTEVENT_CLASS_*. | 571 // and not. The bits are PP_INPUTEVENT_CLASS_*. |
| 542 uint32_t input_event_mask_; | 572 uint32_t input_event_mask_; |
| 543 uint32_t filtered_input_event_mask_; | 573 uint32_t filtered_input_event_mask_; |
| 544 | 574 |
| 575 // Text composition status. |
| 576 ui::TextInputType text_input_type_; |
| 577 gfx::Rect text_input_caret_; |
| 578 gfx::Rect text_input_caret_bounds_; |
| 579 bool text_input_caret_set_; |
| 580 |
| 545 PP_CompletionCallback lock_mouse_callback_; | 581 PP_CompletionCallback lock_mouse_callback_; |
| 546 | 582 |
| 547 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 583 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 548 }; | 584 }; |
| 549 | 585 |
| 550 } // namespace ppapi | 586 } // namespace ppapi |
| 551 } // namespace webkit | 587 } // namespace webkit |
| 552 | 588 |
| 553 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 589 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |