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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "content/browser/renderer_host/render_widget_host_view.h" | 11 #include "content/browser/renderer_host/render_widget_host_view.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "ui/aura/client/activation_delegate.h" | 13 #include "ui/aura/client/activation_delegate.h" |
14 #include "ui/aura/window_delegate.h" | 14 #include "ui/aura/window_delegate.h" |
| 15 #include "ui/base/ime/text_input_client.h" |
15 #include "ui/gfx/compositor/compositor_observer.h" | 16 #include "ui/gfx/compositor/compositor_observer.h" |
16 #include "webkit/glue/webcursor.h" | 17 #include "webkit/glue/webcursor.h" |
17 | 18 |
18 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 19 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
19 #include "base/callback.h" | 20 #include "base/callback.h" |
20 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
21 #endif | 22 #endif |
22 | 23 |
| 24 namespace ui { |
| 25 class InputMethod; |
| 26 } |
| 27 |
23 namespace WebKit { | 28 namespace WebKit { |
24 class WebTouchEvent; | 29 class WebTouchEvent; |
25 } | 30 } |
26 | 31 |
27 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 32 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
28 class AcceleratedSurfaceContainerLinux; | 33 class AcceleratedSurfaceContainerLinux; |
29 #endif | 34 #endif |
30 | 35 |
31 class CONTENT_EXPORT RenderWidgetHostViewAura | 36 class CONTENT_EXPORT RenderWidgetHostViewAura |
32 : NON_EXPORTED_BASE(public RenderWidgetHostView), | 37 : NON_EXPORTED_BASE(public RenderWidgetHostView), |
33 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 38 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
34 public ui::CompositorObserver, | 39 public ui::CompositorObserver, |
35 #endif | 40 #endif |
| 41 public ui::TextInputClient, |
36 public aura::WindowDelegate, | 42 public aura::WindowDelegate, |
37 public aura::client::ActivationDelegate { | 43 public aura::client::ActivationDelegate { |
38 public: | 44 public: |
39 explicit RenderWidgetHostViewAura(RenderWidgetHost* host); | 45 explicit RenderWidgetHostViewAura(RenderWidgetHost* host); |
40 virtual ~RenderWidgetHostViewAura(); | 46 virtual ~RenderWidgetHostViewAura(); |
41 | 47 |
42 // TODO(derat): Add an abstract RenderWidgetHostView::InitAsChild() method and | 48 // TODO(derat): Add an abstract RenderWidgetHostView::InitAsChild() method and |
43 // update callers: http://crbug.com/102450. | 49 // update callers: http://crbug.com/102450. |
44 void InitAsChild(); | 50 void InitAsChild(); |
45 | 51 |
(...skipping 23 matching lines...) Expand all Loading... |
69 virtual void TextInputStateChanged(ui::TextInputType type, | 75 virtual void TextInputStateChanged(ui::TextInputType type, |
70 bool can_compose_inline) OVERRIDE; | 76 bool can_compose_inline) OVERRIDE; |
71 virtual void ImeCancelComposition() OVERRIDE; | 77 virtual void ImeCancelComposition() OVERRIDE; |
72 virtual void DidUpdateBackingStore( | 78 virtual void DidUpdateBackingStore( |
73 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 79 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
74 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; | 80 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; |
75 virtual void RenderViewGone(base::TerminationStatus status, | 81 virtual void RenderViewGone(base::TerminationStatus status, |
76 int error_code) OVERRIDE; | 82 int error_code) OVERRIDE; |
77 virtual void Destroy() OVERRIDE; | 83 virtual void Destroy() OVERRIDE; |
78 virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; | 84 virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; |
| 85 virtual void SelectionBoundsChanged(const gfx::Rect& start_rect, |
| 86 const gfx::Rect& end_rect) OVERRIDE; |
79 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; | 87 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; |
80 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; | 88 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; |
81 virtual void AcceleratedSurfaceBuffersSwapped( | 89 virtual void AcceleratedSurfaceBuffersSwapped( |
82 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 90 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
83 int gpu_host_id) OVERRIDE; | 91 int gpu_host_id) OVERRIDE; |
84 virtual void AcceleratedSurfacePostSubBuffer( | 92 virtual void AcceleratedSurfacePostSubBuffer( |
85 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 93 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
86 int gpu_host_id) OVERRIDE; | 94 int gpu_host_id) OVERRIDE; |
87 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 95 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
88 virtual void AcceleratedSurfaceNew( | 96 virtual void AcceleratedSurfaceNew( |
89 int32 width, | 97 int32 width, |
90 int32 height, | 98 int32 height, |
91 uint64* surface_id, | 99 uint64* surface_id, |
92 TransportDIB::Handle* surface_handle) OVERRIDE; | 100 TransportDIB::Handle* surface_handle) OVERRIDE; |
93 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; | 101 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; |
94 #endif | 102 #endif |
95 virtual void SetBackground(const SkBitmap& background) OVERRIDE; | 103 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
96 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; | 104 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; |
97 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; | 105 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; |
98 virtual void UnhandledWheelEvent( | 106 virtual void UnhandledWheelEvent( |
99 const WebKit::WebMouseWheelEvent& event) OVERRIDE; | 107 const WebKit::WebMouseWheelEvent& event) OVERRIDE; |
100 virtual void SetHasHorizontalScrollbar( | 108 virtual void SetHasHorizontalScrollbar( |
101 bool has_horizontal_scrollbar) OVERRIDE; | 109 bool has_horizontal_scrollbar) OVERRIDE; |
102 virtual void SetScrollOffsetPinning( | 110 virtual void SetScrollOffsetPinning( |
103 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 111 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; |
104 virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; | 112 virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; |
105 virtual bool LockMouse() OVERRIDE; | 113 virtual bool LockMouse() OVERRIDE; |
106 virtual void UnlockMouse() OVERRIDE; | 114 virtual void UnlockMouse() OVERRIDE; |
107 | 115 |
| 116 // Overridden from ui::TextInputClient: |
| 117 virtual void SetCompositionText( |
| 118 const ui::CompositionText& composition) OVERRIDE; |
| 119 virtual void ConfirmCompositionText() OVERRIDE; |
| 120 virtual void ClearCompositionText() OVERRIDE; |
| 121 virtual void InsertText(const string16& text) OVERRIDE; |
| 122 virtual void InsertChar(char16 ch, int flags) OVERRIDE; |
| 123 virtual ui::TextInputType GetTextInputType() const OVERRIDE; |
| 124 virtual gfx::Rect GetCaretBounds() OVERRIDE; |
| 125 virtual bool HasCompositionText() OVERRIDE; |
| 126 virtual bool GetTextRange(ui::Range* range) OVERRIDE; |
| 127 virtual bool GetCompositionTextRange(ui::Range* range) OVERRIDE; |
| 128 virtual bool GetSelectionRange(ui::Range* range) OVERRIDE; |
| 129 virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE; |
| 130 virtual bool DeleteRange(const ui::Range& range) OVERRIDE; |
| 131 virtual bool GetTextFromRange(const ui::Range& range, |
| 132 string16* text) OVERRIDE; |
| 133 virtual void OnInputMethodChanged() OVERRIDE; |
| 134 virtual bool ChangeTextDirectionAndLayoutAlignment( |
| 135 base::i18n::TextDirection direction) OVERRIDE; |
| 136 |
108 // Overridden from aura::WindowDelegate: | 137 // Overridden from aura::WindowDelegate: |
109 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 138 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
110 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 139 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
111 const gfx::Rect& new_bounds) OVERRIDE; | 140 const gfx::Rect& new_bounds) OVERRIDE; |
112 virtual void OnFocus() OVERRIDE; | 141 virtual void OnFocus() OVERRIDE; |
113 virtual void OnBlur() OVERRIDE; | 142 virtual void OnBlur() OVERRIDE; |
114 virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; | 143 virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; |
115 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | 144 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; |
116 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 145 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
117 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; | 146 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
129 virtual void OnLostActive() OVERRIDE; | 158 virtual void OnLostActive() OVERRIDE; |
130 | 159 |
131 private: | 160 private: |
132 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 161 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
133 // Overridden from ui::CompositorObserver: | 162 // Overridden from ui::CompositorObserver: |
134 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; | 163 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; |
135 #endif | 164 #endif |
136 | 165 |
137 void UpdateCursorIfOverSelf(); | 166 void UpdateCursorIfOverSelf(); |
138 void UpdateExternalTexture(); | 167 void UpdateExternalTexture(); |
| 168 ui::InputMethod* GetInputMethod() const; |
| 169 |
| 170 // Confirm existing composition text in the webpage and ask the input method |
| 171 // to cancel its ongoing composition session. |
| 172 void FinishImeCompositionSession(); |
139 | 173 |
140 // The model object. | 174 // The model object. |
141 RenderWidgetHost* host_; | 175 RenderWidgetHost* host_; |
142 | 176 |
143 aura::Window* window_; | 177 aura::Window* window_; |
144 | 178 |
145 // Is this a fullscreen view? | 179 // Is this a fullscreen view? |
146 bool is_fullscreen_; | 180 bool is_fullscreen_; |
147 | 181 |
148 // Our parent host view, if this is a popup. NULL otherwise. | 182 // Our parent host view, if this is a popup. NULL otherwise. |
149 RenderWidgetHostViewAura* popup_parent_host_view_; | 183 RenderWidgetHostViewAura* popup_parent_host_view_; |
150 | 184 |
151 // True when content is being loaded. Used to show an hourglass cursor. | 185 // True when content is being loaded. Used to show an hourglass cursor. |
152 bool is_loading_; | 186 bool is_loading_; |
153 | 187 |
154 // The cursor for the page. This is passed up from the renderer. | 188 // The cursor for the page. This is passed up from the renderer. |
155 WebCursor current_cursor_; | 189 WebCursor current_cursor_; |
156 | 190 |
157 // The touch-event. Its touch-points are updated as necessary. A new | 191 // The touch-event. Its touch-points are updated as necessary. A new |
158 // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is | 192 // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is |
159 // removed from the list on an ET_TOUCH_RELEASED event. | 193 // removed from the list on an ET_TOUCH_RELEASED event. |
160 WebKit::WebTouchEvent touch_event_; | 194 WebKit::WebTouchEvent touch_event_; |
161 | 195 |
| 196 // The current text input type. |
| 197 ui::TextInputType text_input_type_; |
| 198 |
| 199 // Rectangles before and after the selection. |
| 200 gfx::Rect selection_start_rect_; |
| 201 gfx::Rect selection_end_rect_; |
| 202 |
| 203 // Indicates if there is onging composition text. |
| 204 bool has_composition_text_; |
| 205 |
162 // Current tooltip text. | 206 // Current tooltip text. |
163 string16 tooltip_; | 207 string16 tooltip_; |
164 | 208 |
165 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 209 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
166 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; | 210 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; |
167 | 211 |
168 std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerLinux> > | 212 std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerLinux> > |
169 accelerated_surface_containers_; | 213 accelerated_surface_containers_; |
170 | 214 |
171 gfx::PluginWindowHandle current_surface_; | 215 gfx::PluginWindowHandle current_surface_; |
172 #endif | 216 #endif |
173 | 217 |
174 bool skip_schedule_paint_; | 218 bool skip_schedule_paint_; |
175 | 219 |
176 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 220 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
177 }; | 221 }; |
178 | 222 |
179 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 223 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |