Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / immersive_mode_controller_ash.h
blobe6dfe31cfe48a8dd806b08a97f59a009d6f46761
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_
8 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
10 #include "ash/wm/immersive_fullscreen_controller.h"
11 #include "ash/wm/window_state_observer.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/gfx/geometry/rect.h"
17 namespace aura {
18 class Window;
21 class ImmersiveModeControllerAsh
22 : public ImmersiveModeController,
23 public ash::ImmersiveFullscreenController::Delegate,
24 public ash::wm::WindowStateObserver,
25 public content::NotificationObserver {
26 public:
27 ImmersiveModeControllerAsh();
28 ~ImmersiveModeControllerAsh() override;
30 // ImmersiveModeController overrides:
31 void Init(BrowserView* browser_view) override;
32 void SetEnabled(bool enabled) override;
33 bool IsEnabled() const override;
34 bool ShouldHideTabIndicators() const override;
35 bool ShouldHideTopViews() const override;
36 bool IsRevealed() const override;
37 int GetTopContainerVerticalOffset(
38 const gfx::Size& top_container_size) const override;
39 ImmersiveRevealedLock* GetRevealedLock(AnimateReveal animate_reveal) override
40 WARN_UNUSED_RESULT;
41 void OnFindBarVisibleBoundsChanged(
42 const gfx::Rect& new_visible_bounds_in_screen) override;
43 void SetupForTest() override;
45 private:
46 // Enables or disables observers for window restore and entering / exiting
47 // tab fullscreen.
48 void EnableWindowObservers(bool enable);
50 // Updates the browser root view's layout including window caption controls.
51 void LayoutBrowserRootView();
53 // Updates whether the tab strip is painted in a short "light bar" style.
54 // Returns true if the visibility of the tab indicators has changed.
55 bool UpdateTabIndicators();
57 // ImmersiveFullscreenController::Delegate overrides:
58 void OnImmersiveRevealStarted() override;
59 void OnImmersiveRevealEnded() override;
60 void OnImmersiveFullscreenExited() override;
61 void SetVisibleFraction(double visible_fraction) override;
62 std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override;
64 // ash::wm::WindowStateObserver override:
65 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state,
66 ash::wm::WindowStateType old_type) override;
68 // content::NotificationObserver override:
69 void Observe(int type,
70 const content::NotificationSource& source,
71 const content::NotificationDetails& details) override;
73 scoped_ptr<ash::ImmersiveFullscreenController> controller_;
75 // Not owned.
76 BrowserView* browser_view_;
77 aura::Window* native_window_;
79 // True if the observers for window restore and entering / exiting tab
80 // fullscreen are enabled.
81 bool observers_enabled_;
83 // Whether a short "light bar" version of the tab strip should be painted when
84 // the top-of-window views are closed. If |use_tab_indicators_| is false, the
85 // tab strip is not painted at all when the top-of-window views are closed.
86 bool use_tab_indicators_;
88 // The current visible bounds of the find bar, in screen coordinates. This is
89 // an empty rect if the find bar is not visible.
90 gfx::Rect find_bar_visible_bounds_in_screen_;
92 // The fraction of the TopContainerView's height which is visible. Zero when
93 // the top-of-window views are not revealed regardless of
94 // |use_tab_indicators_|.
95 double visible_fraction_;
97 content::NotificationRegistrar registrar_;
99 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAsh);
102 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_