| 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 "ui/views/mus/native_widget_view_manager.h" | 5 #include "ui/views/mus/native_widget_view_manager.h" |
| 6 | 6 |
| 7 #include "components/mus/public/cpp/window.h" | 7 #include "components/mus/public/cpp/window.h" |
| 8 #include "components/mus/public/interfaces/window_manager.mojom.h" | 8 #include "components/mus/public/interfaces/window_manager.mojom.h" |
| 9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 10 #include "ui/aura/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 if (view_manager_->window_) | 46 if (view_manager_->window_) |
| 47 view_manager_->window_->RemoveObserver(this); | 47 view_manager_->window_->RemoveObserver(this); |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // WindowObserver: | 51 // WindowObserver: |
| 52 void OnWindowDestroyed(mus::Window* view) override { | 52 void OnWindowDestroyed(mus::Window* view) override { |
| 53 DCHECK_EQ(view, view_manager_->window_); | 53 DCHECK_EQ(view, view_manager_->window_); |
| 54 view->RemoveObserver(this); | 54 view->RemoveObserver(this); |
| 55 view_manager_->window_ = nullptr; | 55 view_manager_->window_ = nullptr; |
| 56 // TODO(sky): WindowTreeHostMojo assumes the View outlives it. | 56 // TODO(sky): WindowTreeHostMus assumes the View outlives it. |
| 57 // NativeWidgetWindowObserver needs to deal, likely by deleting this. | 57 // NativeWidgetWindowObserver needs to deal, likely by deleting this. |
| 58 } | 58 } |
| 59 | 59 |
| 60 NativeWidgetViewManager* const view_manager_; | 60 NativeWidgetViewManager* const view_manager_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWindowObserver); | 62 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWindowObserver); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class WindowTreeHostWindowLayoutManager : public aura::LayoutManager { | 65 class WindowTreeHostWindowLayoutManager : public aura::LayoutManager { |
| 66 public: | 66 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 87 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostWindowLayoutManager); | 87 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostWindowLayoutManager); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace | 90 } // namespace |
| 91 | 91 |
| 92 NativeWidgetViewManager::NativeWidgetViewManager( | 92 NativeWidgetViewManager::NativeWidgetViewManager( |
| 93 views::internal::NativeWidgetDelegate* delegate, | 93 views::internal::NativeWidgetDelegate* delegate, |
| 94 mojo::Shell* shell, | 94 mojo::Shell* shell, |
| 95 mus::Window* window) | 95 mus::Window* window) |
| 96 : NativeWidgetAura(delegate), window_(window), window_manager_(nullptr) { | 96 : NativeWidgetAura(delegate), window_(window), window_manager_(nullptr) { |
| 97 window_tree_host_.reset(new WindowTreeHostMojo(shell, window_)); | 97 window_tree_host_.reset(new WindowTreeHostMus(shell, window_)); |
| 98 window_tree_host_->InitHost(); | 98 window_tree_host_->InitHost(); |
| 99 | 99 |
| 100 focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); | 100 focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); |
| 101 | 101 |
| 102 aura::client::SetFocusClient(window_tree_host_->window(), | 102 aura::client::SetFocusClient(window_tree_host_->window(), |
| 103 focus_client_.get()); | 103 focus_client_.get()); |
| 104 aura::client::SetActivationClient(window_tree_host_->window(), | 104 aura::client::SetActivationClient(window_tree_host_->window(), |
| 105 focus_client_.get()); | 105 focus_client_.get()); |
| 106 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); | 106 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); |
| 107 window_tree_host_->window()->SetLayoutManager( | 107 window_tree_host_->window()->SetLayoutManager( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 NativeWidgetAura::SetSize(size); | 154 NativeWidgetAura::SetSize(size); |
| 155 if (!window_manager_) | 155 if (!window_manager_) |
| 156 return; | 156 return; |
| 157 gfx::Rect bounds(window_->bounds().x(), window_->bounds().y(), size.width(), | 157 gfx::Rect bounds(window_->bounds().x(), window_->bounds().y(), size.width(), |
| 158 size.height()); | 158 size.height()); |
| 159 window_manager_->SetBounds(window_->id(), mojo::Rect::From(bounds), | 159 window_manager_->SetBounds(window_->id(), mojo::Rect::From(bounds), |
| 160 base::Bind(&WindowManagerCallback)); | 160 base::Bind(&WindowManagerCallback)); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace views | 163 } // namespace views |
| OLD | NEW |