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

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

Issue 213363004: Resetting metrics ids on clump detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
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/win/scoped_handle.h" 13 #include "base/win/scoped_handle.h"
14 #include "content/public/browser/browser_thread.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 DVLOG(2) << "\n\nGetting machine id\n\n";
24 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 25 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
25 26
26 // Use the program's path to get the drive used for the machine id. This means 27 // 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. 28 // 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. 29 // This is fine as we do not support migrating Chrome installs to new drives.
29 base::FilePath executable_path; 30 base::FilePath executable_path;
30 31
31 if (!PathService::Get(base::FILE_EXE, &executable_path)) { 32 if (!PathService::Get(base::FILE_EXE, &executable_path)) {
32 NOTREACHED(); 33 NOTREACHED();
33 return std::string(); 34 return std::string();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 return std::string(serial_number); 99 return std::string(serial_number);
99 } 100 }
100 101
101 // static 102 // static
102 MachineIdProvider* MachineIdProvider::CreateInstance() { 103 MachineIdProvider* MachineIdProvider::CreateInstance() {
103 return new MachineIdProvider(); 104 return new MachineIdProvider();
104 } 105 }
105 106
106 } // namespace metrics 107 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698