| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // make NetworkStateInformer more independent from the WebUI handlers. | 140 // make NetworkStateInformer more independent from the WebUI handlers. |
| 141 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); | 141 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); |
| 142 OnNetworkChanged(net::NetworkChangeNotifier::GetConnectionType()); | 142 OnNetworkChanged(net::NetworkChangeNotifier::GetConnectionType()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void StartupAppLauncher::InitializeTokenService() { | 145 void StartupAppLauncher::InitializeTokenService() { |
| 146 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitializingTokenService()); | 146 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitializingTokenService()); |
| 147 | 147 |
| 148 ProfileOAuth2TokenService* profile_token_service = | 148 ProfileOAuth2TokenService* profile_token_service = |
| 149 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 149 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
| 150 if (profile_token_service->RefreshTokenIsAvailable()) { | 150 if (profile_token_service->RefreshTokenIsAvailable( |
| 151 profile_token_service->GetPrimaryAccountId())) { |
| 151 InitializeNetwork(); | 152 InitializeNetwork(); |
| 152 return; | 153 return; |
| 153 } | 154 } |
| 154 | 155 |
| 155 // At the end of this method, the execution will be put on hold until | 156 // At the end of this method, the execution will be put on hold until |
| 156 // ProfileOAuth2TokenService triggers either OnRefreshTokenAvailable or | 157 // ProfileOAuth2TokenService triggers either OnRefreshTokenAvailable or |
| 157 // OnRefreshTokensLoaded. Given that we want to handle exactly one event, | 158 // OnRefreshTokensLoaded. Given that we want to handle exactly one event, |
| 158 // whichever comes first, both handlers call RemoveObserver on PO2TS. Handling | 159 // whichever comes first, both handlers call RemoveObserver on PO2TS. Handling |
| 159 // any of the two events is the only way to resume the execution and enable | 160 // any of the two events is the only way to resume the execution and enable |
| 160 // Cleanup method to be called, self-invoking a destructor. In destructor | 161 // Cleanup method to be called, self-invoking a destructor. In destructor |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 DVLOG(1) << "Network up and running!"; | 277 DVLOG(1) << "Network up and running!"; |
| 277 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); | 278 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); |
| 278 | 279 |
| 279 BeginInstall(); | 280 BeginInstall(); |
| 280 } else { | 281 } else { |
| 281 DVLOG(1) << "Network not running yet!"; | 282 DVLOG(1) << "Network not running yet!"; |
| 282 } | 283 } |
| 283 } | 284 } |
| 284 | 285 |
| 285 } // namespace chromeos | 286 } // namespace chromeos |
| OLD | NEW |