Chromium Code Reviews| Index: chrome/browser/media/media_engagement_service.h |
| diff --git a/chrome/browser/media/media_engagement_service.h b/chrome/browser/media/media_engagement_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c4923547481025ede5d272177be472b3e9a9ffee |
| --- /dev/null |
| +++ b/chrome/browser/media/media_engagement_service.h |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2017 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_MEDIA_MEDIA_ENGAGEMENT_SERVICE_H_ |
| +#define CHROME_BROWSER_MEDIA_MEDIA_ENGAGEMENT_SERVICE_H_ |
| + |
| +#include <set> |
| + |
| +#include "components/keyed_service/core/keyed_service.h" |
| + |
| +class Profile; |
| + |
| +namespace content { |
| +class WebContents; |
| +} // namespace content |
| + |
| +class MediaEngagementService : public KeyedService { |
|
DaleCurtis
2017/04/25 16:57:59
I thought we used namespaces in chrome/ now?
mlamouri (slow - plz ping)
2017/04/25 17:14:41
I do not remember hearing about this and code arou
|
| + public: |
| + // Returns the instance attached to the given |profile|. |
| + static MediaEngagementService* Get(Profile* profile); |
| + |
| + // Returns whether the feature is enabled. |
| + static bool IsEnabled(); |
| + |
| + // Observe the given |web_contents| by creating an internal |
| + // WebContentsObserver. |
| + static void CreateWebContentsObserver(content::WebContents* web_contents); |
| + |
| + MediaEngagementService(Profile* profile); |
|
DaleCurtis
2017/04/25 16:57:59
explicit
mlamouri (slow - plz ping)
2017/04/25 17:14:41
We need automatic checks for these. Too easy to ad
|
| + ~MediaEngagementService() override; |
| + |
| + private: |
| + class ContentsObserver; |
| + |
| + std::set<ContentsObserver*> contents_observers_; |
|
DaleCurtis
2017/04/25 16:57:59
How many of these are expected? base::flat_set?
mlamouri (slow - plz ping)
2017/04/25 17:14:41
One per tab. I don't think flat_set is appropriate
|
| +}; |
|
DaleCurtis
2017/04/25 16:57:59
DISALLOW_COPY_AND_ASSIGN().
mlamouri (slow - plz ping)
2017/04/25 17:14:41
Done.
|
| + |
| +#endif // CHROME_BROWSER_MEDIA_MEDIA_ENGAGEMENT_SERVICE_H_ |