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