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

Side by Side Diff: chrome/browser/policy/auto_enrollment_client.cc

Issue 10540003: Move guid generation from chrome/common/ to base/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: installer Created 8 years, 6 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
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | chrome/browser/policy/cloud_policy_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/policy/auto_enrollment_client.h" 5 #include "chrome/browser/policy/auto_enrollment_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/guid.h"
9 #include "base/location.h" 10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
14 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/policy/browser_policy_connector.h" 16 #include "chrome/browser/policy/browser_policy_connector.h"
16 #include "chrome/browser/policy/device_management_service.h" 17 #include "chrome/browser/policy/device_management_service.h"
17 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/guid.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "crypto/sha2.h" 21 #include "crypto/sha2.h"
22 22
23 namespace em = enterprise_management; 23 namespace em = enterprise_management;
24 24
25 namespace { 25 namespace {
26 26
27 // The modulus value is sent in an int64 field in the protobuf, whose maximum 27 // The modulus value is sent in an int64 field in the protobuf, whose maximum
28 // value is 2^63-1. So 2^64 and 2^63 can't be represented as moduli and the 28 // value is 2^63-1. So 2^64 and 2^63 can't be represented as moduli and the
29 // max is 2^62 (when the moduli are restricted to powers-of-2). 29 // max is 2^62 (when the moduli are restricted to powers-of-2).
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 namespace policy { 70 namespace policy {
71 71
72 AutoEnrollmentClient::AutoEnrollmentClient(const base::Closure& callback, 72 AutoEnrollmentClient::AutoEnrollmentClient(const base::Closure& callback,
73 DeviceManagementService* service, 73 DeviceManagementService* service,
74 PrefService* local_state, 74 PrefService* local_state,
75 const std::string& serial_number, 75 const std::string& serial_number,
76 int power_initial, 76 int power_initial,
77 int power_limit) 77 int power_limit)
78 : completion_callback_(callback), 78 : completion_callback_(callback),
79 should_auto_enroll_(false), 79 should_auto_enroll_(false),
80 device_id_(guid::GenerateGUID()), 80 device_id_(base::GenerateGUID()),
81 power_initial_(power_initial), 81 power_initial_(power_initial),
82 power_limit_(power_limit), 82 power_limit_(power_limit),
83 requests_sent_(0), 83 requests_sent_(0),
84 device_management_service_(service), 84 device_management_service_(service),
85 local_state_(local_state) { 85 local_state_(local_state) {
86 DCHECK_LE(power_initial_, power_limit_); 86 DCHECK_LE(power_initial_, power_limit_);
87 if (!serial_number.empty()) 87 if (!serial_number.empty())
88 serial_number_hash_ = crypto::SHA256HashString(serial_number); 88 serial_number_hash_ = crypto::SHA256HashString(serial_number);
89 } 89 }
90 90
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // This samples |kZero| when there was no need for extra time, so that we can 332 // This samples |kZero| when there was no need for extra time, so that we can
333 // measure the ratio of users that succeeded without needing a delay to the 333 // measure the ratio of users that succeeded without needing a delay to the
334 // total users going through OOBE. 334 // total users going through OOBE.
335 UMA_HISTOGRAM_CUSTOM_TIMES(kExtraTime, delta, kMin, kMax, kBuckets); 335 UMA_HISTOGRAM_CUSTOM_TIMES(kExtraTime, delta, kMin, kMax, kBuckets);
336 336
337 if (!completion_callback_.is_null()) 337 if (!completion_callback_.is_null())
338 completion_callback_.Run(); 338 completion_callback_.Run();
339 } 339 }
340 340
341 } // namespace policy 341 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | chrome/browser/policy/cloud_policy_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698