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

Side by Side Diff: services/ui/display/platform_screen_ozone.h

Issue 2356913002: Pass device scale factor from display to ws. (Closed)
Patch Set: Rebase, fix tests and cleanup. Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ 5 #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_
6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ 6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 29 matching lines...) Expand all
40 void RequestCloseDisplay(int64_t display_id) override; 40 void RequestCloseDisplay(int64_t display_id) override;
41 int64_t GetPrimaryDisplayId() const override; 41 int64_t GetPrimaryDisplayId() const override;
42 42
43 // mojom::DisplayController: 43 // mojom::DisplayController:
44 void ToggleVirtualDisplay() override; 44 void ToggleVirtualDisplay() override;
45 45
46 private: 46 private:
47 // TODO(kylechar): This struct is just temporary until we migrate 47 // TODO(kylechar): This struct is just temporary until we migrate
48 // DisplayManager code out of ash so it can be used here. 48 // DisplayManager code out of ash so it can be used here.
49 struct DisplayInfo { 49 struct DisplayInfo {
50 DisplayInfo(int64_t new_id, const gfx::Rect& new_bounds) 50 int64_t id = Display::kInvalidDisplayID;
51 : id(new_id), bounds(new_bounds) {} 51 // The display bounds in DIP.
52
53 int64_t id;
54 // The display bounds.
55 gfx::Rect bounds; 52 gfx::Rect bounds;
53 // Display size in DDP.
54 gfx::Size pixel_size;
55 // The display device pixel scale factor, either 1 or 2.
56 float device_scale_factor = 1.0f;
56 // The display bounds have been modified and delegate should be updated. 57 // The display bounds have been modified and delegate should be updated.
57 bool modified = false; 58 bool modified = false;
58 // The display has been removed and delegate should be updated. 59 // The display has been removed and delegate should be updated.
59 bool removed = false; 60 bool removed = false;
60 }; 61 };
61 using CachedDisplayIterator = std::vector<DisplayInfo>::iterator; 62 using CachedDisplayIterator = std::vector<DisplayInfo>::iterator;
62 63
63 // Processes list of display snapshots and sets |removed| on any displays that 64 // Processes list of display snapshots and sets |removed| on any displays that
64 // have been removed. Updates |primary_display_id_| if the primary display was 65 // have been removed. Updates |primary_display_id_| if the primary display was
65 // removed. Does not remove displays from |cached_displays_| or send updates 66 // removed. Does not remove displays from |cached_displays_| or send updates
(...skipping 17 matching lines...) Expand all
83 84
84 // Processes list of display snapshots and adds any new displays to 85 // Processes list of display snapshots and adds any new displays to
85 // |cached_displays_|. Updates delegate by calling OnDisplayAdded(). 86 // |cached_displays_|. Updates delegate by calling OnDisplayAdded().
86 void AddNewDisplays( 87 void AddNewDisplays(
87 const ui::DisplayConfigurator::DisplayStateList& snapshots); 88 const ui::DisplayConfigurator::DisplayStateList& snapshots);
88 89
89 // Returns an iterator to the cached display with |display_id| or an end 90 // Returns an iterator to the cached display with |display_id| or an end
90 // iterator if there is no display with that id. 91 // iterator if there is no display with that id.
91 CachedDisplayIterator GetCachedDisplayIterator(int64_t display_id); 92 CachedDisplayIterator GetCachedDisplayIterator(int64_t display_id);
92 93
94 // Converts |snapshot| into a DisplayInfo.
95 DisplayInfo DisplayInfoFromSnapshot(ui::DisplaySnapshot* snapshot);
sky 2016/09/22 21:42:06 If possible, make this take a const ui::DisplaySna
kylechar 2016/09/23 13:22:32 Done.
96
93 // ui::DisplayConfigurator::Observer: 97 // ui::DisplayConfigurator::Observer:
94 void OnDisplayModeChanged( 98 void OnDisplayModeChanged(
95 const ui::DisplayConfigurator::DisplayStateList& displays) override; 99 const ui::DisplayConfigurator::DisplayStateList& displays) override;
96 void OnDisplayModeChangeFailed( 100 void OnDisplayModeChangeFailed(
97 const ui::DisplayConfigurator::DisplayStateList& displays, 101 const ui::DisplayConfigurator::DisplayStateList& displays,
98 ui::MultipleDisplayState failed_new_state) override; 102 ui::MultipleDisplayState failed_new_state) override;
99 103
100 // mojo::InterfaceFactory<mojom::DisplayController>: 104 // mojo::InterfaceFactory<mojom::DisplayController>:
101 void Create(const shell::Identity& remote_identity, 105 void Create(const shell::Identity& remote_identity,
102 mojom::DisplayControllerRequest request) override; 106 mojom::DisplayControllerRequest request) override;
(...skipping 15 matching lines...) Expand all
118 gfx::Point next_display_origin_; 122 gfx::Point next_display_origin_;
119 123
120 mojo::BindingSet<mojom::DisplayController> bindings_; 124 mojo::BindingSet<mojom::DisplayController> bindings_;
121 125
122 DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone); 126 DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone);
123 }; 127 };
124 128
125 } // namespace display 129 } // namespace display
126 130
127 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ 131 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698