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" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); | 43 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); |
44 | 44 |
45 // 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). |
46 static base::FilePath GetLegacyDeviceIDPath( | 46 static base::FilePath GetLegacyDeviceIDPath( |
47 const base::FilePath& profile_path); | 47 const base::FilePath& profile_path); |
48 | 48 |
49 private: | 49 private: |
50 ~DeviceIDFetcher(); | 50 ~DeviceIDFetcher(); |
51 | 51 |
52 // 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 |
53 // salt) on the UI thread. These are passed to |ComputeOnIOThread|. | 53 // salt) on the UI thread. |
54 void CheckPrefsOnUIThread(); | 54 void CheckPrefsOnUIThread(); |
55 | 55 |
56 // Compute the device ID on the IO thread with the given salt. | 56 // Compute the device ID on the UI thread with the given salt and machine ID. |
57 void ComputeOnIOThread(const std::string& salt); | 57 void ComputeOnUIThread(const std::string& salt, |
| 58 const std::string& machine_id); |
| 59 |
58 // Legacy method used to get the device ID for ChromeOS. | 60 // Legacy method used to get the device ID for ChromeOS. |
59 void ComputeOnBlockingPool(const base::FilePath& profile_path, | 61 void LegacyComputeOnBlockingPool(const base::FilePath& profile_path, |
60 const std::string& salt); | 62 const std::string& salt); |
61 | 63 |
62 // Runs the callback passed into Start() on the IO thread with the device ID | 64 // Runs the callback passed into Start() on the IO thread with the device ID |
63 // or the empty string on failure. | 65 // or the empty string on failure. |
64 void RunCallbackOnIOThread(const std::string& id); | 66 void RunCallbackOnIOThread(const std::string& id); |
65 | 67 |
66 // Helper which returns an ID unique to the system. Returns an empty string if | |
67 // the call fails. | |
68 std::string GetMachineID(); | |
69 | |
70 friend class base::RefCountedThreadSafe<DeviceIDFetcher>; | 68 friend class base::RefCountedThreadSafe<DeviceIDFetcher>; |
71 | 69 |
72 // The callback to run when the ID has been fetched. | 70 // The callback to run when the ID has been fetched. |
73 IDCallback callback_; | 71 IDCallback callback_; |
74 | 72 |
75 // Whether a request is in progress. | 73 // Whether a request is in progress. |
76 bool in_progress_; | 74 bool in_progress_; |
77 | 75 |
78 int render_process_id_; | 76 int render_process_id_; |
79 | 77 |
80 DISALLOW_COPY_AND_ASSIGN(DeviceIDFetcher); | 78 DISALLOW_COPY_AND_ASSIGN(DeviceIDFetcher); |
81 }; | 79 }; |
82 | 80 |
83 } // namespace chrome | 81 } // namespace chrome |
84 | 82 |
85 #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ | 83 #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ |
OLD | NEW |