| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/string16.h" | 16 #include "base/string16.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 18 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
| 19 #include "ppapi/c/dev/ppp_printing_dev.h" | 19 #include "ppapi/c/dev/ppp_printing_dev.h" |
| 20 #include "ppapi/c/dev/ppp_find_dev.h" | 20 #include "ppapi/c/dev/ppp_find_dev.h" |
| 21 #include "ppapi/c/dev/ppp_selection_dev.h" | 21 #include "ppapi/c/dev/ppp_selection_dev.h" |
| 22 #include "ppapi/c/dev/ppp_text_input_dev.h" |
| 22 #include "ppapi/c/dev/ppp_zoom_dev.h" | 23 #include "ppapi/c/dev/ppp_zoom_dev.h" |
| 23 #include "ppapi/c/pp_completion_callback.h" | 24 #include "ppapi/c/pp_completion_callback.h" |
| 24 #include "ppapi/c/pp_instance.h" | 25 #include "ppapi/c/pp_instance.h" |
| 25 #include "ppapi/c/pp_resource.h" | 26 #include "ppapi/c/pp_resource.h" |
| 26 #include "ppapi/c/pp_time.h" | 27 #include "ppapi/c/pp_time.h" |
| 27 #include "ppapi/c/pp_var.h" | 28 #include "ppapi/c/pp_var.h" |
| 28 #include "ppapi/c/ppb_audio_config.h" | 29 #include "ppapi/c/ppb_audio_config.h" |
| 29 #include "ppapi/c/ppb_input_event.h" | 30 #include "ppapi/c/ppb_input_event.h" |
| 30 #include "ppapi/c/ppb_gamepad.h" | 31 #include "ppapi/c/ppb_gamepad.h" |
| 31 #include "ppapi/c/ppp_graphics_3d.h" | 32 #include "ppapi/c/ppp_graphics_3d.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 struct WebCompositionUnderline; | 59 struct WebCompositionUnderline; |
| 59 struct WebCursorInfo; | 60 struct WebCursorInfo; |
| 60 } | 61 } |
| 61 | 62 |
| 62 namespace ppapi { | 63 namespace ppapi { |
| 63 struct InputEventData; | 64 struct InputEventData; |
| 64 struct PPP_Instance_Combined; | 65 struct PPP_Instance_Combined; |
| 65 class Resource; | 66 class Resource; |
| 66 } | 67 } |
| 67 | 68 |
| 69 namespace ui { |
| 70 class Range; |
| 71 } |
| 72 |
| 68 namespace webkit { | 73 namespace webkit { |
| 69 namespace ppapi { | 74 namespace ppapi { |
| 70 | 75 |
| 71 class FullscreenContainer; | 76 class FullscreenContainer; |
| 72 class MessageChannel; | 77 class MessageChannel; |
| 73 class PluginDelegate; | 78 class PluginDelegate; |
| 74 class PluginModule; | 79 class PluginModule; |
| 75 class PluginObject; | 80 class PluginObject; |
| 76 class PPB_Graphics2D_Impl; | 81 class PPB_Graphics2D_Impl; |
| 77 class PPB_Graphics3D_Impl; | 82 class PPB_Graphics3D_Impl; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 179 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 175 int selection_start, | 180 int selection_start, |
| 176 int selection_end); | 181 int selection_end); |
| 177 bool HandleCompositionEnd(const string16& text); | 182 bool HandleCompositionEnd(const string16& text); |
| 178 bool HandleTextInput(const string16& text); | 183 bool HandleTextInput(const string16& text); |
| 179 | 184 |
| 180 // Implementation of composition API. | 185 // Implementation of composition API. |
| 181 void UpdateCaretPosition(const gfx::Rect& caret, | 186 void UpdateCaretPosition(const gfx::Rect& caret, |
| 182 const gfx::Rect& bounding_box); | 187 const gfx::Rect& bounding_box); |
| 183 void SetTextInputType(ui::TextInputType type); | 188 void SetTextInputType(ui::TextInputType type); |
| 189 void SelectionChanged(); |
| 190 void UpdateSurroundingText(const std::string& text, |
| 191 size_t caret, size_t anchor); |
| 184 | 192 |
| 185 // Gets the current text input status. | 193 // Gets the current text input status. |
| 186 ui::TextInputType text_input_type() const { return text_input_type_; } | 194 ui::TextInputType text_input_type() const { return text_input_type_; } |
| 187 gfx::Rect GetCaretBounds() const; | 195 gfx::Rect GetCaretBounds() const; |
| 188 bool IsPluginAcceptingCompositionEvents() const; | 196 bool IsPluginAcceptingCompositionEvents() const; |
| 197 void GetSurroundingText(string16* text, ui::Range* range) const; |
| 189 | 198 |
| 190 // Notifications about focus changes, see has_webkit_focus_ below. | 199 // Notifications about focus changes, see has_webkit_focus_ below. |
| 191 void SetWebKitFocus(bool has_focus); | 200 void SetWebKitFocus(bool has_focus); |
| 192 void SetContentAreaFocus(bool has_focus); | 201 void SetContentAreaFocus(bool has_focus); |
| 193 | 202 |
| 194 // Notification about page visibility. The default is "visible". | 203 // Notification about page visibility. The default is "visible". |
| 195 void PageVisibilityChanged(bool is_visible); | 204 void PageVisibilityChanged(bool is_visible); |
| 196 | 205 |
| 197 // Notifications that the view is about to paint, has started painting, and | 206 // Notifications that the view is about to paint, has started painting, and |
| 198 // has flushed the painted content to the screen. These messages are used to | 207 // has flushed the painted content to the screen. These messages are used to |
| (...skipping 11 matching lines...) Expand all Loading... |
| 210 TransportDIB** dib, | 219 TransportDIB** dib, |
| 211 gfx::Rect* dib_bounds, | 220 gfx::Rect* dib_bounds, |
| 212 gfx::Rect* clip); | 221 gfx::Rect* clip); |
| 213 | 222 |
| 214 // Tracks all live PluginObjects. | 223 // Tracks all live PluginObjects. |
| 215 void AddPluginObject(PluginObject* plugin_object); | 224 void AddPluginObject(PluginObject* plugin_object); |
| 216 void RemovePluginObject(PluginObject* plugin_object); | 225 void RemovePluginObject(PluginObject* plugin_object); |
| 217 | 226 |
| 218 string16 GetSelectedText(bool html); | 227 string16 GetSelectedText(bool html); |
| 219 string16 GetLinkAtPosition(const gfx::Point& point); | 228 string16 GetLinkAtPosition(const gfx::Point& point); |
| 229 bool RequestSurroundingText(size_t desired_number_of_characters); |
| 220 void Zoom(double factor, bool text_only); | 230 void Zoom(double factor, bool text_only); |
| 221 bool StartFind(const string16& search_text, | 231 bool StartFind(const string16& search_text, |
| 222 bool case_sensitive, | 232 bool case_sensitive, |
| 223 int identifier); | 233 int identifier); |
| 224 void SelectFindResult(bool forward); | 234 void SelectFindResult(bool forward); |
| 225 void StopFind(); | 235 void StopFind(); |
| 226 | 236 |
| 227 bool SupportsPrintInterface(); | 237 bool SupportsPrintInterface(); |
| 228 bool IsPrintScalingDisabled(); | 238 bool IsPrintScalingDisabled(); |
| 229 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); | 239 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 ::ppapi::PPP_Instance_Combined* instance_interface); | 405 ::ppapi::PPP_Instance_Combined* instance_interface); |
| 396 | 406 |
| 397 bool LoadFindInterface(); | 407 bool LoadFindInterface(); |
| 398 bool LoadInputEventInterface(); | 408 bool LoadInputEventInterface(); |
| 399 bool LoadMessagingInterface(); | 409 bool LoadMessagingInterface(); |
| 400 bool LoadMouseLockInterface(); | 410 bool LoadMouseLockInterface(); |
| 401 bool LoadPdfInterface(); | 411 bool LoadPdfInterface(); |
| 402 bool LoadPrintInterface(); | 412 bool LoadPrintInterface(); |
| 403 bool LoadPrivateInterface(); | 413 bool LoadPrivateInterface(); |
| 404 bool LoadSelectionInterface(); | 414 bool LoadSelectionInterface(); |
| 415 bool LoadTextInputInterface(); |
| 405 bool LoadZoomInterface(); | 416 bool LoadZoomInterface(); |
| 406 | 417 |
| 407 // Determines if we think the plugin has focus, both content area and webkit | 418 // Determines if we think the plugin has focus, both content area and webkit |
| 408 // (see has_webkit_focus_ below). | 419 // (see has_webkit_focus_ below). |
| 409 bool PluginHasFocus() const; | 420 bool PluginHasFocus() const; |
| 410 | 421 |
| 411 void ScheduleAsyncDidChangeView(const ::ppapi::ViewData& previous_view); | 422 void ScheduleAsyncDidChangeView(const ::ppapi::ViewData& previous_view); |
| 412 void SendAsyncDidChangeView(const ::ppapi::ViewData& previous_view); | 423 void SendAsyncDidChangeView(const ::ppapi::ViewData& previous_view); |
| 413 void SendDidChangeView(const ::ppapi::ViewData& previous_view); | 424 void SendDidChangeView(const ::ppapi::ViewData& previous_view); |
| 414 | 425 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 int find_identifier_; | 534 int find_identifier_; |
| 524 | 535 |
| 525 // The plugin-provided interfaces. | 536 // The plugin-provided interfaces. |
| 526 const PPP_Find_Dev* plugin_find_interface_; | 537 const PPP_Find_Dev* plugin_find_interface_; |
| 527 const PPP_Messaging* plugin_messaging_interface_; | 538 const PPP_Messaging* plugin_messaging_interface_; |
| 528 const PPP_MouseLock* plugin_mouse_lock_interface_; | 539 const PPP_MouseLock* plugin_mouse_lock_interface_; |
| 529 const PPP_InputEvent* plugin_input_event_interface_; | 540 const PPP_InputEvent* plugin_input_event_interface_; |
| 530 const PPP_Instance_Private* plugin_private_interface_; | 541 const PPP_Instance_Private* plugin_private_interface_; |
| 531 const PPP_Pdf* plugin_pdf_interface_; | 542 const PPP_Pdf* plugin_pdf_interface_; |
| 532 const PPP_Selection_Dev* plugin_selection_interface_; | 543 const PPP_Selection_Dev* plugin_selection_interface_; |
| 544 const PPP_TextInput_Dev* plugin_textinput_interface_; |
| 533 const PPP_Zoom_Dev* plugin_zoom_interface_; | 545 const PPP_Zoom_Dev* plugin_zoom_interface_; |
| 534 | 546 |
| 535 // Flags indicating whether we have asked this plugin instance for the | 547 // Flags indicating whether we have asked this plugin instance for the |
| 536 // corresponding interfaces, so that we can ask only once. | 548 // corresponding interfaces, so that we can ask only once. |
| 537 bool checked_for_plugin_input_event_interface_; | 549 bool checked_for_plugin_input_event_interface_; |
| 538 bool checked_for_plugin_messaging_interface_; | 550 bool checked_for_plugin_messaging_interface_; |
| 539 | 551 |
| 540 // This is only valid between a successful PrintBegin call and a PrintEnd | 552 // This is only valid between a successful PrintBegin call and a PrintEnd |
| 541 // call. | 553 // call. |
| 542 PP_PrintSettings_Dev current_print_settings_; | 554 PP_PrintSettings_Dev current_print_settings_; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 // and not. The bits are PP_INPUTEVENT_CLASS_*. | 629 // and not. The bits are PP_INPUTEVENT_CLASS_*. |
| 618 uint32_t input_event_mask_; | 630 uint32_t input_event_mask_; |
| 619 uint32_t filtered_input_event_mask_; | 631 uint32_t filtered_input_event_mask_; |
| 620 | 632 |
| 621 // Text composition status. | 633 // Text composition status. |
| 622 ui::TextInputType text_input_type_; | 634 ui::TextInputType text_input_type_; |
| 623 gfx::Rect text_input_caret_; | 635 gfx::Rect text_input_caret_; |
| 624 gfx::Rect text_input_caret_bounds_; | 636 gfx::Rect text_input_caret_bounds_; |
| 625 bool text_input_caret_set_; | 637 bool text_input_caret_set_; |
| 626 | 638 |
| 639 // Text selection status. |
| 640 std::string surrounding_text_; |
| 641 size_t selection_caret_; |
| 642 size_t selection_anchor_; |
| 643 |
| 627 PP_CompletionCallback lock_mouse_callback_; | 644 PP_CompletionCallback lock_mouse_callback_; |
| 628 | 645 |
| 629 // Track pending user gestures so out-of-process plugins can respond to | 646 // Track pending user gestures so out-of-process plugins can respond to |
| 630 // a user gesture after it has been processed. | 647 // a user gesture after it has been processed. |
| 631 PP_TimeTicks pending_user_gesture_; | 648 PP_TimeTicks pending_user_gesture_; |
| 632 | 649 |
| 633 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 650 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 634 }; | 651 }; |
| 635 | 652 |
| 636 } // namespace ppapi | 653 } // namespace ppapi |
| 637 } // namespace webkit | 654 } // namespace webkit |
| 638 | 655 |
| 639 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 656 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |