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

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2739113002: Simplify calls for scale factor (Closed)
Patch Set: nit Created 3 years, 9 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
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 "ui/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 25 matching lines...) Expand all
36 #include "ui/aura/mus/window_manager_delegate.h" 36 #include "ui/aura/mus/window_manager_delegate.h"
37 #include "ui/aura/mus/window_mus.h" 37 #include "ui/aura/mus/window_mus.h"
38 #include "ui/aura/mus/window_port_mus.h" 38 #include "ui/aura/mus/window_port_mus.h"
39 #include "ui/aura/mus/window_tree_client_delegate.h" 39 #include "ui/aura/mus/window_tree_client_delegate.h"
40 #include "ui/aura/mus/window_tree_client_observer.h" 40 #include "ui/aura/mus/window_tree_client_observer.h"
41 #include "ui/aura/mus/window_tree_client_test_observer.h" 41 #include "ui/aura/mus/window_tree_client_test_observer.h"
42 #include "ui/aura/mus/window_tree_host_mus.h" 42 #include "ui/aura/mus/window_tree_host_mus.h"
43 #include "ui/aura/window.h" 43 #include "ui/aura/window.h"
44 #include "ui/aura/window_delegate.h" 44 #include "ui/aura/window_delegate.h"
45 #include "ui/aura/window_tracker.h" 45 #include "ui/aura/window_tracker.h"
46 #include "ui/base/layout.h"
46 #include "ui/base/ui_base_types.h" 47 #include "ui/base/ui_base_types.h"
47 #include "ui/display/display.h"
48 #include "ui/display/screen.h" 48 #include "ui/display/screen.h"
49 #include "ui/events/event.h" 49 #include "ui/events/event.h"
50 #include "ui/gfx/geometry/dip_util.h" 50 #include "ui/gfx/geometry/dip_util.h"
51 #include "ui/gfx/geometry/insets.h" 51 #include "ui/gfx/geometry/insets.h"
52 #include "ui/gfx/geometry/size.h" 52 #include "ui/gfx/geometry/size.h"
53 53
54 #if defined(HiWord) 54 #if defined(HiWord)
55 #undef HiWord 55 #undef HiWord
56 #endif 56 #endif
57 #if defined(LoWord) 57 #if defined(LoWord)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 // TODO: need to validate type! http://crbug.com/654924. 134 // TODO: need to validate type! http://crbug.com/654924.
135 ui::mojom::WindowType window_type = static_cast<ui::mojom::WindowType>( 135 ui::mojom::WindowType window_type = static_cast<ui::mojom::WindowType>(
136 mojo::ConvertTo<int32_t>(type_iter->second)); 136 mojo::ConvertTo<int32_t>(type_iter->second));
137 SetWindowType(window, window_type); 137 SetWindowType(window, window_type);
138 } 138 }
139 139
140 // Helper function to get the device_scale_factor() of the display::Display 140 // Helper function to get the device_scale_factor() of the display::Display
141 // nearest to |window|. 141 // nearest to |window|.
142 float ScaleFactorForDisplay(Window* window) { 142 float ScaleFactorForDisplay(Window* window) {
143 return display::Screen::GetScreen() 143 return ui::GetScaleFactorForNativeView(window);
144 ->GetDisplayNearestWindow(window)
145 .device_scale_factor();
146 } 144 }
147 145
148 void ConvertEventLocationToDip(int64_t display_id, ui::LocatedEvent* event) { 146 void ConvertEventLocationToDip(int64_t display_id, ui::LocatedEvent* event) {
149 display::Screen* screen = display::Screen::GetScreen(); 147 display::Screen* screen = display::Screen::GetScreen();
150 display::Display display; 148 display::Display display;
151 if (!screen->GetDisplayWithDisplayId(display_id, &display) || 149 if (!screen->GetDisplayWithDisplayId(display_id, &display) ||
152 display.device_scale_factor() == 1.f) { 150 display.device_scale_factor() == 1.f) {
153 return; 151 return;
154 } 152 }
155 const gfx::Point host_location = 153 const gfx::Point host_location =
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1821 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1824 this, capture_synchronizer_.get(), window)); 1822 this, capture_synchronizer_.get(), window));
1825 } 1823 }
1826 1824
1827 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1825 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1828 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1826 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1829 this, focus_synchronizer_.get(), window)); 1827 this, focus_synchronizer_.get(), window));
1830 } 1828 }
1831 1829
1832 } // namespace aura 1830 } // namespace aura
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | ui/aura/window_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698