tracing_notification_controller.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2018 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. #ifndef ASH_SYSTEM_TRACING_NOTIFICATION_CONTROLLER_H_
  5. #define ASH_SYSTEM_TRACING_NOTIFICATION_CONTROLLER_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/system/model/tracing_model.h"
  8. namespace ash {
  9. // Controller class to manage tracing enabled (chrome://slow) notification.
  10. class ASH_EXPORT TracingNotificationController : public TracingObserver {
  11. public:
  12. TracingNotificationController();
  13. TracingNotificationController(const TracingNotificationController&) = delete;
  14. TracingNotificationController& operator=(
  15. const TracingNotificationController&) = delete;
  16. ~TracingNotificationController() override;
  17. // TracingObserver:
  18. void OnTracingModeChanged() override;
  19. private:
  20. friend class TracingNotificationControllerTest;
  21. void CreateNotification();
  22. void RemoveNotification();
  23. static const char kNotificationId[];
  24. // True if performance tracing was active on the last time
  25. // OnTracingModeChanged was called.
  26. bool was_tracing_ = false;
  27. TracingModel* const model_;
  28. };
  29. } // namespace ash
  30. #endif // ASH_SYSTEM_TRACING_NOTIFICATION_CONTROLLER_H_