summaryrefslogtreecommitdiffstats
path: root/chromium/ash/system/chromeos/tray_tracing.h
blob: f9491e1d90319dd1595a15eba32f8527545d94ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2013 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.

#ifndef ASH_SYSTEM_TRAY_TRACING_H_
#define ASH_SYSTEM_TRAY_TRACING_H_

#include "ash/ash_export.h"
#include "ash/system/tray/tray_image_item.h"

namespace views {
class View;
}

namespace ash {

class ASH_EXPORT TracingObserver {
 public:
  virtual ~TracingObserver() {}

  // Notifies when tracing mode changes.
  virtual void OnTracingModeChanged(bool value) = 0;
};

namespace internal {

// This is the item that displays when users enable performance tracing at
// chrome://slow.  It alerts them that this mode is running, and provides an
// easy way to open the page to disable it.
class TrayTracing : public TrayImageItem,
                    public TracingObserver {
 public:
  explicit TrayTracing(SystemTray* system_tray);
  virtual ~TrayTracing();

 private:
  void SetTrayIconVisible(bool visible);

  // Overridden from TrayImageItem.
  virtual bool GetInitialVisibility() OVERRIDE;
  virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
  virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
  virtual void DestroyDefaultView() OVERRIDE;
  virtual void DestroyDetailedView() OVERRIDE;

  // Overridden from TracingObserver.
  virtual void OnTracingModeChanged(bool value) OVERRIDE;

  views::View* default_;

  DISALLOW_COPY_AND_ASSIGN(TrayTracing);
};

}  // namespace internal
}  // namespace ash

#endif  // ASH_SYSTEM_TRAY_TRACING_H_