| 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 "mandoline/ui/aura/window_tree_host_mojo.h" | 5 #include "mandoline/ui/aura/window_tree_host_mojo.h" |
| 6 | 6 |
| 7 #include "components/mus/public/cpp/view_tree_connection.h" | 7 #include "components/mus/public/cpp/view_tree_connection.h" |
| 8 #include "mandoline/ui/aura/input_method_mandoline.h" | 8 #include "mandoline/ui/aura/input_method_mandoline.h" |
| 9 #include "mandoline/ui/aura/surface_context_factory.h" | 9 #include "mandoline/ui/aura/surface_context_factory.h" |
| 10 #include "mojo/application/public/interfaces/shell.mojom.h" | 10 #include "mojo/application/public/interfaces/shell.mojom.h" |
| 11 #include "mojo/converters/geometry/geometry_type_converters.h" | 11 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
| 15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
| 16 #include "ui/events/event_constants.h" | 16 #include "ui/events/event_constants.h" |
| 17 | 17 |
| 18 namespace mandoline { | 18 namespace mandoline { |
| 19 | 19 |
| 20 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
| 21 // WindowTreeHostMojo, public: | 21 // WindowTreeHostMojo, public: |
| 22 | 22 |
| 23 WindowTreeHostMojo::WindowTreeHostMojo(mojo::Shell* shell, mojo::View* view) | 23 WindowTreeHostMojo::WindowTreeHostMojo(mojo::Shell* shell, mus::View* view) |
| 24 : view_(view), bounds_(view->bounds().To<gfx::Rect>()) { | 24 : view_(view), bounds_(view->bounds().To<gfx::Rect>()) { |
| 25 view_->AddObserver(this); | 25 view_->AddObserver(this); |
| 26 | 26 |
| 27 context_factory_.reset(new SurfaceContextFactory(shell, view_)); | 27 context_factory_.reset(new SurfaceContextFactory(shell, view_)); |
| 28 // WindowTreeHost creates the compositor using the ContextFactory from | 28 // WindowTreeHost creates the compositor using the ContextFactory from |
| 29 // aura::Env. Install |context_factory_| there so that |context_factory_| is | 29 // aura::Env. Install |context_factory_| there so that |context_factory_| is |
| 30 // picked up. | 30 // picked up. |
| 31 ui::ContextFactory* default_context_factory = | 31 ui::ContextFactory* default_context_factory = |
| 32 aura::Env::GetInstance()->context_factory(); | 32 aura::Env::GetInstance()->context_factory(); |
| 33 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); | 33 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 NOTIMPLEMENTED(); | 92 NOTIMPLEMENTED(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) { | 95 void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) { |
| 96 NOTIMPLEMENTED(); | 96 NOTIMPLEMENTED(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 //////////////////////////////////////////////////////////////////////////////// | 99 //////////////////////////////////////////////////////////////////////////////// |
| 100 // WindowTreeHostMojo, ViewObserver implementation: | 100 // WindowTreeHostMojo, ViewObserver implementation: |
| 101 | 101 |
| 102 void WindowTreeHostMojo::OnViewBoundsChanged( | 102 void WindowTreeHostMojo::OnViewBoundsChanged(mus::View* view, |
| 103 mojo::View* view, | 103 const mojo::Rect& old_bounds, |
| 104 const mojo::Rect& old_bounds, | 104 const mojo::Rect& new_bounds) { |
| 105 const mojo::Rect& new_bounds) { | |
| 106 gfx::Rect old_bounds2 = old_bounds.To<gfx::Rect>(); | 105 gfx::Rect old_bounds2 = old_bounds.To<gfx::Rect>(); |
| 107 gfx::Rect new_bounds2 = new_bounds.To<gfx::Rect>(); | 106 gfx::Rect new_bounds2 = new_bounds.To<gfx::Rect>(); |
| 108 bounds_ = new_bounds2; | 107 bounds_ = new_bounds2; |
| 109 if (old_bounds2.origin() != new_bounds2.origin()) | 108 if (old_bounds2.origin() != new_bounds2.origin()) |
| 110 OnHostMoved(bounds_.origin()); | 109 OnHostMoved(bounds_.origin()); |
| 111 if (old_bounds2.size() != new_bounds2.size()) | 110 if (old_bounds2.size() != new_bounds2.size()) |
| 112 OnHostResized(bounds_.size()); | 111 OnHostResized(bounds_.size()); |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace mandoline | 114 } // namespace mandoline |
| OLD | NEW |