Chromium Code Reviews| Index: chrome/browser/policy/device_token_fetcher.cc |
| diff --git a/chrome/browser/policy/device_token_fetcher.cc b/chrome/browser/policy/device_token_fetcher.cc |
| index 1952747394c6fbb36c3c29e0147414f002e2f15f..11b923f4741ba1663abec9ccd4bb25bebe3c5c6e 100644 |
| --- a/chrome/browser/policy/device_token_fetcher.cc |
| +++ b/chrome/browser/policy/device_token_fetcher.cc |
| @@ -87,11 +87,25 @@ void DeviceTokenFetcher::OnError(DeviceManagementBackend::ErrorCode code) { |
| if (code == DeviceManagementBackend::kErrorServiceManagementNotSupported) { |
| device_token_ = std::string(); |
| device_id_ = std::string(); |
| - file_util::Delete(token_path_, false); |
| + // This line is necessary to work around Windows compiler weirdness. |
|
danno
2010/11/23 12:10:14
Perhaps something more specific like: Without the
Jakob Kummerow (corp)
2010/11/23 12:25:26
Done.
I changed the whole workaround to a solution
|
| + bool (*delete_function) (const FilePath&, bool) = &file_util::Delete; |
| + BrowserThread::PostTask( |
| + BrowserThread::FILE, |
| + FROM_HERE, |
| + NewRunnableFunction(delete_function, token_path_, false)); |
| + SetState(kStateNotManaged); |
| + return; |
| } |
| SetState(kStateFailure); |
| } |
| +void DeviceTokenFetcher::Restart() { |
| + DCHECK(!IsTokenPending()); |
| + device_token_.clear(); |
| + device_token_load_complete_event_.Reset(); |
| + MakeReadyToRequestDeviceToken(); |
| +} |
| + |
| void DeviceTokenFetcher::StartFetching() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| if (state_ == kStateNotStarted) { |
| @@ -186,12 +200,13 @@ void DeviceTokenFetcher::SetState(FetcherState state) { |
| state_ = state; |
| if (state == kStateFailure) { |
| device_token_load_complete_event_.Signal(); |
| + NotifyTokenError(); |
| + } else if (state == kStateNotManaged) { |
| + device_token_load_complete_event_.Signal(); |
| + NotifyNotManaged(); |
| } else if (state == kStateHasDeviceToken) { |
| device_token_load_complete_event_.Signal(); |
| - NotificationService::current()->Notify( |
| - NotificationType::DEVICE_TOKEN_AVAILABLE, |
| - Source<DeviceTokenFetcher>(this), |
| - NotificationService::NoDetails()); |
| + NotifyTokenSuccess(); |
| } |
| } |