| 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 #include "ui/display/chromeos/display_snapshot.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 | 12 |
| 13 ProjectingObserver::ProjectingObserver() | 13 ProjectingObserver::ProjectingObserver() |
| 14 : has_internal_output_(false), | 14 : has_internal_output_(false), |
| 15 output_count_(0), | 15 output_count_(0), |
| 16 casting_session_count_(0) {} | 16 casting_session_count_(0) {} |
| 17 | 17 |
| 18 ProjectingObserver::~ProjectingObserver() {} | 18 ProjectingObserver::~ProjectingObserver() {} |
| 19 | 19 |
| 20 void ProjectingObserver::OnDisplayModeChanged( | 20 void ProjectingObserver::OnDisplayModeChanged( |
| 21 const ui::OutputConfigurator::DisplayStateList& outputs) { | 21 const ui::DisplayConfigurator::DisplayStateList& outputs) { |
| 22 has_internal_output_ = false; | 22 has_internal_output_ = false; |
| 23 output_count_ = outputs.size(); | 23 output_count_ = outputs.size(); |
| 24 | 24 |
| 25 for (size_t i = 0; i < outputs.size(); ++i) { | 25 for (size_t i = 0; i < outputs.size(); ++i) { |
| 26 if (outputs[i].display->type() == ui::OUTPUT_TYPE_INTERNAL) { | 26 if (outputs[i].display->type() == ui::OUTPUT_TYPE_INTERNAL) { |
| 27 has_internal_output_ = true; | 27 has_internal_output_ = true; |
| 28 break; | 28 break; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 49 // "Projecting" is defined as having more than 1 output connected while at | 49 // "Projecting" is defined as having more than 1 output connected while at |
| 50 // least one of them is an internal output. | 50 // least one of them is an internal output. |
| 51 bool projecting = has_internal_output_ && | 51 bool projecting = has_internal_output_ && |
| 52 (output_count_ + casting_session_count_ > 1); | 52 (output_count_ + casting_session_count_ > 1); |
| 53 | 53 |
| 54 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->SetIsProjecting( | 54 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->SetIsProjecting( |
| 55 projecting); | 55 projecting); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace ash | 58 } // namespace ash |
| OLD | NEW |