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

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

Issue 2317073003: Rename PlatformScreen implementations. (Closed)
Patch Set: Fix tests. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_
6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_
7
8 #include <stdint.h>
9
10 #include <set>
11 #include <vector>
12
13 #include "base/callback.h"
14 #include "base/macros.h"
15 #include "services/ui/display/platform_screen.h"
16 #include "ui/display/chromeos/display_configurator.h"
17 #include "ui/display/display.h"
18
19 namespace display {
20
21 // PlatformScreenImplOzone provides the necessary functionality to configure all
22 // attached physical displays on the ozone platform.
23 class PlatformScreenImplOzone : public PlatformScreen,
24 public ui::DisplayConfigurator::Observer {
25 public:
26 PlatformScreenImplOzone();
27 ~PlatformScreenImplOzone() override;
28
29 // PlatformScreen:
30 void Init(PlatformScreenDelegate* delegate) override;
31 int64_t GetPrimaryDisplayId() const override;
32
33 private:
34 // TODO(kylechar): This struct is just temporary until we migrate
35 // DisplayManager code out of ash so it can be used here.
36 struct DisplayInfo {
37 DisplayInfo(int64_t new_id, const gfx::Rect& new_bounds)
38 : id(new_id), bounds(new_bounds) {}
39
40 int64_t id;
41 // The display bounds.
42 gfx::Rect bounds;
43 // The display bounds have been modified and delegate should be updated.
44 bool modified = false;
45 // The display has been removed and delegate should be updated.
46 bool removed = false;
47 };
48 using CachedDisplayIterator = std::vector<DisplayInfo>::iterator;
49
50 // Processes list of display snapshots and sets |removed| on any displays that
51 // have been removed. Updates |primary_display_id_| if the primary display was
52 // removed. Does not remove displays from |cached_displays_| or send updates
53 // to delegate.
54 void ProcessRemovedDisplays(
55 const ui::DisplayConfigurator::DisplayStateList& snapshots);
56
57 // Processes list of display snapshots and updates the bounds of any displays
58 // in |cached_displays_| that have changed size. Does not send updates to
59 // delegate.
60 void ProcessModifiedDisplays(
61 const ui::DisplayConfigurator::DisplayStateList& snapshots);
62
63 // Looks at |cached_displays_| for modified or removed displays. Also updates
64 // display bounds in response to modified or removed displays. Sends updates
65 // to the delegate when appropriate by calling OnDisplayModified() or
66 // OnDisplayRemoved(). Makes at most one call to delegate per display.
67 //
68 // Usually used after ProcessRemovedDisplays() and ProcessModifiedDisplays().
69 void UpdateCachedDisplays();
70
71 // Processes list of display snapshots and adds any new displays to
72 // |cached_displays_|. Updates delegate by calling OnDisplayAdded().
73 void AddNewDisplays(
74 const ui::DisplayConfigurator::DisplayStateList& snapshots);
75
76 // Returns an iterator to the cached display with |display_id| or an end
77 // iterator if there is no display with that id.
78 CachedDisplayIterator GetCachedDisplayIterator(int64_t display_id);
79
80 // ui::DisplayConfigurator::Observer:
81 void OnDisplayModeChanged(
82 const ui::DisplayConfigurator::DisplayStateList& displays) override;
83 void OnDisplayModeChangeFailed(
84 const ui::DisplayConfigurator::DisplayStateList& displays,
85 ui::MultipleDisplayState failed_new_state) override;
86
87 PlatformScreenDelegate* delegate_ = nullptr;
88 ui::DisplayConfigurator display_configurator_;
89
90 // TODO(kylechar): These values can/should be replaced by DisplayLayout.
91 int64_t primary_display_id_ = display::Display::kInvalidDisplayID;
92 std::vector<DisplayInfo> cached_displays_;
93 gfx::Point next_display_origin_;
94
95 DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone);
96 };
97
98 } // namespace display
99
100 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_
OLDNEW
« no previous file with comments | « services/ui/display/platform_screen_impl.cc ('k') | services/ui/display/platform_screen_impl_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698