Chromium Code Reviews| Index: chrome/browser/metrics/desktop_engagement/chrome_visibility_observer.h |
| diff --git a/chrome/browser/metrics/desktop_engagement/chrome_visibility_observer.h b/chrome/browser/metrics/desktop_engagement/chrome_visibility_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ae0a4648bbccef5acd271168be3068eb9628ea39 |
| --- /dev/null |
| +++ b/chrome/browser/metrics/desktop_engagement/chrome_visibility_observer.h |
| @@ -0,0 +1,41 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|
Alexei Svitkine (slow)
2016/07/26 19:20:37
No (c) in new files. Fix throughout.
gayane -on leave until 09-2017
2016/07/26 21:41:19
Done.
|
| +// 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_CHROME_VISIBILITY_OBSERVER_H_ |
| +#define CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_CHROME_VISIBILITY_OBSERVER_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/ui/browser_list_observer.h" |
| + |
| +namespace metrics { |
| + |
| +// Observer for tracking browser visibility events. |
| +class ChromeVisibilityObserver : public chrome::BrowserListObserver { |
| + public: |
| + ChromeVisibilityObserver(); |
| + ~ChromeVisibilityObserver() override; |
| + |
| + static void Initialize(); |
|
Alexei Svitkine (slow)
2016/07/26 19:20:37
Add a comment.
gayane -on leave until 09-2017
2016/07/26 21:41:19
Done.
|
| + |
| + private: |
| + virtual void SendVisibilityChangeEvent(bool active); |
|
Alexei Svitkine (slow)
2016/07/26 19:20:37
Please add a short comment above all of these meth
gayane -on leave until 09-2017
2016/07/26 21:41:19
Done.
|
| + void CancelVisibilityChange(); |
| + |
| + // chrome::BrowserListObserver: |
| + void OnBrowserSetLastActive(Browser* browser) override; |
| + void OnBrowserNoLongerActive(Browser* browser) override; |
| + void OnBrowserRemoved(Browser* browser) override; |
| + |
| + void InitVisibilityGapTimeout(); |
| + |
| + base::TimeDelta visibility_gap_timeout_; |
| + |
| + base::WeakPtrFactory<ChromeVisibilityObserver> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ChromeVisibilityObserver); |
| +}; |
| + |
| +} // namespace metrics |
| + |
| +#endif // CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_CHROME_VISIBILITY_OBSERVER_H_ |