Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 5 #ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| 6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // Helper class used by tests. | 112 // Helper class used by tests. |
| 113 class TestApi { | 113 class TestApi { |
| 114 public: | 114 public: |
| 115 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} | 115 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} |
| 116 ~TestApi() {} | 116 ~TestApi() {} |
| 117 | 117 |
| 118 // If |configure_timer_| is started, stops the timer, runs | 118 // If |configure_timer_| is started, stops the timer, runs |
| 119 // ConfigureDisplays(), and returns true; returns false otherwise. | 119 // ConfigureDisplays(), and returns true; returns false otherwise. |
| 120 bool TriggerConfigureTimeout(); | 120 bool TriggerConfigureTimeout(); |
|
Daniel Erat
2014/08/12 22:00:49
nit: please add WARN_UNUSED_RESULT from base/compi
dnicoara
2014/08/13 13:28:50
Done
Sorry I missed it.
| |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 DisplayConfigurator* configurator_; // not owned | 123 DisplayConfigurator* configurator_; // not owned |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(TestApi); | 125 DISALLOW_COPY_AND_ASSIGN(TestApi); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 // Flags that can be passed to SetDisplayPower(). | 128 // Flags that can be passed to SetDisplayPower(). |
| 129 static const int kSetDisplayPowerNoFlags = 0; | 129 static const int kSetDisplayPowerNoFlags; |
| 130 // Configure displays even if the passed-in state matches |power_state_|. | 130 // Configure displays even if the passed-in state matches |power_state_|. |
| 131 static const int kSetDisplayPowerForceProbe = 1 << 0; | 131 static const int kSetDisplayPowerForceProbe; |
| 132 // Do not change the state if multiple displays are connected or if the | 132 // Do not change the state if multiple displays are connected or if the |
| 133 // only connected display is external. | 133 // only connected display is external. |
| 134 static const int kSetDisplayPowerOnlyIfSingleInternalDisplay = 1 << 1; | 134 static const int kSetDisplayPowerOnlyIfSingleInternalDisplay; |
| 135 | 135 |
| 136 // Gap between screens so cursor at bottom of active display doesn't | 136 // Gap between screens so cursor at bottom of active display doesn't |
| 137 // partially appear on top of inactive display. Higher numbers guard | 137 // partially appear on top of inactive display. Higher numbers guard |
| 138 // against larger cursors, but also waste more memory. | 138 // against larger cursors, but also waste more memory. |
| 139 // For simplicity, this is hard-coded to avoid the complexity of always | 139 // For simplicity, this is hard-coded to avoid the complexity of always |
| 140 // determining the DPI of the screen and rationalizing which screen we | 140 // determining the DPI of the screen and rationalizing which screen we |
| 141 // need to use for the DPI calculation. | 141 // need to use for the DPI calculation. |
| 142 // See crbug.com/130188 for initial discussion. | 142 // See crbug.com/130188 for initial discussion. |
| 143 static const int kVerticalGap = 60; | 143 static const int kVerticalGap = 60; |
| 144 | 144 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 // The current power state. | 342 // The current power state. |
| 343 chromeos::DisplayPowerState power_state_; | 343 chromeos::DisplayPowerState power_state_; |
| 344 | 344 |
| 345 // Most-recently-used display configuration. Note that the actual | 345 // Most-recently-used display configuration. Note that the actual |
| 346 // configuration changes asynchronously. | 346 // configuration changes asynchronously. |
| 347 DisplayStateList cached_displays_; | 347 DisplayStateList cached_displays_; |
| 348 | 348 |
| 349 ObserverList<Observer> observers_; | 349 ObserverList<Observer> observers_; |
| 350 | 350 |
| 351 // The timer to delay configuring displays. See also the comments in | 351 // The timer to delay configuring displays. See also the comments in |
| 352 // Dispatch(). | 352 // Dispatch(). |
|
Daniel Erat
2014/08/12 22:00:49
nit: is this mention of Dispatch() obsolete?
dnicoara
2014/08/13 13:28:49
Updated comment.
| |
| 353 scoped_ptr<base::OneShotTimer<DisplayConfigurator> > configure_timer_; | 353 base::OneShotTimer<DisplayConfigurator> configure_timer_; |
| 354 | 354 |
| 355 // Id for next display protection client. | 355 // Id for next display protection client. |
| 356 ContentProtectionClientId next_display_protection_client_id_; | 356 ContentProtectionClientId next_display_protection_client_id_; |
| 357 | 357 |
| 358 // Display protection requests of each client. | 358 // Display protection requests of each client. |
| 359 ProtectionRequests client_protection_requests_; | 359 ProtectionRequests client_protection_requests_; |
| 360 | 360 |
| 361 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); | 361 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); |
| 362 }; | 362 }; |
| 363 | 363 |
| 364 } // namespace ui | 364 } // namespace ui |
| 365 | 365 |
| 366 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ | 366 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ |
| OLD | NEW |