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

Side by Side Diff: ui/views/widget/desktop_android/desktop_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_DESKTOP_ANDROID_DESKTOP_NATIVE_WIDGET_ANDROID_H_
6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ 6 #define UI_VIEWS_WIDGET_DESKTOP_ANDROID_DESKTOP_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 class VIEWS_EXPORT DesktopNativeWidgetAndroid
34 : public internal::NativeWidgetPrivate, 46 : public internal::NativeWidgetPrivate,
35 public aura::WindowDelegate, 47 public aura::WindowDelegate,
36 public aura::WindowObserver,
37 public aura::client::ActivationDelegate, 48 public aura::client::ActivationDelegate,
38 public aura::client::ActivationChangeObserver, 49 public aura::client::ActivationChangeObserver,
39 public aura::client::FocusChangeObserver, 50 public aura::client::FocusChangeObserver,
40 public aura::client::DragDropDelegate { 51 public aura::client::DragDropDelegate,
52 public aura::WindowTreeHostObserver {
41 public: 53 public:
42 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); 54 explicit DesktopNativeWidgetAndroid(internal::NativeWidgetDelegate* delegate);
43 55
44 // Called internally by NativeWidgetAura and DesktopNativeWidgetAura to 56 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 57
50 // Overridden from internal::NativeWidgetPrivate: 58 // Overridden from internal::NativeWidgetPrivate:
51 void InitNativeWidget(const Widget::InitParams& params) override; 59 void InitNativeWidget(const Widget::InitParams& params) override;
52 NonClientFrameView* CreateNonClientFrameView() override; 60 NonClientFrameView* CreateNonClientFrameView() override;
53 bool ShouldUseNativeFrame() const override; 61 bool ShouldUseNativeFrame() const override;
54 bool ShouldWindowContentsBeTransparent() const override; 62 bool ShouldWindowContentsBeTransparent() const override;
55 void FrameTypeChanged() override; 63 void FrameTypeChanged() override;
56 Widget* GetWidget() override; 64 Widget* GetWidget() override;
57 const Widget* GetWidget() const override; 65 const Widget* GetWidget() const override;
58 gfx::NativeView GetNativeView() const override; 66 gfx::NativeView GetNativeView() const override;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool CanFocus() override; 154 bool CanFocus() override;
147 void OnCaptureLost() override; 155 void OnCaptureLost() override;
148 void OnPaint(const ui::PaintContext& context) override; 156 void OnPaint(const ui::PaintContext& context) override;
149 void OnDeviceScaleFactorChanged(float device_scale_factor) override; 157 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
150 void OnWindowDestroying(aura::Window* window) override; 158 void OnWindowDestroying(aura::Window* window) override;
151 void OnWindowDestroyed(aura::Window* window) override; 159 void OnWindowDestroyed(aura::Window* window) override;
152 void OnWindowTargetVisibilityChanged(bool visible) override; 160 void OnWindowTargetVisibilityChanged(bool visible) override;
153 bool HasHitTestMask() const override; 161 bool HasHitTestMask() const override;
154 void GetHitTestMask(gfx::Path* mask) const override; 162 void GetHitTestMask(gfx::Path* mask) const override;
155 163
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: 164 // Overridden from ui::EventHandler:
162 void OnKeyEvent(ui::KeyEvent* event) override; 165 void OnKeyEvent(ui::KeyEvent* event) override;
163 void OnMouseEvent(ui::MouseEvent* event) override; 166 void OnMouseEvent(ui::MouseEvent* event) override;
164 void OnScrollEvent(ui::ScrollEvent* event) override; 167 void OnScrollEvent(ui::ScrollEvent* event) override;
165 void OnGestureEvent(ui::GestureEvent* event) override; 168 void OnGestureEvent(ui::GestureEvent* event) override;
166 169
167 // Overridden from aura::client::ActivationDelegate: 170 // Overridden from aura::client::ActivationDelegate:
168 bool ShouldActivate() const override; 171 bool ShouldActivate() const override;
169 172
170 // Overridden from aura::client::ActivationChangeObserver: 173 // Overridden from aura::client::ActivationChangeObserver:
171 void OnWindowActivated( 174 void OnWindowActivated(
172 aura::client::ActivationChangeObserver::ActivationReason reason, 175 aura::client::ActivationChangeObserver::ActivationReason reason,
173 aura::Window* gained_active, 176 aura::Window* gained_active,
174 aura::Window* lost_active) override; 177 aura::Window* lost_active) override;
175 178
176 // Overridden from aura::client::FocusChangeObserver: 179 // Overridden from aura::client::FocusChangeObserver:
177 void OnWindowFocused(aura::Window* gained_focus, 180 void OnWindowFocused(aura::Window* gained_focus,
178 aura::Window* lost_focus) override; 181 aura::Window* lost_focus) override;
179 182
180 // Overridden from aura::client::DragDropDelegate: 183 // Overridden from aura::client::DragDropDelegate:
181 void OnDragEntered(const ui::DropTargetEvent& event) override; 184 void OnDragEntered(const ui::DropTargetEvent& event) override;
182 int OnDragUpdated(const ui::DropTargetEvent& event) override; 185 int OnDragUpdated(const ui::DropTargetEvent& event) override;
183 void OnDragExited() override; 186 void OnDragExited() override;
184 int OnPerformDrop(const ui::DropTargetEvent& event) override; 187 int OnPerformDrop(const ui::DropTargetEvent& event) override;
185 188
189 // Overridden from aura::WindowTreeHostObserver:
190 void OnHostCloseRequested(const aura::WindowTreeHost* host) override;
191 void OnHostResized(const aura::WindowTreeHost* host) override;
192 void OnHostMoved(const aura::WindowTreeHost* host,
193 const gfx::Point& new_origin) override;
194
186 protected: 195 protected:
187 ~NativeWidgetAura() override; 196 ~DesktopNativeWidgetAndroid() override;
188 197
189 internal::NativeWidgetDelegate* delegate() { return delegate_; } 198 internal::NativeWidgetDelegate* delegate() { return delegate_; }
190 199
191 private: 200 private:
192 class ActiveWindowObserver; 201 class ActiveWindowObserver;
193 202
194 bool IsDocked() const; 203 bool IsDocked() const;
195 void SetInitialFocus(ui::WindowShowState show_state); 204 void SetInitialFocus(ui::WindowShowState show_state);
196 205
197 internal::NativeWidgetDelegate* delegate_; 206 internal::NativeWidgetDelegate* delegate_;
(...skipping 13 matching lines...) Expand all
211 220
212 // The saved window state for exiting full screen state. 221 // The saved window state for exiting full screen state.
213 ui::WindowShowState saved_window_state_; 222 ui::WindowShowState saved_window_state_;
214 223
215 scoped_ptr<TooltipManagerAura> tooltip_manager_; 224 scoped_ptr<TooltipManagerAura> tooltip_manager_;
216 225
217 // Reorders child windows of |window_| associated with a view based on the 226 // Reorders child windows of |window_| associated with a view based on the
218 // order of the associated views in the widget's view hierarchy. 227 // order of the associated views in the widget's view hierarchy.
219 scoped_ptr<WindowReorderer> window_reorderer_; 228 scoped_ptr<WindowReorderer> window_reorderer_;
220 229
221 scoped_ptr<DropHelper> drop_helper_; 230 scoped_ptr<aura::WindowTreeHost> host_;
222 int last_drop_operation_; 231 scoped_ptr<wm::FocusController> focus_client_;
232 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
233 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
234 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_;
235 scoped_ptr<aura::client::DispatcherClient> dispatcher_client_;
223 236
224 // The following factory is used for calls to close the NativeWidgetAura 237 // The following factory is used for calls to close the
225 // instance. 238 // DesktopNativeWidgetAndroid instance.
226 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; 239 base::WeakPtrFactory<DesktopNativeWidgetAndroid> close_widget_factory_;
227 240
228 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); 241 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAndroid);
229 }; 242 };
230 243
231 } // namespace views 244 } // namespace views
232 245
233 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ 246 #endif // UI_VIEWS_WIDGET_DESKTOP_ANDROID_DESKTOP_NATIVE_WIDGET_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698