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 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" | 5 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "components/prefs/pref_service.h" | 13 #include "components/prefs/pref_service.h" |
14 #if defined(OS_CHROMEOS) | |
15 #include "chromeos/cryptohome/system_salt_getter.h" | |
16 #endif | |
17 #include "components/pref_registry/pref_registry_syncable.h" | 14 #include "components/pref_registry/pref_registry_syncable.h" |
18 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
19 #include "content/public/browser/browser_ppapi_host.h" | 16 #include "content/public/browser/browser_ppapi_host.h" |
20 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/render_process_host.h" | 18 #include "content/public/browser/render_process_host.h" |
22 #include "crypto/encryptor.h" | 19 #include "crypto/encryptor.h" |
23 #include "crypto/random.h" | 20 #include "crypto/random.h" |
24 #include "crypto/sha2.h" | 21 #include "crypto/sha2.h" |
25 #include "ppapi/c/pp_errors.h" | 22 #include "ppapi/c/pp_errors.h" |
26 #if defined(ENABLE_RLZ) | 23 #include "rlz/features/features.h" |
| 24 |
| 25 #if defined(OS_CHROMEOS) |
| 26 #include "chromeos/cryptohome/system_salt_getter.h" |
| 27 #endif |
| 28 |
| 29 #if BUILDFLAG(ENABLE_RLZ) |
27 #include "rlz/lib/machine_id.h" | 30 #include "rlz/lib/machine_id.h" |
28 #endif | 31 #endif |
29 | 32 |
30 using content::BrowserPpapiHost; | 33 using content::BrowserPpapiHost; |
31 using content::BrowserThread; | 34 using content::BrowserThread; |
32 using content::RenderProcessHost; | 35 using content::RenderProcessHost; |
33 | 36 |
34 namespace chrome { | 37 namespace chrome { |
35 | 38 |
36 namespace { | 39 namespace { |
37 | 40 |
38 const char kDRMIdentifierFile[] = "Pepper DRM ID.0"; | 41 const char kDRMIdentifierFile[] = "Pepper DRM ID.0"; |
39 | 42 |
40 const uint32_t kSaltLength = 32; | 43 const uint32_t kSaltLength = 32; |
41 | 44 |
42 void GetMachineIDAsync( | 45 void GetMachineIDAsync( |
43 const base::Callback<void(const std::string&)>& callback) { | 46 const base::Callback<void(const std::string&)>& callback) { |
44 #if defined(OS_WIN) && defined(ENABLE_RLZ) | 47 #if defined(OS_WIN) && BUILDFLAG(ENABLE_RLZ) |
45 std::string result; | 48 std::string result; |
46 rlz_lib::GetMachineId(&result); | 49 rlz_lib::GetMachineId(&result); |
47 callback.Run(result); | 50 callback.Run(result); |
48 #elif defined(OS_CHROMEOS) | 51 #elif defined(OS_CHROMEOS) |
49 chromeos::SystemSaltGetter::Get()->GetSystemSalt(callback); | 52 chromeos::SystemSaltGetter::Get()->GetSystemSalt(callback); |
50 #else | 53 #else |
51 // Not implemented for other platforms. | 54 // Not implemented for other platforms. |
52 NOTREACHED(); | 55 NOTREACHED(); |
53 callback.Run(std::string()); | 56 callback.Run(std::string()); |
54 #endif | 57 #endif |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 BrowserThread::IO, | 208 BrowserThread::IO, |
206 FROM_HERE, | 209 FROM_HERE, |
207 base::Bind(&DeviceIDFetcher::RunCallbackOnIOThread, this, id, result)); | 210 base::Bind(&DeviceIDFetcher::RunCallbackOnIOThread, this, id, result)); |
208 return; | 211 return; |
209 } | 212 } |
210 in_progress_ = false; | 213 in_progress_ = false; |
211 callback_.Run(id, result); | 214 callback_.Run(id, result); |
212 } | 215 } |
213 | 216 |
214 } // namespace chrome | 217 } // namespace chrome |
OLD | NEW |