Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/metrics/machine_id_provider_win.cc

Issue 292723004: Remove ClonedInstallDetector/MachineIdProvider //content dependencies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Eliminate test dependency Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/metrics/machine_id_provider.h" 5 #include "chrome/browser/metrics/machine_id_provider.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <winioctl.h> 8 #include <winioctl.h>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.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/threading/thread_restrictions.h"
13 #include "base/win/scoped_handle.h" 14 #include "base/win/scoped_handle.h"
14 #include "content/public/browser/browser_thread.h"
15 15
16 namespace metrics { 16 namespace metrics {
17 17
18 MachineIdProvider::MachineIdProvider() {} 18 MachineIdProvider::MachineIdProvider() {}
19 MachineIdProvider::~MachineIdProvider() {} 19 MachineIdProvider::~MachineIdProvider() {}
20 20
21 // On windows, the machine id is based on the serial number of the drive Chrome 21 // On windows, the machine id is based on the serial number of the drive Chrome
22 // is running from. 22 // is running from.
23 std::string MachineIdProvider::GetMachineId() { 23 std::string MachineIdProvider::GetMachineId() {
24 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 24 base::ThreadRestrictions::AssertIOAllowed();
25 25
26 // Use the program's path to get the drive used for the machine id. This means 26 // Use the program's path to get the drive used for the machine id. This means
27 // that whenever the underlying drive changes, it's considered a new machine. 27 // that whenever the underlying drive changes, it's considered a new machine.
28 // This is fine as we do not support migrating Chrome installs to new drives. 28 // This is fine as we do not support migrating Chrome installs to new drives.
29 base::FilePath executable_path; 29 base::FilePath executable_path;
30 30
31 if (!PathService::Get(base::FILE_EXE, &executable_path)) { 31 if (!PathService::Get(base::FILE_EXE, &executable_path)) {
32 NOTREACHED(); 32 NOTREACHED();
33 return std::string(); 33 return std::string();
34 } 34 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 return std::string(serial_number); 98 return std::string(serial_number);
99 } 99 }
100 100
101 // static 101 // static
102 MachineIdProvider* MachineIdProvider::CreateInstance() { 102 MachineIdProvider* MachineIdProvider::CreateInstance() {
103 return new MachineIdProvider(); 103 return new MachineIdProvider();
104 } 104 }
105 105
106 } // namespace metrics 106 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698