OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_TRAY_TRACING_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_TRAY_TRACING_H_ |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_TRAY_TRACING_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_TRAY_TRACING_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/system/tray/tray_image_item.h" | 9 #include "ash/common/system/tray/tray_image_item.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 class View; | 13 class View; |
14 } | 14 } |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 | 17 |
18 class ASH_EXPORT TracingObserver { | 18 class ASH_EXPORT TracingObserver { |
19 public: | 19 public: |
20 virtual ~TracingObserver() {} | 20 virtual ~TracingObserver() {} |
21 | 21 |
22 // Notifies when tracing mode changes. | 22 // Notifies when tracing mode changes. |
23 virtual void OnTracingModeChanged(bool value) = 0; | 23 virtual void OnTracingModeChanged(bool value) = 0; |
24 }; | 24 }; |
25 | 25 |
26 // This is the item that displays when users enable performance tracing at | 26 // This is the item that displays when users enable performance tracing at |
27 // chrome://slow. It alerts them that this mode is running, and provides an | 27 // chrome://slow. It alerts them that this mode is running, and provides an |
28 // easy way to open the page to disable it. | 28 // easy way to open the page to disable it. |
29 class TrayTracing : public TrayImageItem, | 29 class TrayTracing : public TrayImageItem, public TracingObserver { |
30 public TracingObserver { | |
31 public: | 30 public: |
32 explicit TrayTracing(SystemTray* system_tray); | 31 explicit TrayTracing(SystemTray* system_tray); |
33 ~TrayTracing() override; | 32 ~TrayTracing() override; |
34 | 33 |
35 private: | 34 private: |
36 void SetTrayIconVisible(bool visible); | 35 void SetTrayIconVisible(bool visible); |
37 | 36 |
38 // Overridden from TrayImageItem. | 37 // Overridden from TrayImageItem. |
39 bool GetInitialVisibility() override; | 38 bool GetInitialVisibility() override; |
40 views::View* CreateDefaultView(LoginStatus status) override; | 39 views::View* CreateDefaultView(LoginStatus status) override; |
41 views::View* CreateDetailedView(LoginStatus status) override; | 40 views::View* CreateDetailedView(LoginStatus status) override; |
42 void DestroyDefaultView() override; | 41 void DestroyDefaultView() override; |
43 void DestroyDetailedView() override; | 42 void DestroyDetailedView() override; |
44 | 43 |
45 // Overridden from TracingObserver. | 44 // Overridden from TracingObserver. |
46 void OnTracingModeChanged(bool value) override; | 45 void OnTracingModeChanged(bool value) override; |
47 | 46 |
48 views::View* default_; | 47 views::View* default_; |
49 | 48 |
50 DISALLOW_COPY_AND_ASSIGN(TrayTracing); | 49 DISALLOW_COPY_AND_ASSIGN(TrayTracing); |
51 }; | 50 }; |
52 | 51 |
53 } // namespace ash | 52 } // namespace ash |
54 | 53 |
55 #endif // ASH_COMMON_SYSTEM_CHROMEOS_TRAY_TRACING_H_ | 54 #endif // ASH_COMMON_SYSTEM_CHROMEOS_TRAY_TRACING_H_ |
OLD | NEW |