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

Side by Side Diff: ash/wm/immersive_fullscreen_controller.h

Issue 2222653002: Moves CustomFrameViewAsh to common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 4 months 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
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/immersive_fullscreen_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 ASH_WM_IMMERSIVE_FULLSCREEN_CONTROLLER_H_ 5 #ifndef ASH_WM_IMMERSIVE_FULLSCREEN_CONTROLLER_H_
6 #define ASH_WM_IMMERSIVE_FULLSCREEN_CONTROLLER_H_ 6 #define ASH_WM_IMMERSIVE_FULLSCREEN_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller.h"
12 #include "ash/common/wm/immersive_revealed_lock.h" 13 #include "ash/common/wm/immersive_revealed_lock.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
15 #include "ui/aura/window_observer.h" 16 #include "ui/aura/window_observer.h"
16 #include "ui/events/event_handler.h" 17 #include "ui/events/event_handler.h"
17 #include "ui/gfx/animation/animation_delegate.h" 18 #include "ui/gfx/animation/animation_delegate.h"
18 #include "ui/views/focus/focus_manager.h" 19 #include "ui/views/focus/focus_manager.h"
19 #include "ui/views/widget/widget_observer.h" 20 #include "ui/views/widget/widget_observer.h"
20 #include "ui/wm/core/transient_window_observer.h" 21 #include "ui/wm/core/transient_window_observer.h"
21 22
(...skipping 12 matching lines...) Expand all
34 } 35 }
35 36
36 namespace views { 37 namespace views {
37 class View; 38 class View;
38 class Widget; 39 class Widget;
39 } 40 }
40 41
41 namespace ash { 42 namespace ash {
42 43
43 class ASH_EXPORT ImmersiveFullscreenController 44 class ASH_EXPORT ImmersiveFullscreenController
44 : public gfx::AnimationDelegate, 45 : public WmImmersiveFullscreenController,
46 public gfx::AnimationDelegate,
45 public ui::EventHandler, 47 public ui::EventHandler,
46 public ::wm::TransientWindowObserver, 48 public ::wm::TransientWindowObserver,
47 public views::FocusChangeListener, 49 public views::FocusChangeListener,
48 public views::WidgetObserver, 50 public views::WidgetObserver,
49 public ImmersiveRevealedLock::Delegate { 51 public ImmersiveRevealedLock::Delegate {
50 public: 52 public:
51 static const int kMouseRevealBoundsHeight; 53 static const int kMouseRevealBoundsHeight;
52 54
53 // The enum is used for an enumerated histogram. New items should be only
54 // added to the end.
55 enum WindowType {
56 WINDOW_TYPE_OTHER,
57 WINDOW_TYPE_BROWSER,
58 WINDOW_TYPE_HOSTED_APP,
59 WINDOW_TYPE_PACKAGED_APP,
60 WINDOW_TYPE_COUNT
61 };
62
63 class Delegate {
64 public:
65 // Called when a reveal of the top-of-window views starts.
66 virtual void OnImmersiveRevealStarted() = 0;
67
68 // Called when the top-of-window views have finished closing. This call
69 // implies a visible fraction of 0. SetVisibleFraction(0) may not be called
70 // prior to OnImmersiveRevealEnded().
71 virtual void OnImmersiveRevealEnded() = 0;
72
73 // Called as a result of disabling immersive fullscreen via SetEnabled().
74 virtual void OnImmersiveFullscreenExited() = 0;
75
76 // Called to update the fraction of the top-of-window views height which is
77 // visible.
78 virtual void SetVisibleFraction(double visible_fraction) = 0;
79
80 // Returns a list of rects whose union makes up the top-of-window views.
81 // The returned list is used for hittesting when the top-of-window views
82 // are revealed. GetVisibleBoundsInScreen() must return a valid value when
83 // not in immersive fullscreen for the sake of SetupForTest().
84 virtual std::vector<gfx::Rect> GetVisibleBoundsInScreen() const = 0;
85
86 protected:
87 virtual ~Delegate() {}
88 };
89
90 ImmersiveFullscreenController(); 55 ImmersiveFullscreenController();
91 ~ImmersiveFullscreenController() override; 56 ~ImmersiveFullscreenController() override;
92 57
93 // Initializes the controller. Must be called prior to enabling immersive 58 // WmImmersiveFullscreenController overrides:
94 // fullscreen via SetEnabled(). |top_container| is used to keep the 59 void Init(WmImmersiveFullscreenControllerDelegate* delegate,
95 // top-of-window views revealed when a child of |top_container| has focus.
96 // |top_container| does not affect which mouse and touch events keep the
97 // top-of-window views revealed.
98 void Init(Delegate* delegate,
99 views::Widget* widget, 60 views::Widget* widget,
100 views::View* top_container); 61 views::View* top_container) override;
101 62 void SetEnabled(WindowType window_type, bool enable) override;
102 // Enables or disables immersive fullscreen. 63 bool IsEnabled() const override;
103 // |window_type| is the type of window which is put in immersive fullscreen. 64 bool IsRevealed() const override;
104 // It is only used for histogramming.
105 void SetEnabled(WindowType window_type, bool enable);
106
107 // Returns true if |native_window_| is in immersive fullscreen.
108 bool IsEnabled() const;
109
110 // Returns true if |native_window_| is in immersive fullscreen and the
111 // top-of-window views are fully or partially visible.
112 bool IsRevealed() const;
113 65
114 // Returns a lock which will keep the top-of-window views revealed for its 66 // Returns a lock which will keep the top-of-window views revealed for its
115 // lifetime. Several locks can be obtained. When all of the locks are 67 // lifetime. Several locks can be obtained. When all of the locks are
116 // destroyed, if immersive fullscreen is enabled and there is nothing else 68 // destroyed, if immersive fullscreen is enabled and there is nothing else
117 // keeping the top-of-window views revealed, the top-of-window views will be 69 // keeping the top-of-window views revealed, the top-of-window views will be
118 // closed. This method always returns a valid lock regardless of whether 70 // closed. This method always returns a valid lock regardless of whether
119 // immersive fullscreen is enabled. The lock's lifetime can span immersive 71 // immersive fullscreen is enabled. The lock's lifetime can span immersive
120 // fullscreen being enabled / disabled. If acquiring the lock causes a reveal, 72 // fullscreen being enabled / disabled. If acquiring the lock causes a reveal,
121 // the top-of-window views will animate according to |animate_reveal|. The 73 // the top-of-window views will animate according to |animate_reveal|. The
122 // caller takes ownership of the returned lock. 74 // caller takes ownership of the returned lock.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // bounds, above it, or within a few pixels below it. This allow the container 185 // bounds, above it, or within a few pixels below it. This allow the container
234 // to steal enough pixels to detect a swipe in and handles the case that there 186 // to steal enough pixels to detect a swipe in and handles the case that there
235 // is a bezel sensor above the top container. 187 // is a bezel sensor above the top container.
236 bool ShouldHandleGestureEvent(const gfx::Point& location) const; 188 bool ShouldHandleGestureEvent(const gfx::Point& location) const;
237 189
238 // Recreate |bubble_observer_| and start observing any bubbles anchored to a 190 // Recreate |bubble_observer_| and start observing any bubbles anchored to a
239 // child of |top_container_|. 191 // child of |top_container_|.
240 void RecreateBubbleObserver(); 192 void RecreateBubbleObserver();
241 193
242 // Not owned. 194 // Not owned.
243 Delegate* delegate_; 195 WmImmersiveFullscreenControllerDelegate* delegate_;
244 views::View* top_container_; 196 views::View* top_container_;
245 views::Widget* widget_; 197 views::Widget* widget_;
246 aura::Window* native_window_; 198 aura::Window* native_window_;
247 199
248 // True if the observers have been enabled. 200 // True if the observers have been enabled.
249 bool observers_enabled_; 201 bool observers_enabled_;
250 202
251 // True when in immersive fullscreen. 203 // True when in immersive fullscreen.
252 bool enabled_; 204 bool enabled_;
253 205
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 std::unique_ptr<BubbleObserver> bubble_observer_; 241 std::unique_ptr<BubbleObserver> bubble_observer_;
290 242
291 base::WeakPtrFactory<ImmersiveFullscreenController> weak_ptr_factory_; 243 base::WeakPtrFactory<ImmersiveFullscreenController> weak_ptr_factory_;
292 244
293 DISALLOW_COPY_AND_ASSIGN(ImmersiveFullscreenController); 245 DISALLOW_COPY_AND_ASSIGN(ImmersiveFullscreenController);
294 }; 246 };
295 247
296 } // namespace ash 248 } // namespace ash
297 249
298 #endif // ASH_WM_IMMERSIVE_FULLSCREEN_CONTROLLER_H_ 250 #endif // ASH_WM_IMMERSIVE_FULLSCREEN_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/immersive_fullscreen_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698