projecting_observer_chromeos.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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.
4
5#ifndef ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_
6#define ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_
7
8#include "ash/ash_export.h"
9#include "chromeos/display/output_configurator.h"
10
11namespace ash {
12
13namespace internal {
14
15class ASH_EXPORT ProjectingObserver
16    : public chromeos::OutputConfigurator::Observer {
17 public:
18  ProjectingObserver();
19  virtual ~ProjectingObserver();
20
21  // Called when a casting session is started or stopped.
22  void OnCastingSessionStartedOrStopped(bool started);
23
24  // OutputConfigurator::Observer implementation:
25  virtual void OnDisplayModeChanged(const std::vector<
26      chromeos::OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE;
27
28 private:
29  // Sends the current projecting state to power manager.
30  void SetIsProjecting();
31
32  // True if at least one output is internal. This value is updated when
33  // |OnDisplayModeChanged| is called.
34  bool has_internal_output_;
35
36  // Keeps track of the number of connected outputs.
37  int output_count_;
38
39  // Number of outstanding casting sessions.
40  int casting_session_count_;
41
42  DISALLOW_COPY_AND_ASSIGN(ProjectingObserver);
43};
44
45}  // namespace internal
46
47}  // namespace ash
48
49#endif  // ASH_DISPLAY_PROJECTING_OBSERVER_CHROMEOS_H_
50