| 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 #include "mash/wm/non_client_frame_controller.h" | 5 #include "mash/wm/non_client_frame_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 aura::Window* window_; | 85 aura::Window* window_; |
| 86 const ShadowStyle style_; | 86 const ShadowStyle style_; |
| 87 Shadow* shadow_; | 87 Shadow* shadow_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager); | 89 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 class WmNativeWidgetMus : public views::NativeWidgetMus { | 92 class WmNativeWidgetMus : public views::NativeWidgetMus { |
| 93 public: | 93 public: |
| 94 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, | 94 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, |
| 95 mojo::Connector* connector, | 95 shell::Connector* connector, |
| 96 mus::Window* window) | 96 mus::Window* window) |
| 97 : NativeWidgetMus(delegate, connector, window, | 97 : NativeWidgetMus(delegate, |
| 98 connector, |
| 99 window, |
| 98 mus::mojom::SurfaceType::UNDERLAY) {} | 100 mus::mojom::SurfaceType::UNDERLAY) {} |
| 99 ~WmNativeWidgetMus() override { | 101 ~WmNativeWidgetMus() override { |
| 100 } | 102 } |
| 101 | 103 |
| 102 // NativeWidgetMus: | 104 // NativeWidgetMus: |
| 103 views::NonClientFrameView* CreateNonClientFrameView() override { | 105 views::NonClientFrameView* CreateNonClientFrameView() override { |
| 104 views::Widget* widget = | 106 views::Widget* widget = |
| 105 static_cast<views::internal::NativeWidgetPrivate*>(this)->GetWidget(); | 107 static_cast<views::internal::NativeWidgetPrivate*>(this)->GetWidget(); |
| 106 NonClientFrameViewMash* frame_view = | 108 NonClientFrameViewMash* frame_view = |
| 107 new NonClientFrameViewMash(widget, window()); | 109 new NonClientFrameViewMash(widget, window()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 private: | 172 private: |
| 171 NonClientFrameController* frame_controller_; | 173 NonClientFrameController* frame_controller_; |
| 172 | 174 |
| 173 DISALLOW_COPY_AND_ASSIGN(ClientViewMus); | 175 DISALLOW_COPY_AND_ASSIGN(ClientViewMus); |
| 174 }; | 176 }; |
| 175 | 177 |
| 176 } // namespace | 178 } // namespace |
| 177 | 179 |
| 178 // static | 180 // static |
| 179 void NonClientFrameController::Create( | 181 void NonClientFrameController::Create( |
| 180 mojo::Connector* connector, | 182 shell::Connector* connector, |
| 181 mus::Window* window, | 183 mus::Window* window, |
| 182 mus::WindowManagerClient* window_manager_client) { | 184 mus::WindowManagerClient* window_manager_client) { |
| 183 new NonClientFrameController(connector, window, window_manager_client); | 185 new NonClientFrameController(connector, window, window_manager_client); |
| 184 } | 186 } |
| 185 | 187 |
| 186 // static | 188 // static |
| 187 gfx::Insets NonClientFrameController::GetPreferredClientAreaInsets() { | 189 gfx::Insets NonClientFrameController::GetPreferredClientAreaInsets() { |
| 188 return NonClientFrameViewMash::GetPreferredClientAreaInsets(); | 190 return NonClientFrameViewMash::GetPreferredClientAreaInsets(); |
| 189 } | 191 } |
| 190 | 192 |
| 191 // static | 193 // static |
| 192 int NonClientFrameController::GetMaxTitleBarButtonWidth() { | 194 int NonClientFrameController::GetMaxTitleBarButtonWidth() { |
| 193 return NonClientFrameViewMash::GetMaxTitleBarButtonWidth(); | 195 return NonClientFrameViewMash::GetMaxTitleBarButtonWidth(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 NonClientFrameController::NonClientFrameController( | 198 NonClientFrameController::NonClientFrameController( |
| 197 mojo::Connector* connector, | 199 shell::Connector* connector, |
| 198 mus::Window* window, | 200 mus::Window* window, |
| 199 mus::WindowManagerClient* window_manager_client) | 201 mus::WindowManagerClient* window_manager_client) |
| 200 : widget_(new views::Widget), window_(window) { | 202 : widget_(new views::Widget), window_(window) { |
| 201 window_->AddObserver(this); | 203 window_->AddObserver(this); |
| 202 | 204 |
| 203 // To simplify things this code creates a Widget. While a Widget is created | 205 // To simplify things this code creates a Widget. While a Widget is created |
| 204 // we need to ensure we don't inadvertently change random properties of the | 206 // we need to ensure we don't inadvertently change random properties of the |
| 205 // underlying mus::Window. For example, showing the Widget shouldn't change | 207 // underlying mus::Window. For example, showing the Widget shouldn't change |
| 206 // the bounds of the mus::Window in anyway. | 208 // the bounds of the mus::Window in anyway. |
| 207 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 209 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 widget_->UpdateWindowTitle(); | 280 widget_->UpdateWindowTitle(); |
| 279 } | 281 } |
| 280 | 282 |
| 281 void NonClientFrameController::OnWindowDestroyed(mus::Window* window) { | 283 void NonClientFrameController::OnWindowDestroyed(mus::Window* window) { |
| 282 window_->RemoveObserver(this); | 284 window_->RemoveObserver(this); |
| 283 window_ = nullptr; | 285 window_ = nullptr; |
| 284 } | 286 } |
| 285 | 287 |
| 286 } // namespace wm | 288 } // namespace wm |
| 287 } // namespace mash | 289 } // namespace mash |
| OLD | NEW |