Don't set accelerated compositing to true in WebView. It's already defaulted to true.
[chromium-blink-merge.git] / ash / display / projecting_observer_chromeos.cc
blobd13d3ac8c17b8a3152a96eee5fcc80d6f2af1954
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
3 // found in the LICENSE file.
5 #include "ash/display/projecting_observer_chromeos.h"
7 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/power_manager_client.h"
9 #include "ui/display/types/chromeos/display_snapshot.h"
11 namespace ash {
13 ProjectingObserver::ProjectingObserver()
14 : has_internal_output_(false),
15 output_count_(0),
16 casting_session_count_(0) {}
18 ProjectingObserver::~ProjectingObserver() {}
20 void ProjectingObserver::OnDisplayModeChanged(
21 const ui::DisplayConfigurator::DisplayStateList& display_states) {
22 has_internal_output_ = false;
23 output_count_ = display_states.size();
25 for (size_t i = 0; i < display_states.size(); ++i) {
26 if (display_states[i].display->type() ==
27 ui::DISPLAY_CONNECTION_TYPE_INTERNAL) {
28 has_internal_output_ = true;
29 break;
33 SetIsProjecting();
36 void ProjectingObserver::OnCastingSessionStartedOrStopped(bool started) {
37 if (started) {
38 ++casting_session_count_;
39 } else {
40 DCHECK_GT(casting_session_count_, 0);
41 --casting_session_count_;
42 if (casting_session_count_ < 0)
43 casting_session_count_ = 0;
46 SetIsProjecting();
49 void ProjectingObserver::SetIsProjecting() {
50 // "Projecting" is defined as having more than 1 output connected while at
51 // least one of them is an internal output.
52 bool projecting = has_internal_output_ &&
53 (output_count_ + casting_session_count_ > 1);
55 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->SetIsProjecting(
56 projecting);
59 } // namespace ash