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

Side by Side Diff: ui/aura/window_tree_host.cc

Issue 1469803006: NOT FOR REVIEW: Aura Android: Content Shell compiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_wthandroid
Patch Set: Temp Created 5 years 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 | « content/shell/browser/shell_views.cc ('k') | ui/aura/window_tree_host_platform.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/aura/window_tree_host.h" 5 #include "ui/aura/window_tree_host.h"
6 6
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "ui/aura/client/capture_client.h" 9 #include "ui/aura/client/capture_client.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
(...skipping 14 matching lines...) Expand all
25 #include "ui/gfx/geometry/point_conversions.h" 25 #include "ui/gfx/geometry/point_conversions.h"
26 #include "ui/gfx/geometry/size_conversions.h" 26 #include "ui/gfx/geometry/size_conversions.h"
27 #include "ui/gfx/screen.h" 27 #include "ui/gfx/screen.h"
28 28
29 namespace aura { 29 namespace aura {
30 30
31 const char kWindowTreeHostForAcceleratedWidget[] = 31 const char kWindowTreeHostForAcceleratedWidget[] =
32 "__AURA_WINDOW_TREE_HOST_ACCELERATED_WIDGET__"; 32 "__AURA_WINDOW_TREE_HOST_ACCELERATED_WIDGET__";
33 33
34 float GetDeviceScaleFactorFromDisplay(Window* window) { 34 float GetDeviceScaleFactorFromDisplay(Window* window) {
35 gfx::Display display = gfx::Screen::GetScreenFor(window)-> 35 LOG(ERROR) << "auraclank: GetDeviceScaleFactorFromDisplay";
36 GetDisplayNearestWindow(window); 36 gfx::Screen* screen = gfx::Screen::GetScreenFor(window);
37 LOG(ERROR) << 1;
38 gfx::Display display = screen->GetDisplayNearestWindow(window);
39 LOG(ERROR) << 2;
37 DCHECK(display.is_valid()); 40 DCHECK(display.is_valid());
41 LOG(ERROR) << 3;
38 return display.device_scale_factor(); 42 return display.device_scale_factor();
39 } 43 }
40 44
41 //////////////////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////////////////
42 // WindowTreeHost, public: 46 // WindowTreeHost, public:
43 47
44 WindowTreeHost::~WindowTreeHost() { 48 WindowTreeHost::~WindowTreeHost() {
45 DCHECK(!compositor_) << "compositor must be destroyed before root window"; 49 DCHECK(!compositor_) << "compositor must be destroyed before root window";
46 if (owned_input_method_) { 50 if (owned_input_method_) {
47 delete input_method_; 51 delete input_method_;
48 input_method_ = nullptr; 52 input_method_ = nullptr;
49 } 53 }
50 } 54 }
51 55
52 // static 56 // static
53 WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget( 57 WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget(
54 gfx::AcceleratedWidget widget) { 58 gfx::AcceleratedWidget widget) {
55 return reinterpret_cast<WindowTreeHost*>( 59 return reinterpret_cast<WindowTreeHost*>(
56 ui::ViewProp::GetValue(widget, kWindowTreeHostForAcceleratedWidget)); 60 ui::ViewProp::GetValue(widget, kWindowTreeHostForAcceleratedWidget));
57 } 61 }
58 62
59 void WindowTreeHost::InitHost() { 63 void WindowTreeHost::InitHost() {
60 InitCompositor(); 64 InitCompositor();
61 UpdateRootWindowSize(GetBounds().size()); 65 UpdateRootWindowSize(GetBounds().size());
62 Env::GetInstance()->NotifyHostInitialized(this); 66 Env::GetInstance()->NotifyHostInitialized(this);
63 window()->Show(); 67 window()->Show();
64 } 68 }
65 69
66 void WindowTreeHost::InitCompositor() { 70 void WindowTreeHost::InitCompositor() {
67 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), 71 LOG(ERROR) << "auraclank: WindowTreeHost::InitCompositor";
72 LOG(ERROR) << 1;
73 float sf = GetDeviceScaleFactorFromDisplay(window());
74 LOG(ERROR) << 2;
75 compositor_->SetScaleAndSize(sf,
68 GetBounds().size()); 76 GetBounds().size());
77 LOG(ERROR) << 3;
69 compositor_->SetRootLayer(window()->layer()); 78 compositor_->SetRootLayer(window()->layer());
79 LOG(ERROR) << 4;
70 } 80 }
71 81
72 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { 82 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) {
73 observers_.AddObserver(observer); 83 observers_.AddObserver(observer);
74 } 84 }
75 85
76 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { 86 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) {
77 observers_.RemoveObserver(observer); 87 observers_.RemoveObserver(observer);
78 } 88 }
79 89
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 OnCursorVisibilityChangedNative(show); 165 OnCursorVisibilityChangedNative(show);
156 } 166 }
157 167
158 void WindowTreeHost::MoveCursorTo(const gfx::Point& location_in_dip) { 168 void WindowTreeHost::MoveCursorTo(const gfx::Point& location_in_dip) {
159 gfx::Point host_location(location_in_dip); 169 gfx::Point host_location(location_in_dip);
160 ConvertPointToHost(&host_location); 170 ConvertPointToHost(&host_location);
161 MoveCursorToInternal(location_in_dip, host_location); 171 MoveCursorToInternal(location_in_dip, host_location);
162 } 172 }
163 173
164 void WindowTreeHost::MoveCursorToHostLocation(const gfx::Point& host_location) { 174 void WindowTreeHost::MoveCursorToHostLocation(const gfx::Point& host_location) {
175 LOG(ERROR) << "auraclank: WindowTreeHost::MoveCursorToHostLocation";
165 gfx::Point root_location(host_location); 176 gfx::Point root_location(host_location);
177 LOG(ERROR) << 1;
166 ConvertPointFromHost(&root_location); 178 ConvertPointFromHost(&root_location);
179 LOG(ERROR) << 2;
167 MoveCursorToInternal(root_location, host_location); 180 MoveCursorToInternal(root_location, host_location);
181 LOG(ERROR) << 3;
168 } 182 }
169 183
170 ui::InputMethod* WindowTreeHost::GetInputMethod() { 184 ui::InputMethod* WindowTreeHost::GetInputMethod() {
171 if (!input_method_) { 185 if (!input_method_) {
172 input_method_ = 186 input_method_ =
173 ui::CreateInputMethod(this, GetAcceleratedWidget()).release(); 187 ui::CreateInputMethod(this, GetAcceleratedWidget()).release();
174 owned_input_method_ = true; 188 owned_input_method_ = true;
175 } 189 }
176 return input_method_; 190 return input_method_;
177 } 191 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 client::CursorClient* cursor_client = client::GetCursorClient(window()); 314 client::CursorClient* cursor_client = client::GetCursorClient(window());
301 if (cursor_client) { 315 if (cursor_client) {
302 const gfx::Display& display = 316 const gfx::Display& display =
303 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window()); 317 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window());
304 cursor_client->SetDisplay(display); 318 cursor_client->SetDisplay(display);
305 } 319 }
306 dispatcher()->OnCursorMovedToRootLocation(root_location); 320 dispatcher()->OnCursorMovedToRootLocation(root_location);
307 } 321 }
308 322
309 } // namespace aura 323 } // namespace aura
OLDNEW
« no previous file with comments | « content/shell/browser/shell_views.cc ('k') | ui/aura/window_tree_host_platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698