| OLD | NEW |
| 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 MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ | 5 #ifndef ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_ |
| 6 #define MASH_WM_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 "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "components/mus/public/cpp/window_observer.h" | 12 #include "components/mus/public/cpp/window_observer.h" |
| 13 #include "ui/views/widget/widget_delegate.h" | 13 #include "ui/views/widget/widget_delegate.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Insets; | 16 class Insets; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace mus { | 19 namespace mus { |
| 20 class Window; | 20 class Window; |
| 21 class WindowManagerClient; | 21 class WindowManagerClient; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace shell { | 24 namespace shell { |
| 25 class Connector; | 25 class Connector; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace mash { | 28 namespace ash { |
| 29 namespace wm { | 29 namespace mus { |
| 30 | 30 |
| 31 // Provides the non-client frame for mus Windows. | 31 // Provides the non-client frame for mus Windows. |
| 32 class NonClientFrameController : public views::WidgetDelegateView, | 32 class NonClientFrameController : public views::WidgetDelegateView, |
| 33 public mus::WindowObserver { | 33 public ::mus::WindowObserver { |
| 34 public: | 34 public: |
| 35 // NonClientFrameController deletes itself when |window| is destroyed. | 35 // NonClientFrameController deletes itself when |window| is destroyed. |
| 36 static void Create(shell::Connector* connector, | 36 static void Create(shell::Connector* connector, |
| 37 mus::Window* parent, | 37 ::mus::Window* parent, |
| 38 mus::Window* window, | 38 ::mus::Window* window, |
| 39 mus::WindowManagerClient* window_manager_client); | 39 ::mus::WindowManagerClient* window_manager_client); |
| 40 | 40 |
| 41 // Returns the preferred client area insets. | 41 // Returns the preferred client area insets. |
| 42 static gfx::Insets GetPreferredClientAreaInsets(); | 42 static gfx::Insets GetPreferredClientAreaInsets(); |
| 43 | 43 |
| 44 // Returns the width needed to display the standard set of buttons on the | 44 // Returns the width needed to display the standard set of buttons on the |
| 45 // title bar. | 45 // title bar. |
| 46 static int GetMaxTitleBarButtonWidth(); | 46 static int GetMaxTitleBarButtonWidth(); |
| 47 | 47 |
| 48 mus::Window* window() { return window_; } | 48 ::mus::Window* window() { return window_; } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 NonClientFrameController(shell::Connector* connector, | 51 NonClientFrameController(shell::Connector* connector, |
| 52 mus::Window* parent, | 52 ::mus::Window* parent, |
| 53 mus::Window* window, | 53 ::mus::Window* window, |
| 54 mus::WindowManagerClient* window_manager_client); | 54 ::mus::WindowManagerClient* window_manager_client); |
| 55 ~NonClientFrameController() override; | 55 ~NonClientFrameController() override; |
| 56 | 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 // mus::WindowObserver: | 66 // mus::WindowObserver: |
| 67 void OnWindowSharedPropertyChanged( | 67 void OnWindowSharedPropertyChanged( |
| 68 mus::Window* window, | 68 ::mus::Window* window, |
| 69 const std::string& name, | 69 const std::string& name, |
| 70 const std::vector<uint8_t>* old_data, | 70 const std::vector<uint8_t>* old_data, |
| 71 const std::vector<uint8_t>* new_data) override; | 71 const std::vector<uint8_t>* new_data) override; |
| 72 void OnWindowLocalPropertyChanged(mus::Window* window, | 72 void OnWindowLocalPropertyChanged(::mus::Window* window, |
| 73 const void* key, | 73 const void* key, |
| 74 intptr_t old) override; | 74 intptr_t old) override; |
| 75 void OnWindowDestroyed(mus::Window* window) override; | 75 void OnWindowDestroyed(::mus::Window* window) override; |
| 76 | 76 |
| 77 views::Widget* widget_; | 77 views::Widget* widget_; |
| 78 | 78 |
| 79 // WARNING: as widget delays destruction there is a portion of time when this | 79 // WARNING: as widget delays destruction there is a portion of time when this |
| 80 // is null. | 80 // is null. |
| 81 mus::Window* window_; | 81 ::mus::Window* window_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController); | 83 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace wm | 86 } // namespace mus |
| 87 } // namespace mash | 87 } // namespace ash |
| 88 | 88 |
| 89 #endif // MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ | 89 #endif // ASH_MUS_NON_CLIENT_FRAME_CONTROLLER_H_ |
| OLD | NEW |