| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_mode/startup_app_launcher.h" | 5 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); | 145 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); |
| 146 OnNetworkChanged(net::NetworkChangeNotifier::GetConnectionType()); | 146 OnNetworkChanged(net::NetworkChangeNotifier::GetConnectionType()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void StartupAppLauncher::InitializeTokenService() { | 149 void StartupAppLauncher::InitializeTokenService() { |
| 150 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitializingTokenService()); | 150 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitializingTokenService()); |
| 151 | 151 |
| 152 ProfileOAuth2TokenService* profile_token_service = | 152 ProfileOAuth2TokenService* profile_token_service = |
| 153 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 153 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
| 154 if (profile_token_service->RefreshTokenIsAvailable()) { | 154 if (profile_token_service->RefreshTokenIsAvailable( |
| 155 profile_token_service->GetPrimaryAccountId())) { |
| 155 InitializeNetwork(); | 156 InitializeNetwork(); |
| 156 return; | 157 return; |
| 157 } | 158 } |
| 158 | 159 |
| 159 // At the end of this method, the execution will be put on hold until | 160 // At the end of this method, the execution will be put on hold until |
| 160 // ProfileOAuth2TokenService triggers either OnRefreshTokenAvailable or | 161 // ProfileOAuth2TokenService triggers either OnRefreshTokenAvailable or |
| 161 // OnRefreshTokensLoaded. Given that we want to handle exactly one event, | 162 // OnRefreshTokensLoaded. Given that we want to handle exactly one event, |
| 162 // whichever comes first, both handlers call RemoveObserver on PO2TS. Handling | 163 // whichever comes first, both handlers call RemoveObserver on PO2TS. Handling |
| 163 // any of the two events is the only way to resume the execution and enable | 164 // any of the two events is the only way to resume the execution and enable |
| 164 // Cleanup method to be called, self-invoking a destructor. In destructor | 165 // Cleanup method to be called, self-invoking a destructor. In destructor |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); | 291 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); |
| 291 network_wait_timer_.Stop(); | 292 network_wait_timer_.Stop(); |
| 292 | 293 |
| 293 BeginInstall(); | 294 BeginInstall(); |
| 294 } else { | 295 } else { |
| 295 DVLOG(1) << "Network not running yet!"; | 296 DVLOG(1) << "Network not running yet!"; |
| 296 } | 297 } |
| 297 } | 298 } |
| 298 | 299 |
| 299 } // namespace chromeos | 300 } // namespace chromeos |
| OLD | NEW |