| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // make NetworkStateInformer more independent from the WebUI handlers. | 146 // make NetworkStateInformer more independent from the WebUI handlers. |
| 147 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); | 147 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); |
| 148 OnNetworkChanged(net::NetworkChangeNotifier::GetConnectionType()); | 148 OnNetworkChanged(net::NetworkChangeNotifier::GetConnectionType()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void StartupAppLauncher::InitializeTokenService() { | 151 void StartupAppLauncher::InitializeTokenService() { |
| 152 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitializingTokenService()); | 152 FOR_EACH_OBSERVER(Observer, observer_list_, OnInitializingTokenService()); |
| 153 | 153 |
| 154 ProfileOAuth2TokenService* profile_token_service = | 154 ProfileOAuth2TokenService* profile_token_service = |
| 155 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 155 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
| 156 if (profile_token_service->RefreshTokenIsAvailable()) { | 156 if (profile_token_service->RefreshTokenIsAvailable( |
| 157 profile_token_service->GetPrimaryAccountId())) { |
| 157 InitializeNetwork(); | 158 InitializeNetwork(); |
| 158 return; | 159 return; |
| 159 } | 160 } |
| 160 | 161 |
| 161 // At the end of this method, the execution will be put on hold until | 162 // At the end of this method, the execution will be put on hold until |
| 162 // ProfileOAuth2TokenService triggers either OnRefreshTokenAvailable or | 163 // ProfileOAuth2TokenService triggers either OnRefreshTokenAvailable or |
| 163 // OnRefreshTokensLoaded. Given that we want to handle exactly one event, | 164 // OnRefreshTokensLoaded. Given that we want to handle exactly one event, |
| 164 // whichever comes first, both handlers call RemoveObserver on PO2TS. Handling | 165 // whichever comes first, both handlers call RemoveObserver on PO2TS. Handling |
| 165 // any of the two events is the only way to resume the execution and enable | 166 // any of the two events is the only way to resume the execution and enable |
| 166 // Cleanup method to be called, self-invoking a destructor. In destructor | 167 // Cleanup method to be called, self-invoking a destructor. In destructor |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 DVLOG(1) << "Network up and running!"; | 294 DVLOG(1) << "Network up and running!"; |
| 294 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); | 295 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); |
| 295 | 296 |
| 296 BeginInstall(); | 297 BeginInstall(); |
| 297 } else { | 298 } else { |
| 298 DVLOG(1) << "Network not running yet!"; | 299 DVLOG(1) << "Network not running yet!"; |
| 299 } | 300 } |
| 300 } | 301 } |
| 301 | 302 |
| 302 } // namespace chromeos | 303 } // namespace chromeos |
| OLD | NEW |