OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/system/drm_settings.h" | 5 #include "chrome/browser/chromeos/system/drm_settings.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "chrome/browser/chromeos/cros/cros_library.h" | 15 #include "chrome/browser/chromeos/cros/cros_library.h" |
16 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 16 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
17 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chromeos/chromeos_switches.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "crypto/encryptor.h" | 22 #include "crypto/encryptor.h" |
22 #include "crypto/sha2.h" | 23 #include "crypto/sha2.h" |
23 | 24 |
24 using content::BrowserThread; | 25 using content::BrowserThread; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 // This constant is mirrored in | 29 // This constant is mirrored in |
29 // content/browser/renderer_host/pepper_message_filter.cc | 30 // content/browser/renderer_host/pepper_message_filter.cc |
30 // for OnGetDeviceID. | 31 // for OnGetDeviceID. |
31 // | 32 // |
32 // This ID file is solely for use via the private pepper API. | 33 // This ID file is solely for use via the private pepper API. |
33 // | 34 // |
34 // NOTE! Changing this value will also change the generated value | 35 // NOTE! Changing this value will also change the generated value |
35 // do not do so without accounting for the change. | 36 // do not do so without accounting for the change. |
36 const char kDRMIdentifierFile[] = "Pepper DRM ID.0"; | 37 const char kDRMIdentifierFile[] = "Pepper DRM ID.0"; |
37 | 38 |
38 void ManageDrmIdentifierOnFileThread(bool enable, const std::string& email) { | 39 void ManageDrmIdentifierOnFileThread(bool enable, const std::string& email) { |
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
40 | 41 |
41 // Drop the file under <data>/<profile>/<drm id file>. | 42 // Drop the file under <data>/<profile>/<drm id file>. |
42 // TODO(wad) get the profile directory in a more succinct fashion. | 43 // TODO(wad) get the profile directory in a more succinct fashion. |
43 base::FilePath drm_id_file; | 44 base::FilePath drm_id_file; |
44 PathService::Get(chrome::DIR_USER_DATA, &drm_id_file); | 45 PathService::Get(chrome::DIR_USER_DATA, &drm_id_file); |
45 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 46 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
46 base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); | 47 base::FilePath profile = cmd_line.GetSwitchValuePath( |
| 48 chromeos::switches::kLoginProfile); |
47 if (profile.empty()) { | 49 if (profile.empty()) { |
48 LOG(ERROR) << "called with no login-profile!"; | 50 LOG(ERROR) << "called with no login-profile!"; |
49 return; | 51 return; |
50 } | 52 } |
51 drm_id_file = drm_id_file.AppendASCII(profile.value()); | 53 drm_id_file = drm_id_file.AppendASCII(profile.value()); |
52 drm_id_file = drm_id_file.AppendASCII(kDRMIdentifierFile); | 54 drm_id_file = drm_id_file.AppendASCII(kDRMIdentifierFile); |
53 | 55 |
54 // The file will be regenerated or deleted at toggle-time. | 56 // The file will be regenerated or deleted at toggle-time. |
55 file_util::Delete(drm_id_file, false); | 57 file_util::Delete(drm_id_file, false); |
56 | 58 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // by privileged pepper plugins specifically for deriving | 125 // by privileged pepper plugins specifically for deriving |
124 // per-content-provider identifiers. The user must be able to clear it, | 126 // per-content-provider identifiers. The user must be able to clear it, |
125 // reset it, and deny its use. | 127 // reset it, and deny its use. |
126 BrowserThread::PostTask( | 128 BrowserThread::PostTask( |
127 BrowserThread::FILE, FROM_HERE, | 129 BrowserThread::FILE, FROM_HERE, |
128 base::Bind(&ManageDrmIdentifierOnFileThread, enable, email)); | 130 base::Bind(&ManageDrmIdentifierOnFileThread, enable, email)); |
129 } | 131 } |
130 | 132 |
131 } // namespace system | 133 } // namespace system |
132 } // namespace chromeos | 134 } // namespace chromeos |
OLD | NEW |