| 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 MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ |
| 6 #define MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ | 6 #define MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/mus/public/cpp/window_observer.h" | 9 #include "components/mus/public/cpp/window_observer.h" |
| 10 #include "ui/views/widget/widget_delegate.h" | 10 #include "ui/views/widget/widget_delegate.h" |
| 11 | 11 |
| 12 namespace gfx { |
| 13 class Insets; |
| 14 } |
| 15 |
| 12 namespace mojo { | 16 namespace mojo { |
| 13 class Shell; | 17 class Shell; |
| 14 } | 18 } |
| 15 | 19 |
| 16 namespace mus { | 20 namespace mus { |
| 17 class Window; | 21 class Window; |
| 18 } | 22 } |
| 19 | 23 |
| 20 // Provides the non-client frame for mus Windows. | 24 // Provides the non-client frame for mus Windows. |
| 21 class NonClientFrameController : public views::WidgetDelegateView, | 25 class NonClientFrameController : public views::WidgetDelegateView, |
| 22 public mus::WindowObserver { | 26 public mus::WindowObserver { |
| 23 public: | 27 public: |
| 24 // NonClientFrameController deletes itself when |window| is destroyed. | 28 // NonClientFrameController deletes itself when |window| is destroyed. |
| 25 NonClientFrameController(mojo::Shell* shell, mus::Window* window); | 29 NonClientFrameController(mojo::Shell* shell, mus::Window* window); |
| 26 | 30 |
| 31 // Returns the preferred client area insets. |
| 32 static gfx::Insets GetPreferredClientAreaInsets(); |
| 33 |
| 27 private: | 34 private: |
| 28 ~NonClientFrameController() override; | 35 ~NonClientFrameController() override; |
| 29 | 36 |
| 30 // views::WidgetDelegateView: | 37 // views::WidgetDelegateView: |
| 31 views::View* GetContentsView() override; | 38 views::View* GetContentsView() override; |
| 32 bool CanResize() const override; | 39 bool CanResize() const override; |
| 33 bool CanMaximize() const override; | 40 bool CanMaximize() const override; |
| 34 bool CanMinimize() const override; | 41 bool CanMinimize() const override; |
| 35 | 42 |
| 36 // mus::WindowObserver: | 43 // mus::WindowObserver: |
| 37 void OnWindowSharedPropertyChanged( | 44 void OnWindowSharedPropertyChanged( |
| 38 mus::Window* window, | 45 mus::Window* window, |
| 39 const std::string& name, | 46 const std::string& name, |
| 40 const std::vector<uint8_t>* old_data, | 47 const std::vector<uint8_t>* old_data, |
| 41 const std::vector<uint8_t>* new_data) override; | 48 const std::vector<uint8_t>* new_data) override; |
| 42 void OnWindowDestroyed(mus::Window* window) override; | 49 void OnWindowDestroyed(mus::Window* window) override; |
| 43 | 50 |
| 44 views::Widget* widget_; | 51 views::Widget* widget_; |
| 45 | 52 |
| 46 // WARNING: as widget delays destruction there is a portion of time when this | 53 // WARNING: as widget delays destruction there is a portion of time when this |
| 47 // is null. | 54 // is null. |
| 48 mus::Window* window_; | 55 mus::Window* window_; |
| 49 | 56 |
| 50 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController); | 57 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController); |
| 51 }; | 58 }; |
| 52 | 59 |
| 53 #endif // MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ | 60 #endif // MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ |
| OLD | NEW |