| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/login/signin/merge_session_throttling_utils.h" | 5 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 bool ShouldDelayUrl(const GURL& url) { | 178 bool ShouldDelayUrl(const GURL& url) { |
| 179 // If we are loading google properties while merge session is in progress, | 179 // If we are loading google properties while merge session is in progress, |
| 180 // we will show delayed loading page instead. | 180 // we will show delayed loading page instead. |
| 181 return !net::NetworkChangeNotifier::IsOffline() && | 181 return !net::NetworkChangeNotifier::IsOffline() && |
| 182 !AreAllSessionMergedAlready() && | 182 !AreAllSessionMergedAlready() && |
| 183 google_util::IsGoogleHostname(url.host_piece(), | 183 google_util::IsGoogleHostname(url.host_piece(), |
| 184 google_util::ALLOW_SUBDOMAIN); | 184 google_util::ALLOW_SUBDOMAIN); |
| 185 } | 185 } |
| 186 | 186 |
| 187 bool IsSessionRestorePending(Profile* profile) { |
| 188 if (!profile) |
| 189 return false; |
| 190 |
| 191 chromeos::OAuth2LoginManager* login_manager = |
| 192 chromeos::OAuth2LoginManagerFactory::GetInstance()->GetForProfile( |
| 193 profile); |
| 194 bool pending_session_restore = false; |
| 195 if (login_manager) { |
| 196 switch (login_manager->state()) { |
| 197 case chromeos::OAuth2LoginManager::SESSION_RESTORE_PREPARING: |
| 198 case chromeos::OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS: |
| 199 pending_session_restore = true; |
| 200 break; |
| 201 |
| 202 default: |
| 203 break; |
| 204 } |
| 205 } |
| 206 |
| 207 return pending_session_restore; |
| 208 } |
| 209 |
| 187 } // namespace merge_session_throttling_utils | 210 } // namespace merge_session_throttling_utils |
| OLD | NEW |