[go: nahoru, domu]

blob: 8db27317d876f871a2278506487d842ae37f02f9 [file] [log] [blame]
perkj@chromium.orgcd80cce2013-12-02 15:19:191// Copyright 2013 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_MEDIA_DEVICE_ID_SALT_H_
6#define CHROME_BROWSER_MEDIA_MEDIA_DEVICE_ID_SALT_H_
7
8#include <string>
9
avi6846aef2015-12-26 01:09:3810#include "base/macros.h"
joi@chromium.orgf9583f82014-02-13 15:34:2111#include "base/memory/ref_counted.h"
tfarina@chromium.orgf0c8c4992014-05-15 17:37:2612#include "components/pref_registry/pref_registry_syncable.h"
brettwb1fc1b82016-02-02 00:19:0813#include "components/prefs/pref_member.h"
perkj@chromium.orgcd80cce2013-12-02 15:19:1914
15class PrefService;
16
17// MediaDeviceIDSalt is responsible for creating and retrieving a salt string
18// that is used for creating MediaSource IDs that can be cached by a web
19// service. If the cache is cleared, the MediaSourceIds are invalidated.
joi@chromium.orgf9583f82014-02-13 15:34:2120//
21// The class is reference counted so that it can be used in the
22// callback returned by ResourceContext::GetMediaDeviceIDSalt.
23class MediaDeviceIDSalt : public base::RefCountedThreadSafe<MediaDeviceIDSalt> {
perkj@chromium.orgcd80cce2013-12-02 15:19:1924 public:
guidou91768ed2016-06-15 15:49:5125 explicit MediaDeviceIDSalt(PrefService* pref_service);
perkj@chromium.orgcd80cce2013-12-02 15:19:1926 void ShutdownOnUIThread();
27
28 std::string GetSalt() const;
29
30 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
31 static void Reset(PrefService* pref_service);
32
33 private:
joi@chromium.orgf9583f82014-02-13 15:34:2134 friend class base::RefCountedThreadSafe<MediaDeviceIDSalt>;
35 ~MediaDeviceIDSalt();
36
perkj@chromium.orgcd80cce2013-12-02 15:19:1937 mutable StringPrefMember media_device_id_salt_;
38
39 DISALLOW_COPY_AND_ASSIGN(MediaDeviceIDSalt);
40};
41
42#endif // CHROME_BROWSER_MEDIA_MEDIA_DEVICE_ID_SALT_H_