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