Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/views/mus/window_tree_host_mus.cc

Issue 1402213002: Moves mandoline/ui/aura to ui/views/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable presubmit Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/mus/window_tree_host_mus.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/mus/window_tree_host_mus.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"
9 #include "mandoline/ui/aura/surface_context_factory.h"
10 #include "mojo/application/public/interfaces/shell.mojom.h" 8 #include "mojo/application/public/interfaces/shell.mojom.h"
11 #include "mojo/converters/geometry/geometry_type_converters.h" 9 #include "mojo/converters/geometry/geometry_type_converters.h"
12 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
13 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
14 #include "ui/aura/window_event_dispatcher.h" 12 #include "ui/aura/window_event_dispatcher.h"
15 #include "ui/events/event.h" 13 #include "ui/events/event.h"
16 #include "ui/events/event_constants.h" 14 #include "ui/events/event_constants.h"
15 #include "ui/views/mus/input_method_mus.h"
16 #include "ui/views/mus/surface_context_factory.h"
17 17
18 namespace mandoline { 18 namespace views {
19 19
20 //////////////////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////////////////
21 // WindowTreeHostMojo, public: 21 // WindowTreeHostMojo, public:
22 22
23 WindowTreeHostMojo::WindowTreeHostMojo(mojo::Shell* shell, mus::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());
34 CreateCompositor(); 34 CreateCompositor();
35 OnAcceleratedWidgetAvailable(); 35 OnAcceleratedWidgetAvailable();
36 aura::Env::GetInstance()->set_context_factory(default_context_factory); 36 aura::Env::GetInstance()->set_context_factory(default_context_factory);
37 DCHECK_EQ(context_factory_.get(), compositor()->context_factory()); 37 DCHECK_EQ(context_factory_.get(), compositor()->context_factory());
38 38
39 input_method_.reset(new InputMethodMandoline(this, view_)); 39 input_method_.reset(new InputMethodMUS(this, view_));
40 SetSharedInputMethod(input_method_.get()); 40 SetSharedInputMethod(input_method_.get());
41 } 41 }
42 42
43 WindowTreeHostMojo::~WindowTreeHostMojo() { 43 WindowTreeHostMojo::~WindowTreeHostMojo() {
44 view_->RemoveObserver(this); 44 view_->RemoveObserver(this);
45 DestroyCompositor(); 45 DestroyCompositor();
46 DestroyDispatcher(); 46 DestroyDispatcher();
47 } 47 }
48 48
49 //////////////////////////////////////////////////////////////////////////////// 49 ////////////////////////////////////////////////////////////////////////////////
50 // WindowTreeHostMojo, aura::WindowTreeHost implementation: 50 // WindowTreeHostMojo, aura::WindowTreeHost implementation:
51 51
52 ui::EventSource* WindowTreeHostMojo::GetEventSource() { 52 ui::EventSource* WindowTreeHostMojo::GetEventSource() {
53 return this; 53 return this;
54 } 54 }
55 55
56 gfx::AcceleratedWidget WindowTreeHostMojo::GetAcceleratedWidget() { 56 gfx::AcceleratedWidget WindowTreeHostMojo::GetAcceleratedWidget() {
57 return gfx::kNullAcceleratedWidget; 57 return gfx::kNullAcceleratedWidget;
58 } 58 }
59 59
60 void WindowTreeHostMojo::ShowImpl() { 60 void WindowTreeHostMojo::ShowImpl() {
61 window()->Show(); 61 window()->Show();
62 } 62 }
63 63
64 void WindowTreeHostMojo::HideImpl() { 64 void WindowTreeHostMojo::HideImpl() {}
65 }
66 65
67 gfx::Rect WindowTreeHostMojo::GetBounds() const { 66 gfx::Rect WindowTreeHostMojo::GetBounds() const {
68 return bounds_; 67 return bounds_;
69 } 68 }
70 69
71 void WindowTreeHostMojo::SetBounds(const gfx::Rect& bounds) { 70 void WindowTreeHostMojo::SetBounds(const gfx::Rect& bounds) {
72 window()->SetBounds(gfx::Rect(bounds.size())); 71 window()->SetBounds(gfx::Rect(bounds.size()));
73 } 72 }
74 73
75 gfx::Point WindowTreeHostMojo::GetLocationOnNativeScreen() const { 74 gfx::Point WindowTreeHostMojo::GetLocationOnNativeScreen() const {
(...skipping 28 matching lines...) Expand all
104 const mojo::Rect& new_bounds) { 103 const mojo::Rect& new_bounds) {
105 gfx::Rect old_bounds2 = old_bounds.To<gfx::Rect>(); 104 gfx::Rect old_bounds2 = old_bounds.To<gfx::Rect>();
106 gfx::Rect new_bounds2 = new_bounds.To<gfx::Rect>(); 105 gfx::Rect new_bounds2 = new_bounds.To<gfx::Rect>();
107 bounds_ = new_bounds2; 106 bounds_ = new_bounds2;
108 if (old_bounds2.origin() != new_bounds2.origin()) 107 if (old_bounds2.origin() != new_bounds2.origin())
109 OnHostMoved(bounds_.origin()); 108 OnHostMoved(bounds_.origin());
110 if (old_bounds2.size() != new_bounds2.size()) 109 if (old_bounds2.size() != new_bounds2.size())
111 OnHostResized(bounds_.size()); 110 OnHostResized(bounds_.size());
112 } 111 }
113 112
114 } // namespace mandoline 113 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/window_tree_host_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698