| 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 #include "ash/display/projecting_observer_chromeos.h" | 5 #include "ash/display/projecting_observer_chromeos.h" |
| 6 | 6 |
| 7 #include "chromeos/dbus/dbus_thread_manager.h" | 7 #include "chromeos/dbus/dbus_thread_manager.h" |
| 8 #include "chromeos/dbus/power_manager_client.h" | 8 #include "chromeos/dbus/power_manager_client.h" |
| 9 #include "ui/display/chromeos/display_snapshot.h" |
| 9 | 10 |
| 10 namespace ash { | 11 namespace ash { |
| 11 | 12 |
| 12 namespace internal { | 13 namespace internal { |
| 13 | 14 |
| 14 ProjectingObserver::ProjectingObserver() | 15 ProjectingObserver::ProjectingObserver() |
| 15 : has_internal_output_(false), | 16 : has_internal_output_(false), |
| 16 output_count_(0), | 17 output_count_(0), |
| 17 casting_session_count_(0) {} | 18 casting_session_count_(0) {} |
| 18 | 19 |
| 19 ProjectingObserver::~ProjectingObserver() {} | 20 ProjectingObserver::~ProjectingObserver() {} |
| 20 | 21 |
| 21 void ProjectingObserver::OnDisplayModeChanged( | 22 void ProjectingObserver::OnDisplayModeChanged( |
| 22 const std::vector<ui::OutputConfigurator::OutputSnapshot>& outputs) { | 23 const ui::OutputConfigurator::DisplayStateList& outputs) { |
| 23 has_internal_output_ = false; | 24 has_internal_output_ = false; |
| 24 output_count_ = outputs.size(); | 25 output_count_ = outputs.size(); |
| 25 | 26 |
| 26 for (size_t i = 0; i < outputs.size(); ++i) { | 27 for (size_t i = 0; i < outputs.size(); ++i) { |
| 27 if (outputs[i].type == ui::OUTPUT_TYPE_INTERNAL) { | 28 if (outputs[i].display->type() == ui::OUTPUT_TYPE_INTERNAL) { |
| 28 has_internal_output_ = true; | 29 has_internal_output_ = true; |
| 29 break; | 30 break; |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 33 SetIsProjecting(); | 34 SetIsProjecting(); |
| 34 } | 35 } |
| 35 | 36 |
| 36 void ProjectingObserver::OnCastingSessionStartedOrStopped(bool started) { | 37 void ProjectingObserver::OnCastingSessionStartedOrStopped(bool started) { |
| 37 if (started) { | 38 if (started) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 52 bool projecting = has_internal_output_ && | 53 bool projecting = has_internal_output_ && |
| 53 (output_count_ + casting_session_count_ > 1); | 54 (output_count_ + casting_session_count_ > 1); |
| 54 | 55 |
| 55 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->SetIsProjecting( | 56 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->SetIsProjecting( |
| 56 projecting); | 57 projecting); |
| 57 } | 58 } |
| 58 | 59 |
| 59 } // namespace internal | 60 } // namespace internal |
| 60 | 61 |
| 61 } // namespace ash | 62 } // namespace ash |
| OLD | NEW |