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

Side by Side Diff: ui/views/widget/android/native_widget_android.h

Issue 1403293003: Introduce AndroidFocusRules and NativeWidgetAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reviews Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ 5 #ifndef UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_
6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ 6 #define UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_
7 7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
9 #include "ui/aura/client/focus_change_observer.h" 11 #include "ui/aura/client/focus_change_observer.h"
10 #include "ui/aura/window_delegate.h" 12 #include "ui/aura/window_delegate.h"
11 #include "ui/aura/window_observer.h" 13 #include "ui/aura/window_observer.h"
14 #include "ui/aura/window_tree_host_observer.h"
12 #include "ui/base/cursor/cursor.h" 15 #include "ui/base/cursor/cursor.h"
13 #include "ui/events/event_constants.h" 16 #include "ui/events/event_constants.h"
14 #include "ui/views/views_export.h" 17 #include "ui/views/views_export.h"
15 #include "ui/views/widget/native_widget_private.h" 18 #include "ui/views/widget/native_widget_private.h"
16 #include "ui/wm/public/activation_change_observer.h" 19 #include "ui/wm/public/activation_change_observer.h"
17 #include "ui/wm/public/activation_delegate.h" 20 #include "ui/wm/public/activation_delegate.h"
18 #include "ui/wm/public/drag_drop_delegate.h" 21 #include "ui/wm/public/drag_drop_delegate.h"
19 22
20 namespace aura { 23 namespace aura {
21 class Window; 24 class Window;
25 class WindowTreeHost;
26 namespace client {
27 class DefaultCaptureClient;
28 class DispatcherClient;
29 class ScreenPositionClient;
30 class WindowTreeClient;
31 }
22 } 32 }
23 namespace gfx { 33 namespace gfx {
24 class FontList; 34 class FontList;
25 } 35 }
36 namespace wm {
37 class FocusController;
38 }
26 39
27 namespace views { 40 namespace views {
28 41
29 class DropHelper;
30 class TooltipManagerAura; 42 class TooltipManagerAura;
31 class WindowReorderer; 43 class WindowReorderer;
32 44
33 class VIEWS_EXPORT NativeWidgetAura 45 // NativeWidgetAndroid creates and hosts the Widget in an Android native window.
46 // It is used to create a top level window on Android platform.
47 class VIEWS_EXPORT NativeWidgetAndroid
34 : public internal::NativeWidgetPrivate, 48 : public internal::NativeWidgetPrivate,
35 public aura::WindowDelegate, 49 public aura::WindowDelegate,
36 public aura::WindowObserver,
37 public aura::client::ActivationDelegate, 50 public aura::client::ActivationDelegate,
38 public aura::client::ActivationChangeObserver, 51 public aura::client::ActivationChangeObserver,
39 public aura::client::FocusChangeObserver, 52 public aura::client::FocusChangeObserver,
40 public aura::client::DragDropDelegate { 53 public aura::client::DragDropDelegate,
54 public aura::WindowTreeHostObserver {
41 public: 55 public:
42 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); 56 explicit NativeWidgetAndroid(internal::NativeWidgetDelegate* delegate);
43 57
44 // Called internally by NativeWidgetAura and DesktopNativeWidgetAura to 58 aura::WindowTreeHost* host() { return host_.get(); }
45 // associate |native_widget| with |window|.
46 static void RegisterNativeWidgetForWindow(
47 internal::NativeWidgetPrivate* native_widget,
48 aura::Window* window);
49 59
50 // Overridden from internal::NativeWidgetPrivate: 60 // Overridden from internal::NativeWidgetPrivate:
51 void InitNativeWidget(const Widget::InitParams& params) override; 61 void InitNativeWidget(const Widget::InitParams& params) override;
52 NonClientFrameView* CreateNonClientFrameView() override; 62 NonClientFrameView* CreateNonClientFrameView() override;
53 bool ShouldUseNativeFrame() const override; 63 bool ShouldUseNativeFrame() const override;
54 bool ShouldWindowContentsBeTransparent() const override; 64 bool ShouldWindowContentsBeTransparent() const override;
55 void FrameTypeChanged() override; 65 void FrameTypeChanged() override;
56 Widget* GetWidget() override; 66 Widget* GetWidget() override;
57 const Widget* GetWidget() const override; 67 const Widget* GetWidget() const override;
58 gfx::NativeView GetNativeView() const override; 68 gfx::NativeView GetNativeView() const override;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool CanFocus() override; 156 bool CanFocus() override;
147 void OnCaptureLost() override; 157 void OnCaptureLost() override;
148 void OnPaint(const ui::PaintContext& context) override; 158 void OnPaint(const ui::PaintContext& context) override;
149 void OnDeviceScaleFactorChanged(float device_scale_factor) override; 159 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
150 void OnWindowDestroying(aura::Window* window) override; 160 void OnWindowDestroying(aura::Window* window) override;
151 void OnWindowDestroyed(aura::Window* window) override; 161 void OnWindowDestroyed(aura::Window* window) override;
152 void OnWindowTargetVisibilityChanged(bool visible) override; 162 void OnWindowTargetVisibilityChanged(bool visible) override;
153 bool HasHitTestMask() const override; 163 bool HasHitTestMask() const override;
154 void GetHitTestMask(gfx::Path* mask) const override; 164 void GetHitTestMask(gfx::Path* mask) const override;
155 165
156 // Overridden from aura::WindowObserver:
157 void OnWindowPropertyChanged(aura::Window* window,
158 const void* key,
159 intptr_t old) override;
160
161 // Overridden from ui::EventHandler: 166 // Overridden from ui::EventHandler:
162 void OnKeyEvent(ui::KeyEvent* event) override; 167 void OnKeyEvent(ui::KeyEvent* event) override;
163 void OnMouseEvent(ui::MouseEvent* event) override; 168 void OnMouseEvent(ui::MouseEvent* event) override;
164 void OnScrollEvent(ui::ScrollEvent* event) override; 169 void OnScrollEvent(ui::ScrollEvent* event) override;
165 void OnGestureEvent(ui::GestureEvent* event) override; 170 void OnGestureEvent(ui::GestureEvent* event) override;
166 171
167 // Overridden from aura::client::ActivationDelegate: 172 // Overridden from aura::client::ActivationDelegate:
168 bool ShouldActivate() const override; 173 bool ShouldActivate() const override;
169 174
170 // Overridden from aura::client::ActivationChangeObserver: 175 // Overridden from aura::client::ActivationChangeObserver:
171 void OnWindowActivated( 176 void OnWindowActivated(
172 aura::client::ActivationChangeObserver::ActivationReason reason, 177 aura::client::ActivationChangeObserver::ActivationReason reason,
173 aura::Window* gained_active, 178 aura::Window* gained_active,
174 aura::Window* lost_active) override; 179 aura::Window* lost_active) override;
175 180
176 // Overridden from aura::client::FocusChangeObserver: 181 // Overridden from aura::client::FocusChangeObserver:
177 void OnWindowFocused(aura::Window* gained_focus, 182 void OnWindowFocused(aura::Window* gained_focus,
178 aura::Window* lost_focus) override; 183 aura::Window* lost_focus) override;
179 184
180 // Overridden from aura::client::DragDropDelegate: 185 // Overridden from aura::client::DragDropDelegate:
181 void OnDragEntered(const ui::DropTargetEvent& event) override; 186 void OnDragEntered(const ui::DropTargetEvent& event) override;
182 int OnDragUpdated(const ui::DropTargetEvent& event) override; 187 int OnDragUpdated(const ui::DropTargetEvent& event) override;
183 void OnDragExited() override; 188 void OnDragExited() override;
184 int OnPerformDrop(const ui::DropTargetEvent& event) override; 189 int OnPerformDrop(const ui::DropTargetEvent& event) override;
185 190
191 // Overridden from aura::WindowTreeHostObserver:
192 void OnHostCloseRequested(const aura::WindowTreeHost* host) override;
193 void OnHostResized(const aura::WindowTreeHost* host) override;
194 void OnHostMoved(const aura::WindowTreeHost* host,
195 const gfx::Point& new_origin) override;
196
186 protected: 197 protected:
187 ~NativeWidgetAura() override; 198 ~NativeWidgetAndroid() override;
188 199
189 internal::NativeWidgetDelegate* delegate() { return delegate_; } 200 internal::NativeWidgetDelegate* delegate() { return delegate_; }
190 201
191 private: 202 private:
192 class ActiveWindowObserver; 203 class ActiveWindowObserver;
193 204
194 bool IsDocked() const; 205 bool IsDocked() const;
195 void SetInitialFocus(ui::WindowShowState show_state); 206 void SetInitialFocus(ui::WindowShowState show_state);
196 207
197 internal::NativeWidgetDelegate* delegate_; 208 internal::NativeWidgetDelegate* delegate_;
(...skipping 13 matching lines...) Expand all
211 222
212 // The saved window state for exiting full screen state. 223 // The saved window state for exiting full screen state.
213 ui::WindowShowState saved_window_state_; 224 ui::WindowShowState saved_window_state_;
214 225
215 scoped_ptr<TooltipManagerAura> tooltip_manager_; 226 scoped_ptr<TooltipManagerAura> tooltip_manager_;
216 227
217 // Reorders child windows of |window_| associated with a view based on the 228 // Reorders child windows of |window_| associated with a view based on the
218 // order of the associated views in the widget's view hierarchy. 229 // order of the associated views in the widget's view hierarchy.
219 scoped_ptr<WindowReorderer> window_reorderer_; 230 scoped_ptr<WindowReorderer> window_reorderer_;
220 231
221 scoped_ptr<DropHelper> drop_helper_; 232 scoped_ptr<aura::WindowTreeHost> host_;
222 int last_drop_operation_; 233 scoped_ptr<wm::FocusController> focus_client_;
234 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
235 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
236 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_;
237 scoped_ptr<aura::client::DispatcherClient> dispatcher_client_;
223 238
224 // The following factory is used for calls to close the NativeWidgetAura 239 // The following factory is used for calls to close the
225 // instance. 240 // NativeWidgetAndroid instance.
226 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; 241 base::WeakPtrFactory<NativeWidgetAndroid> close_widget_factory_;
227 242
228 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); 243 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAndroid);
229 }; 244 };
230 245
231 } // namespace views 246 } // namespace views
232 247
233 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ 248 #endif // UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_
OLDNEW
« no previous file with comments | « ui/views/widget/android/android_focus_rules.cc ('k') | ui/views/widget/android/native_widget_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698