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

Side by Side Diff: ui/aura/test/ui_controls_factory_ozone.cc

Issue 2525113002: Rename WindowTreeHost functions to indicate pixels/dips. (Closed)
Patch Set: win Created 4 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 | « ui/aura/test/ui_controls_factory_aurax11.cc ('k') | ui/aura/test/x11_event_sender.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 const base::Closure& closure) override { 100 const base::Closure& closure) override {
101 gfx::Point root_location(screen_x, screen_y); 101 gfx::Point root_location(screen_x, screen_y);
102 aura::client::ScreenPositionClient* screen_position_client = 102 aura::client::ScreenPositionClient* screen_position_client =
103 aura::client::GetScreenPositionClient(host_->window()); 103 aura::client::GetScreenPositionClient(host_->window());
104 if (screen_position_client) { 104 if (screen_position_client) {
105 screen_position_client->ConvertPointFromScreen(host_->window(), 105 screen_position_client->ConvertPointFromScreen(host_->window(),
106 &root_location); 106 &root_location);
107 } 107 }
108 108
109 gfx::Point host_location = root_location; 109 gfx::Point host_location = root_location;
110 host_->ConvertPointToHost(&host_location); 110 host_->ConvertDIPToPixels(&host_location);
111 111
112 ui::EventType event_type; 112 ui::EventType event_type;
113 113
114 if (button_down_mask_) 114 if (button_down_mask_)
115 event_type = ui::ET_MOUSE_DRAGGED; 115 event_type = ui::ET_MOUSE_DRAGGED;
116 else 116 else
117 event_type = ui::ET_MOUSE_MOVED; 117 event_type = ui::ET_MOUSE_MOVED;
118 118
119 PostMouseEvent(event_type, host_location, button_down_mask_, 0); 119 PostMouseEvent(event_type, host_location, button_down_mask_, 0);
120 120
121 RunClosureAfterAllPendingUIEvents(closure); 121 RunClosureAfterAllPendingUIEvents(closure);
122 return true; 122 return true;
123 } 123 }
124 bool SendMouseEvents(ui_controls::MouseButton type, int state) override { 124 bool SendMouseEvents(ui_controls::MouseButton type, int state) override {
125 return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); 125 return SendMouseEventsNotifyWhenDone(type, state, base::Closure());
126 } 126 }
127 bool SendMouseEventsNotifyWhenDone( 127 bool SendMouseEventsNotifyWhenDone(
128 ui_controls::MouseButton type, 128 ui_controls::MouseButton type,
129 int state, 129 int state,
130 const base::Closure& closure) override { 130 const base::Closure& closure) override {
131 gfx::Point root_location = aura::Env::GetInstance()->last_mouse_location(); 131 gfx::Point root_location = aura::Env::GetInstance()->last_mouse_location();
132 aura::client::ScreenPositionClient* screen_position_client = 132 aura::client::ScreenPositionClient* screen_position_client =
133 aura::client::GetScreenPositionClient(host_->window()); 133 aura::client::GetScreenPositionClient(host_->window());
134 if (screen_position_client) { 134 if (screen_position_client) {
135 screen_position_client->ConvertPointFromScreen(host_->window(), 135 screen_position_client->ConvertPointFromScreen(host_->window(),
136 &root_location); 136 &root_location);
137 } 137 }
138 138
139 gfx::Point host_location = root_location; 139 gfx::Point host_location = root_location;
140 host_->ConvertPointToHost(&host_location); 140 host_->ConvertDIPToPixels(&host_location);
141 141
142 int flag = 0; 142 int flag = 0;
143 143
144 switch (type) { 144 switch (type) {
145 case ui_controls::LEFT: 145 case ui_controls::LEFT:
146 flag = ui::EF_LEFT_MOUSE_BUTTON; 146 flag = ui::EF_LEFT_MOUSE_BUTTON;
147 break; 147 break;
148 case ui_controls::MIDDLE: 148 case ui_controls::MIDDLE:
149 flag = ui::EF_MIDDLE_MOUSE_BUTTON; 149 flag = ui::EF_MIDDLE_MOUSE_BUTTON;
150 break; 150 break;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 }; 237 };
238 238
239 } // namespace 239 } // namespace
240 240
241 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { 241 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) {
242 return new UIControlsOzone(host); 242 return new UIControlsOzone(host);
243 } 243 }
244 244
245 } // namespace test 245 } // namespace test
246 } // namespace aura 246 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/ui_controls_factory_aurax11.cc ('k') | ui/aura/test/x11_event_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698