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

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

Powered by Google App Engine
This is Rietveld 408576698