OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
16 | 16 |
17 class PrefRegistrySyncable; | |
18 class Profile; | 17 class Profile; |
19 | 18 |
20 namespace content { | 19 namespace content { |
21 class BrowserPpapiHost; | 20 class BrowserPpapiHost; |
22 } | 21 } |
23 | 22 |
| 23 namespace user_prefs { |
| 24 class PrefRegistrySyncable; |
| 25 } |
| 26 |
24 namespace chrome { | 27 namespace chrome { |
25 | 28 |
26 class PepperFlashDeviceIDHost; | 29 class PepperFlashDeviceIDHost; |
27 | 30 |
28 // This class allows asynchronously fetching a unique device ID. The callback | 31 // This class allows asynchronously fetching a unique device ID. The callback |
29 // passed in on creation will be called when the ID has been fetched. | 32 // passed in on creation will be called when the ID has been fetched. |
30 class DeviceIDFetcher : public base::RefCountedThreadSafe<DeviceIDFetcher> { | 33 class DeviceIDFetcher : public base::RefCountedThreadSafe<DeviceIDFetcher> { |
31 public: | 34 public: |
32 typedef base::Callback<void(const std::string&)> IDCallback; | 35 typedef base::Callback<void(const std::string&)> IDCallback; |
33 | 36 |
34 explicit DeviceIDFetcher(const IDCallback& callback, PP_Instance instance); | 37 explicit DeviceIDFetcher(const IDCallback& callback, PP_Instance instance); |
35 | 38 |
36 // Schedules the request operation. | 39 // Schedules the request operation. |
37 void Start(content::BrowserPpapiHost* browser_host); | 40 void Start(content::BrowserPpapiHost* browser_host); |
38 | 41 |
39 // Called to register the |kEnableDRM| and |kDRMSalt| preferences. | 42 // Called to register the |kEnableDRM| and |kDRMSalt| preferences. |
40 static void RegisterUserPrefs(PrefRegistrySyncable* prefs); | 43 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* prefs); |
41 | 44 |
42 // Return the path where the legacy device ID is stored (for ChromeOS only). | 45 // Return the path where the legacy device ID is stored (for ChromeOS only). |
43 static base::FilePath GetLegacyDeviceIDPath( | 46 static base::FilePath GetLegacyDeviceIDPath( |
44 const base::FilePath& profile_path); | 47 const base::FilePath& profile_path); |
45 | 48 |
46 private: | 49 private: |
47 ~DeviceIDFetcher(); | 50 ~DeviceIDFetcher(); |
48 | 51 |
49 // Checks the preferences for DRM (whether DRM is enabled and getting the drm | 52 // Checks the preferences for DRM (whether DRM is enabled and getting the drm |
50 // salt) on the UI thread. These are passed to |ComputeOnIOThread|. | 53 // salt) on the UI thread. These are passed to |ComputeOnIOThread|. |
(...skipping 19 matching lines...) Expand all Loading... |
70 IDCallback callback_; | 73 IDCallback callback_; |
71 | 74 |
72 PP_Instance instance_; | 75 PP_Instance instance_; |
73 | 76 |
74 DISALLOW_COPY_AND_ASSIGN(DeviceIDFetcher); | 77 DISALLOW_COPY_AND_ASSIGN(DeviceIDFetcher); |
75 }; | 78 }; |
76 | 79 |
77 } // namespace chrome | 80 } // namespace chrome |
78 | 81 |
79 #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ | 82 #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ |
OLD | NEW |