Chromium Code Reviews| Index: chrome/browser/chromeos/login/oauth2_token_fetcher.cc |
| diff --git a/chrome/browser/chromeos/login/oauth2_token_fetcher.cc b/chrome/browser/chromeos/login/oauth2_token_fetcher.cc |
| index f66c1ca4e40265970704bb0015ebfdf55dacdba7..2c58b919e97bdc3e3b7c358be7175a072b1813b5 100644 |
| --- a/chrome/browser/chromeos/login/oauth2_token_fetcher.cc |
| +++ b/chrome/browser/chromeos/login/oauth2_token_fetcher.cc |
| @@ -6,10 +6,13 @@ |
| #include "base/logging.h" |
| #include "base/strings/string_util.h" |
| -#include "chrome/browser/chromeos/net/connectivity_state_helper.h" |
| +#include "chromeos/network/network_handler.h" |
| +#include "chromeos/network/network_state.h" |
| +#include "chromeos/network/network_state_handler.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "google_apis/gaia/gaia_constants.h" |
| #include "google_apis/gaia/google_service_auth_error.h" |
| +#include "third_party/cros_system_api/dbus/service_constants.h" |
| using content::BrowserThread; |
| @@ -41,8 +44,10 @@ void OAuth2TokenFetcher::StartExchangeFromCookies() { |
| // Delay the verification if the network is not connected or on a captive |
| // portal. |
| - ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); |
| - if (!csh->DefaultNetworkOnline()) { |
| + const NetworkState* default_network = |
| + NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
| + if (!default_network || |
| + default_network->connection_state() == flimflam::kStatePortal) { |
|
Nikita (slow)
2013/08/08 10:47:28
Same comment about (!network->IsConnectedState()).
gauravsh
2013/08/08 16:59:20
See my previous comment. It was a redundant check
Nikita (slow)
2013/08/08 17:50:43
Why check in lines 71..73 is different then?
gauravsh
2013/08/08 18:02:41
Oops, yeah, it should be the same there as well. I
|
| // If network is offline, defer the token fetching until online. |
| VLOG(1) << "Network is offline. Deferring OAuth2 token fetch."; |
| BrowserThread::PostDelayedTask( |
| @@ -61,8 +66,11 @@ void OAuth2TokenFetcher::StartExchangeFromAuthCode( |
| auth_code_ = auth_code; |
| // Delay the verification if the network is not connected or on a captive |
| // portal. |
| - ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); |
| - if (!csh->DefaultNetworkOnline()) { |
| + const NetworkState* default_network = |
| + NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
| + if (!default_network || |
| + !default_network->IsConnectedState() || |
| + default_network->connection_state() == flimflam::kStatePortal) { |
| // If network is offline, defer the token fetching until online. |
| VLOG(1) << "Network is offline. Deferring OAuth2 token fetch."; |
| BrowserThread::PostDelayedTask( |