Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.h

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git mv desktop_host_unittest.cc desktop_host_ime_unittest.cc Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
17 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 18 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
18 #include "base/callback.h" 19 #include "base/callback.h"
19 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
20 #endif 21 #endif
21 22
23 namespace ui {
24 class InputMethod;
25 }
26
22 namespace WebKit { 27 namespace WebKit {
23 class WebTouchEvent; 28 class WebTouchEvent;
24 } 29 }
25 30
26 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 31 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
27 class AcceleratedSurfaceContainerLinux; 32 class AcceleratedSurfaceContainerLinux;
28 #endif 33 #endif
29 34
30 class CONTENT_EXPORT RenderWidgetHostViewAura 35 class CONTENT_EXPORT RenderWidgetHostViewAura
31 : NON_EXPORTED_BASE(public RenderWidgetHostView), 36 : NON_EXPORTED_BASE(public RenderWidgetHostView),
32 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 37 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
33 public ui::CompositorObserver, 38 public ui::CompositorObserver,
34 #endif 39 #endif
40 public ui::TextInputClient,
35 public aura::WindowDelegate { 41 public aura::WindowDelegate {
36 public: 42 public:
37 explicit RenderWidgetHostViewAura(RenderWidgetHost* host); 43 explicit RenderWidgetHostViewAura(RenderWidgetHost* host);
38 virtual ~RenderWidgetHostViewAura(); 44 virtual ~RenderWidgetHostViewAura();
39 45
40 // TODO(derat): Add an abstract RenderWidgetHostView::InitAsChild() method and 46 // TODO(derat): Add an abstract RenderWidgetHostView::InitAsChild() method and
41 // update callers: http://crbug.com/102450. 47 // update callers: http://crbug.com/102450.
42 void InitAsChild(); 48 void InitAsChild();
43 49
44 // Overridden from RenderWidgetHostView: 50 // Overridden from RenderWidgetHostView:
(...skipping 22 matching lines...) Expand all
67 virtual void TextInputStateChanged(ui::TextInputType type, 73 virtual void TextInputStateChanged(ui::TextInputType type,
68 bool can_compose_inline) OVERRIDE; 74 bool can_compose_inline) OVERRIDE;
69 virtual void ImeCancelComposition() OVERRIDE; 75 virtual void ImeCancelComposition() OVERRIDE;
70 virtual void DidUpdateBackingStore( 76 virtual void DidUpdateBackingStore(
71 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, 77 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
72 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; 78 const std::vector<gfx::Rect>& copy_rects) OVERRIDE;
73 virtual void RenderViewGone(base::TerminationStatus status, 79 virtual void RenderViewGone(base::TerminationStatus status,
74 int error_code) OVERRIDE; 80 int error_code) OVERRIDE;
75 virtual void Destroy() OVERRIDE; 81 virtual void Destroy() OVERRIDE;
76 virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; 82 virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE;
83 virtual void SelectionBoundsChanged(const gfx::Rect& start_rect,
84 const gfx::Rect& end_rect) OVERRIDE;
77 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; 85 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
78 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; 86 virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
79 virtual void AcceleratedSurfaceBuffersSwapped( 87 virtual void AcceleratedSurfaceBuffersSwapped(
80 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 88 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
81 int gpu_host_id) OVERRIDE; 89 int gpu_host_id) OVERRIDE;
82 virtual void AcceleratedSurfacePostSubBuffer( 90 virtual void AcceleratedSurfacePostSubBuffer(
83 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 91 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
84 int gpu_host_id) OVERRIDE; 92 int gpu_host_id) OVERRIDE;
85 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 93 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
86 virtual void AcceleratedSurfaceNew( 94 virtual void AcceleratedSurfaceNew(
(...skipping 11 matching lines...) Expand all
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;
118 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; 147 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE;
119 virtual bool ShouldActivate(aura::Event* event) OVERRIDE; 148 virtual bool ShouldActivate(aura::Event* event) OVERRIDE;
120 virtual void OnActivated() OVERRIDE; 149 virtual void OnActivated() OVERRIDE;
121 virtual void OnLostActive() OVERRIDE; 150 virtual void OnLostActive() OVERRIDE;
122 virtual void OnCaptureLost() OVERRIDE; 151 virtual void OnCaptureLost() OVERRIDE;
123 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 152 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
124 virtual void OnWindowDestroying() OVERRIDE; 153 virtual void OnWindowDestroying() OVERRIDE;
125 virtual void OnWindowDestroyed() OVERRIDE; 154 virtual void OnWindowDestroyed() OVERRIDE;
126 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; 155 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE;
127 156
128 private: 157 private:
129 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 158 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
130 // Overridden from ui::CompositorObserver: 159 // Overridden from ui::CompositorObserver:
131 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; 160 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE;
132 #endif 161 #endif
133 162
134 void UpdateCursorIfOverSelf(); 163 void UpdateCursorIfOverSelf();
135 void UpdateExternalTexture(); 164 void UpdateExternalTexture();
165 ui::InputMethod* GetInputMethod();
166
167 // Confirm existing composition text in the webpage and ask the input method
168 // to cancel its ongoing composition session.
169 void FinishImeCompositionSession();
136 170
137 // The model object. 171 // The model object.
138 RenderWidgetHost* host_; 172 RenderWidgetHost* host_;
139 173
140 aura::Window* window_; 174 aura::Window* window_;
141 175
142 // Is this a fullscreen view? 176 // Is this a fullscreen view?
143 bool is_fullscreen_; 177 bool is_fullscreen_;
144 178
145 // Our parent host view, if this is a popup. NULL otherwise. 179 // Our parent host view, if this is a popup. NULL otherwise.
146 RenderWidgetHostViewAura* popup_parent_host_view_; 180 RenderWidgetHostViewAura* popup_parent_host_view_;
147 181
148 // True when content is being loaded. Used to show an hourglass cursor. 182 // True when content is being loaded. Used to show an hourglass cursor.
149 bool is_loading_; 183 bool is_loading_;
150 184
151 // The cursor for the page. This is passed up from the renderer. 185 // The cursor for the page. This is passed up from the renderer.
152 WebCursor current_cursor_; 186 WebCursor current_cursor_;
153 187
154 // The touch-event. Its touch-points are updated as necessary. A new 188 // The touch-event. Its touch-points are updated as necessary. A new
155 // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is 189 // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
156 // removed from the list on an ET_TOUCH_RELEASED event. 190 // removed from the list on an ET_TOUCH_RELEASED event.
157 WebKit::WebTouchEvent touch_event_; 191 WebKit::WebTouchEvent touch_event_;
158 192
193 // The current text input type.
194 ui::TextInputType text_input_type_;
195
196 // Rectangles before and after the selection.
197 gfx::Rect selection_start_rect_;
198 gfx::Rect selection_end_rect_;
199
200 // Indicates if there is onging composition text.
201 bool has_composition_text_;
202
159 // Current tooltip text. 203 // Current tooltip text.
160 string16 tooltip_; 204 string16 tooltip_;
161 205
162 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 206 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
163 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; 207 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_;
164 208
165 std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerLinux> > 209 std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerLinux> >
166 accelerated_surface_containers_; 210 accelerated_surface_containers_;
167 211
168 gfx::PluginWindowHandle current_surface_; 212 gfx::PluginWindowHandle current_surface_;
169 #endif 213 #endif
170 214
171 bool skip_schedule_paint_; 215 bool skip_schedule_paint_;
172 216
173 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 217 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
174 }; 218 };
175 219
176 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 220 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698