Chromium Code Reviews| OLD | NEW |
|---|---|
| 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): This struct is just temporary until we migrate | |
| 27 // DisplayManager code out of ash so it can be used here. | |
| 28 struct DisplayInfo { | |
|
sky
2016/09/01 19:25:08
Does this need to be public?
kylechar
2016/09/02 15:18:34
Not anymore (it did at a previous revision). Move
| |
| 29 DisplayInfo(int64_t new_id, gfx::Rect new_bounds) | |
|
sky
2016/09/01 19:25:08
const gfx::rect&
kylechar
2016/09/02 15:18:34
Done.
| |
| 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. | |
|
sky
2016/09/01 19:25:08
clarify what 'knows about' means here.
That said,
kylechar
2016/09/02 15:18:34
Clarified comment. As to why, the bounds can get c
sky
2016/09/02 16:03:21
I'm likely missing something. See my other comment
| |
| 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 | |
|
sky
2016/09/01 19:25:08
Document what 'process' means here. I'm suggesting
kylechar
2016/09/02 15:18:34
Done.
| |
| 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. | |
|
sky
2016/09/01 19:25:08
remove 'an'
kylechar
2016/09/02 15:18:34
Done. I've updated the method descriptions to be m
| |
| 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_ |
| OLD | NEW |