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; | 54 struct WebCursorInfo; |
kochi
2011/10/04 08:52:45
Please move this line down after line 57.
(see co
kinaba
2011/10/05 04:43:19
Done.
| |
57 class WebInputEvent; | 55 class WebInputEvent; |
58 class WebPluginContainer; | 56 class WebPluginContainer; |
57 struct WebCompositionUnderline; | |
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 PluginDelegate* delegate_; | 432 PluginDelegate* delegate_; |
403 scoped_refptr<PluginModule> module_; | 433 scoped_refptr<PluginModule> module_; |
404 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; | 434 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; |
405 | 435 |
406 PP_Instance pp_instance_; | 436 PP_Instance pp_instance_; |
407 | 437 |
408 // NULL until we have been initialized. | 438 // NULL until we have been initialized. |
409 WebKit::WebPluginContainer* container_; | 439 WebKit::WebPluginContainer* container_; |
410 | 440 |
411 // Plugin URL. | 441 // Plugin URL. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 SkBitmap* sad_plugin_; | 557 SkBitmap* sad_plugin_; |
528 | 558 |
529 typedef std::set<PluginObject*> PluginObjectSet; | 559 typedef std::set<PluginObject*> PluginObjectSet; |
530 PluginObjectSet live_plugin_objects_; | 560 PluginObjectSet live_plugin_objects_; |
531 | 561 |
532 // Classes of events that the plugin has registered for, both for filtering | 562 // Classes of events that the plugin has registered for, both for filtering |
533 // and not. The bits are PP_INPUTEVENT_CLASS_*. | 563 // and not. The bits are PP_INPUTEVENT_CLASS_*. |
534 uint32_t input_event_mask_; | 564 uint32_t input_event_mask_; |
535 uint32_t filtered_input_event_mask_; | 565 uint32_t filtered_input_event_mask_; |
536 | 566 |
567 // Text composition status. | |
568 ui::TextInputType text_input_type_; | |
569 gfx::Rect text_input_caret_; | |
570 gfx::Rect text_input_caret_bounds_; | |
571 bool text_input_caret_set_; | |
572 | |
537 PP_CompletionCallback lock_mouse_callback_; | 573 PP_CompletionCallback lock_mouse_callback_; |
538 | 574 |
539 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 575 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
540 }; | 576 }; |
541 | 577 |
542 } // namespace ppapi | 578 } // namespace ppapi |
543 } // namespace webkit | 579 } // namespace webkit |
544 | 580 |
545 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 581 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |