blob: 12badccd0f1a332977b74f0e427bc63aa2c91710 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/ash_export.h"
#include "ash/shell_observer.h"
#include "base/macros.h"
#include "ui/display/manager/display_configurator.h"
namespace ash {
class ASH_EXPORT ProjectingObserver
: public display::DisplayConfigurator::Observer,
public ShellObserver {
// |display_configurator| must outlive this instance. May be null in tests.
explicit ProjectingObserver(
display::DisplayConfigurator* display_configurator);
~ProjectingObserver() override;
// DisplayConfigurator::Observer implementation:
void OnDisplayModeChanged(
const display::DisplayConfigurator::DisplayStateList& outputs) override;
// ash::ShellObserver implementation:
void OnCastingSessionStartedOrStopped(bool started) override;
friend class ProjectingObserverTest;
// Sends the current projecting state to power manager.
void SetIsProjecting();
display::DisplayConfigurator* display_configurator_; // Unowned
// True if at least one output is internal. This value is updated when
// |OnDisplayModeChanged| is called.
bool has_internal_output_ = false;
// Keeps track of the number of connected outputs.
int output_count_ = 0;
// Number of outstanding casting sessions.
int casting_session_count_ = 0;
} // namespace ash