OLD | NEW |
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/chromeos/login/login_location_monitor.h" | 5 #include "chrome/browser/chromeos/login/login_location_monitor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/chromeos/login/wizard_controller.h" | 10 #include "chrome/browser/chromeos/login/wizard_controller.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 << GeopositionToStringForDebug(position) << "}"; | 111 << GeopositionToStringForDebug(position) << "}"; |
112 | 112 |
113 content::BrowserThread::PostTask( | 113 content::BrowserThread::PostTask( |
114 content::BrowserThread::UI, | 114 content::BrowserThread::UI, |
115 FROM_HERE, | 115 FROM_HERE, |
116 base::Bind(&LoginLocationMonitor::OnLocationUpdatedUI, position)); | 116 base::Bind(&LoginLocationMonitor::OnLocationUpdatedUI, position)); |
117 } | 117 } |
118 | 118 |
119 void LoginLocationMonitor::OnLocationUpdatedUI( | 119 void LoginLocationMonitor::OnLocationUpdatedUI( |
120 const content::Geoposition& position) { | 120 const content::Geoposition& position) { |
121 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 121 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
122 DCHECK(position.Validate()); | 122 DCHECK(position.Validate()); |
123 | 123 |
124 LoginLocationMonitor* self = GetInstance(); | 124 LoginLocationMonitor* self = GetInstance(); |
125 | 125 |
126 if (!self->request_timeout_.IsRunning()) { | 126 if (!self->request_timeout_.IsRunning()) { |
127 VLOG(1) | 127 VLOG(1) |
128 << "LoginLocationMonitor::OnLocationUpdatedUI(): Service is stopped: {" | 128 << "LoginLocationMonitor::OnLocationUpdatedUI(): Service is stopped: {" |
129 << GeopositionToStringForDebug(position) << "}"; | 129 << GeopositionToStringForDebug(position) << "}"; |
130 return; | 130 return; |
131 } | 131 } |
132 | 132 |
133 RemoveLocationCallback(); | 133 RemoveLocationCallback(); |
134 | 134 |
135 // We need a cumulative timeout for timezone resolve, that is | 135 // We need a cumulative timeout for timezone resolve, that is |
136 // (location resolve + timezone resolve). This is used to measure | 136 // (location resolve + timezone resolve). This is used to measure |
137 // timeout for the following timezone resolve. | 137 // timeout for the following timezone resolve. |
138 const base::TimeDelta elapsed = base::Time::Now() - self->started_; | 138 const base::TimeDelta elapsed = base::Time::Now() - self->started_; |
139 | 139 |
140 WizardController::OnLocationUpdated(position, elapsed); | 140 WizardController::OnLocationUpdated(position, elapsed); |
141 } | 141 } |
142 | 142 |
143 } // namespace chromeos | 143 } // namespace chromeos |
OLD | NEW |