| Index: chrome/browser/metrics/desktop_engagement_service.h
|
| diff --git a/chrome/browser/metrics/desktop_engagement_service.h b/chrome/browser/metrics/desktop_engagement_service.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..120b59555272c6d57cdf66877469214d19995701
|
| --- /dev/null
|
| +++ b/chrome/browser/metrics/desktop_engagement_service.h
|
| @@ -0,0 +1,53 @@
|
| +// Copyright 2016 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 CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_SERVICE_H_
|
| +#define CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_SERVICE_H_
|
| +
|
| +#include <memory>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "base/time/time.h"
|
| +#include "base/timer/timer.h"
|
| +
|
| +class DesktopEngagementService {
|
| + public:
|
| + static void Initialize();
|
| + static bool IsInitialized();
|
| + static DesktopEngagementService* Get();
|
| +
|
| + void OnUserEvent();
|
| +
|
| + void OnVisibilityChanged(bool visible);
|
| +
|
| + void OnAudioStart();
|
| + void OnAudioEnd();
|
| +
|
| + private:
|
| + DesktopEngagementService();
|
| + ~DesktopEngagementService();
|
| +
|
| + void StartTimer(base::TimeDelta duration);
|
| + void OnTimerFired();
|
| +
|
| + void StartSession();
|
| + void EndSession();
|
| +
|
| + base::TimeTicks session_start_;
|
| + base::TimeTicks last_user_event_;
|
| +
|
| + bool is_visible_ = false;
|
| + bool in_session_ = false;
|
| + bool is_audio_playing_ = false;
|
| +
|
| + base::OneShotTimer timer_;
|
| +
|
| + base::WeakPtrFactory<DesktopEngagementService> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DesktopEngagementService);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_SERVICE_H_
|
|
|