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

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

Issue 2297743002: Process DisplaySnapshots in PlatformScreen. (Closed)
Patch Set: Fix test. 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_IMPL_OZONE_H_ 5 #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_
6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_ 6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "services/ui/display/platform_screen.h" 15 #include "services/ui/display/platform_screen.h"
16 #include "ui/display/chromeos/display_configurator.h" 16 #include "ui/display/chromeos/display_configurator.h"
17 #include "ui/display/display.h" 17 #include "ui/display/display.h"
18 18
19 namespace display { 19 namespace display {
20 20
21 // PlatformScreenImplOzone provides the necessary functionality to configure all 21 // PlatformScreenImplOzone provides the necessary functionality to configure all
22 // attached physical displays on the ozone platform. 22 // attached physical displays on the ozone platform.
23 class PlatformScreenImplOzone : public PlatformScreen, 23 class PlatformScreenImplOzone : public PlatformScreen,
24 public ui::DisplayConfigurator::Observer { 24 public ui::DisplayConfigurator::Observer {
25 public: 25 public:
26 // TODO(kylechar): Replace with something like ash::DisplayInfo after it's
rjkroege 2016/08/30 18:41:59 fyi: is in the commit queue You need to say what
kylechar 2016/08/31 15:58:01 I've updated the comment. I see display::ManagedDi
27 // moved to src/ui/display.
28 struct DisplayInfo {
29 DisplayInfo(int64_t new_id, gfx::Rect new_bounds)
30 : id(new_id), bounds(new_bounds), known_bounds(new_bounds) {}
31
32 int64_t id;
33 // The display bounds.
34 gfx::Rect bounds;
35 // The display bounds that the delegate knows about.
36 gfx::Rect known_bounds;
37 bool removed = false;
38 };
39
26 PlatformScreenImplOzone(); 40 PlatformScreenImplOzone();
27 ~PlatformScreenImplOzone() override; 41 ~PlatformScreenImplOzone() override;
28 42
29 private:
30 // PlatformScreen: 43 // PlatformScreen:
31 void Init(PlatformScreenDelegate* delegate) override; 44 void Init(PlatformScreenDelegate* delegate) override;
32 int64_t GetPrimaryDisplayId() const override; 45 int64_t GetPrimaryDisplayId() const override;
33 46
47 private:
48 // Process display snapshots and mark removed displays as removed. Does not
49 // call delegate.
50 void ProcessRemovedDisplays(
51 const ui::DisplayConfigurator::DisplayStateList& snapshots);
52
53 // Processes display snapshots and updates the bounds of an existing displays.
54 // Does not call delegate.
55 void ProcessModifiedDisplays(
56 const ui::DisplayConfigurator::DisplayStateList& snapshots);
57
58 // Examines list of cached displays and checks for modified or removed
59 // displays. Also updates display bounds in response to modified or removed
60 // displays. Calls OnDisplayModified() or OnDisplayRemoved() on the delegate
61 // when appropriate, at most once per display.
62 //
63 // Usually used after ProcessRemovedDisplays() and ProcessModifiedDisplays().
64 void UpdateCachedDisplays();
65
66 // Adds any new displays in the list of cached displays and calls delegate.
67 void AddNewDisplays(
68 const ui::DisplayConfigurator::DisplayStateList& snapshots);
69
34 // ui::DisplayConfigurator::Observer: 70 // ui::DisplayConfigurator::Observer:
35 void OnDisplayModeChanged( 71 void OnDisplayModeChanged(
36 const ui::DisplayConfigurator::DisplayStateList& displays) override; 72 const ui::DisplayConfigurator::DisplayStateList& displays) override;
37 void OnDisplayModeChangeFailed( 73 void OnDisplayModeChangeFailed(
38 const ui::DisplayConfigurator::DisplayStateList& displays, 74 const ui::DisplayConfigurator::DisplayStateList& displays,
39 ui::MultipleDisplayState failed_new_state) override; 75 ui::MultipleDisplayState failed_new_state) override;
40 76
41 PlatformScreenDelegate* delegate_ = nullptr; 77 PlatformScreenDelegate* delegate_ = nullptr;
42 ui::DisplayConfigurator display_configurator_; 78 ui::DisplayConfigurator display_configurator_;
43 79
44 // TODO(kylechar): These values can/should be replaced by DisplayLayout. 80 // TODO(kylechar): These values can/should be replaced by DisplayLayout.
45 int64_t primary_display_id_ = display::Display::kInvalidDisplayID; 81 int64_t primary_display_id_ = display::Display::kInvalidDisplayID;
46 std::set<uint64_t> displays_; 82 std::vector<DisplayInfo> cached_displays_;
47 gfx::Point next_display_origin_; 83 gfx::Point next_display_origin_;
48 84
49 DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone); 85 DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone);
50 }; 86 };
51 87
52 } // namespace display 88 } // namespace display
53 89
54 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_ 90 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_IMPL_OZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698