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

Side by Side Diff: ash/mus/non_client_frame_controller.h

Issue 2277563002: Wires up immersive mode for chrome and mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback 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
OLDNEW
1 // Copyright 2015 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 ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_ 5 #ifndef ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_
6 #define ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_ 6 #define ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "ash/mus/frame/detached_title_area_renderer_host.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
12 #include "services/ui/public/cpp/window_observer.h" 13 #include "services/ui/public/cpp/window_observer.h"
13 #include "ui/views/widget/widget_delegate.h" 14 #include "ui/views/widget/widget_delegate.h"
14 15
15 namespace gfx { 16 namespace gfx {
16 class Insets; 17 class Insets;
17 } 18 }
18 19
19 namespace shell {
20 class Connector;
21 }
22
23 namespace ui { 20 namespace ui {
24 class Window; 21 class Window;
25 class WindowManagerClient; 22 class WindowManagerClient;
26 } 23 }
27 24
28 namespace ash { 25 namespace ash {
29 namespace mus { 26 namespace mus {
30 27
31 // Provides the non-client frame for mus Windows. 28 // Provides the non-client frame for mus Windows.
32 class NonClientFrameController : public views::WidgetDelegateView, 29 class NonClientFrameController : public views::WidgetDelegateView,
33 public ui::WindowObserver { 30 public ui::WindowObserver,
31 public DetachedTitleAreaRendererHost {
34 public: 32 public:
35 // NonClientFrameController deletes itself when |window| is destroyed. 33 // NonClientFrameController deletes itself when |window| is destroyed.
36 static void Create(shell::Connector* connector, 34 static void Create(ui::Window* parent,
37 ui::Window* parent,
38 ui::Window* window, 35 ui::Window* window,
39 ui::WindowManagerClient* window_manager_client); 36 ui::WindowManagerClient* window_manager_client);
40 37
41 // Returns the preferred client area insets. 38 // Returns the preferred client area insets.
42 static gfx::Insets GetPreferredClientAreaInsets(); 39 static gfx::Insets GetPreferredClientAreaInsets();
43 40
44 // Returns the width needed to display the standard set of buttons on the 41 // Returns the width needed to display the standard set of buttons on the
45 // title bar. 42 // title bar.
46 static int GetMaxTitleBarButtonWidth(); 43 static int GetMaxTitleBarButtonWidth();
47 44
48 ui::Window* window() { return window_; } 45 ui::Window* window() { return window_; }
49 46
50 private: 47 private:
51 NonClientFrameController(shell::Connector* connector, 48 NonClientFrameController(ui::Window* parent,
52 ui::Window* parent,
53 ui::Window* window, 49 ui::Window* window,
54 ui::WindowManagerClient* window_manager_client); 50 ui::WindowManagerClient* window_manager_client);
55 ~NonClientFrameController() override; 51 ~NonClientFrameController() override;
56 52
53 // DetachedTitleAreaRendererHost:
54 void OnDetachedTitleAreaRendererDestroyed(
55 DetachedTitleAreaRenderer* renderer) override;
56
57 // views::WidgetDelegateView: 57 // views::WidgetDelegateView:
58 base::string16 GetWindowTitle() const override; 58 base::string16 GetWindowTitle() const override;
59 views::View* GetContentsView() override; 59 views::View* GetContentsView() override;
60 bool CanResize() const override; 60 bool CanResize() const override;
61 bool CanMaximize() const override; 61 bool CanMaximize() const override;
62 bool CanMinimize() const override; 62 bool CanMinimize() const override;
63 bool ShouldShowWindowTitle() const override; 63 bool ShouldShowWindowTitle() const override;
64 views::ClientView* CreateClientView(views::Widget* widget) override; 64 views::ClientView* CreateClientView(views::Widget* widget) override;
65 65
66 // ui::WindowObserver: 66 // ui::WindowObserver:
67 void OnTreeChanged(const TreeChangeParams& params) override;
67 void OnWindowSharedPropertyChanged( 68 void OnWindowSharedPropertyChanged(
68 ui::Window* window, 69 ui::Window* window,
69 const std::string& name, 70 const std::string& name,
70 const std::vector<uint8_t>* old_data, 71 const std::vector<uint8_t>* old_data,
71 const std::vector<uint8_t>* new_data) override; 72 const std::vector<uint8_t>* new_data) override;
72 void OnWindowLocalPropertyChanged(ui::Window* window, 73 void OnWindowLocalPropertyChanged(ui::Window* window,
73 const void* key, 74 const void* key,
74 intptr_t old) override; 75 intptr_t old) override;
75 void OnWindowDestroyed(ui::Window* window) override; 76 void OnWindowDestroyed(ui::Window* window) override;
76 77
77 views::Widget* widget_; 78 views::Widget* widget_;
78 79
79 // WARNING: as widget delays destruction there is a portion of time when this 80 // WARNING: as widget delays destruction there is a portion of time when this
80 // is null. 81 // is null.
81 ui::Window* window_; 82 ui::Window* window_;
82 83
84 // Used if a child window is added that has the
85 // kRendererParentTitleArea_Property set.
86 DetachedTitleAreaRenderer* detached_title_area_renderer_ = nullptr;
87
83 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController); 88 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController);
84 }; 89 };
85 90
86 } // namespace mus 91 } // namespace mus
87 } // namespace ash 92 } // namespace ash
88 93
89 #endif // ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_ 94 #endif // ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698