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