Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/browser/chromeos/login/signin/merge_session_throttling_utils.cc

Issue 2537263002: Prevent the pre-session-restore log spam (Closed)
Patch Set: Remove uneeded use of path service Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" 15 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
16 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" 16 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
xiyuan 2016/12/07 17:34:38 nit: remove since no longer used?
afakhry 2016/12/07 17:49:05 Done.
17 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
18 #include "components/google/core/browser/google_util.h" 19 #include "components/google/core/browser/google_util.h"
19 #include "components/user_manager/user_manager.h" 20 #include "components/user_manager/user_manager.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "net/base/network_change_notifier.h" 23 #include "net/base/network_change_notifier.h"
23 #include "url/gurl.h" 24 #include "url/gurl.h"
24 25
25 using content::BrowserThread; 26 using content::BrowserThread;
26 using content::WebContents; 27 using content::WebContents;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 178
178 bool ShouldDelayUrl(const GURL& url) { 179 bool ShouldDelayUrl(const GURL& url) {
179 // If we are loading google properties while merge session is in progress, 180 // If we are loading google properties while merge session is in progress,
180 // we will show delayed loading page instead. 181 // we will show delayed loading page instead.
181 return !net::NetworkChangeNotifier::IsOffline() && 182 return !net::NetworkChangeNotifier::IsOffline() &&
182 !AreAllSessionMergedAlready() && 183 !AreAllSessionMergedAlready() &&
183 google_util::IsGoogleHostname(url.host_piece(), 184 google_util::IsGoogleHostname(url.host_piece(),
184 google_util::ALLOW_SUBDOMAIN); 185 google_util::ALLOW_SUBDOMAIN);
185 } 186 }
186 187
188 bool IsSessionRestorePending(Profile* profile) {
189 if (!profile)
190 return false;
191
192 chromeos::OAuth2LoginManager* login_manager =
193 chromeos::OAuth2LoginManagerFactory::GetInstance()->GetForProfile(
194 profile);
195 bool pending_session_restore = false;
196 if (login_manager) {
197 switch (login_manager->state()) {
198 case chromeos::OAuth2LoginManager::SESSION_RESTORE_PREPARING:
199 case chromeos::OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS:
200 pending_session_restore = true;
201 break;
202
203 default:
204 break;
205 }
206 }
207
208 return pending_session_restore;
209 }
210
187 } // namespace merge_session_throttling_utils 211 } // namespace merge_session_throttling_utils
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h ('k') | chrome/browser/search/search.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698