[go: nahoru, domu]

blob: a98e3fb7ebe4b15837fd69a6d90b83e19358e723 [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
10#include "base/prefs/pref_member.h"
11#include "components/user_prefs/pref_registry_syncable.h"
12
13class PrefService;
14
15// MediaDeviceIDSalt is responsible for creating and retrieving a salt string
16// that is used for creating MediaSource IDs that can be cached by a web
17// service. If the cache is cleared, the MediaSourceIds are invalidated.
18class MediaDeviceIDSalt {
19 public:
20 MediaDeviceIDSalt(PrefService* pref_service,
21 bool incognito);
22 ~MediaDeviceIDSalt();
23 void ShutdownOnUIThread();
24
25 std::string GetSalt() const;
26
27 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
28 static void Reset(PrefService* pref_service);
29
30 private:
31 // |incognito_salt_| is initialized in ctor on UI thread but only read
32 // on the IO thread.
33 std::string incognito_salt_;
34 mutable StringPrefMember media_device_id_salt_;
35
36 DISALLOW_COPY_AND_ASSIGN(MediaDeviceIDSalt);
37};
38
39#endif // CHROME_BROWSER_MEDIA_MEDIA_DEVICE_ID_SALT_H_