| 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 ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_ | 5 #ifndef ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_ |
| 6 #define ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_ | 6 #define ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/shell_observer.h" | 9 #include "ash/common/shell_observer.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/display/manager/chromeos/display_configurator.h" | 11 #include "ui/display/manager/chromeos/display_configurator.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 class PowerManagerClient; | 14 class PowerManagerClient; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 | 18 |
| 19 class ASH_EXPORT ProjectingObserver : public ui::DisplayConfigurator::Observer, | 19 class ASH_EXPORT ProjectingObserver |
| 20 public ShellObserver { | 20 : public display::DisplayConfigurator::Observer, |
| 21 public ShellObserver { |
| 21 public: | 22 public: |
| 22 // |power_manager_client| must outlive this object. | 23 // |power_manager_client| must outlive this object. |
| 23 explicit ProjectingObserver( | 24 explicit ProjectingObserver( |
| 24 chromeos::PowerManagerClient* power_manager_client); | 25 chromeos::PowerManagerClient* power_manager_client); |
| 25 ~ProjectingObserver() override; | 26 ~ProjectingObserver() override; |
| 26 | 27 |
| 27 // DisplayConfigurator::Observer implementation: | 28 // DisplayConfigurator::Observer implementation: |
| 28 void OnDisplayModeChanged( | 29 void OnDisplayModeChanged( |
| 29 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | 30 const display::DisplayConfigurator::DisplayStateList& outputs) override; |
| 30 | 31 |
| 31 // ash::ShellObserver implementation: | 32 // ash::ShellObserver implementation: |
| 32 void OnCastingSessionStartedOrStopped(bool started) override; | 33 void OnCastingSessionStartedOrStopped(bool started) override; |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // Sends the current projecting state to power manager. | 36 // Sends the current projecting state to power manager. |
| 36 void SetIsProjecting(); | 37 void SetIsProjecting(); |
| 37 | 38 |
| 38 // True if at least one output is internal. This value is updated when | 39 // True if at least one output is internal. This value is updated when |
| 39 // |OnDisplayModeChanged| is called. | 40 // |OnDisplayModeChanged| is called. |
| 40 bool has_internal_output_; | 41 bool has_internal_output_; |
| 41 | 42 |
| 42 // Keeps track of the number of connected outputs. | 43 // Keeps track of the number of connected outputs. |
| 43 int output_count_; | 44 int output_count_; |
| 44 | 45 |
| 45 // Number of outstanding casting sessions. | 46 // Number of outstanding casting sessions. |
| 46 int casting_session_count_; | 47 int casting_session_count_; |
| 47 | 48 |
| 48 // Weak pointer to the DBusClient PowerManagerClient; | 49 // Weak pointer to the DBusClient PowerManagerClient; |
| 49 chromeos::PowerManagerClient* power_manager_client_; | 50 chromeos::PowerManagerClient* power_manager_client_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(ProjectingObserver); | 52 DISALLOW_COPY_AND_ASSIGN(ProjectingObserver); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace ash | 55 } // namespace ash |
| 55 | 56 |
| 56 #endif // ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_ | 57 #endif // ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_ |
| OLD | NEW |