[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / components / media_device_salt / media_device_id_salt.h
1 // Copyright 2013 The Chromium Authors
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 COMPONENTS_MEDIA_DEVICE_SALT_MEDIA_DEVICE_ID_SALT_H_
6 #define COMPONENTS_MEDIA_DEVICE_SALT_MEDIA_DEVICE_ID_SALT_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "components/pref_registry/pref_registry_syncable.h"
12 #include "components/prefs/pref_member.h"
13
14 class PrefService;
15
16 namespace media_device_salt {
17
18 namespace prefs {
19 extern const char kMediaDeviceIdSalt[];
20 }
21
22 // MediaDeviceIDSalt is responsible for creating and retrieving a salt string
23 // that is used for creating MediaSource IDs that can be cached by a web
24 // service. If the cache is cleared, the  MediaSourceIds are invalidated.
25 //
26 // The class is reference counted so that it can be used in the
27 // callback returned by ResourceContext::GetMediaDeviceIDSalt.
28 class MediaDeviceIDSalt : public base::RefCountedThreadSafe<MediaDeviceIDSalt> {
29  public:
30   explicit MediaDeviceIDSalt(PrefService* pref_service);
31
32   MediaDeviceIDSalt(const MediaDeviceIDSalt&) = delete;
33   MediaDeviceIDSalt& operator=(const MediaDeviceIDSalt&) = delete;
34
35   static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
36
37   std::string GetSalt() const;
38   static void Reset(PrefService* pref_service);
39
40  private:
41   friend class base::RefCountedThreadSafe<MediaDeviceIDSalt>;
42   ~MediaDeviceIDSalt();
43
44   mutable StringPrefMember media_device_id_salt_;
45 };
46
47 }  // namespace media_device_salt
48
49 #endif  // COMPONENTS_MEDIA_DEVICE_SALT_MEDIA_DEVICE_ID_SALT_H_