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 
5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENT_LOG_MANAGER_KEYED_SERVICE_H_
6 #define CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENT_LOG_MANAGER_KEYED_SERVICE_H_
7 
8 #include "base/macros.h"
9 #include "components/keyed_service/core/keyed_service.h"
10 
11 namespace content {
12 class BrowserContext;
13 }  // namespace content
14 
15 namespace webrtc_event_logging {
16 
17 // KeyedService working on behalf of WebRtcEventLogManager, informing it when
18 // new BrowserContext-s are loaded.
19 class WebRtcEventLogManagerKeyedService : public KeyedService {
20  public:
21   explicit WebRtcEventLogManagerKeyedService(
22       content::BrowserContext* browser_context);
23 
24   ~WebRtcEventLogManagerKeyedService() override = default;
25 
26   void Shutdown() override;
27 
28  private:
29   // The BrowserContext associated with this instance of the service.
30   content::BrowserContext* const browser_context_;
31 
32   // Whether the singleton content::WebRtcEventLogger existed at the time this
33   // service was instantiated, and therefore got the report that this
34   // BrowserContext was loaded.
35   // See usage for rationale.
36   bool reported_;
37 
38   DISALLOW_COPY_AND_ASSIGN(WebRtcEventLogManagerKeyedService);
39 };
40 
41 }  // namespace webrtc_event_logging
42 
43 #endif  // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENT_LOG_MANAGER_KEYED_SERVICE_H_
44