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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.cc

Issue 110373007: Delay loading the NTP after sign in until MergeSession has been performed in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/sync/one_click_signin_sync_starter.h" 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 10
11 #if defined(ENABLE_CONFIGURATION_POLICY) 11 #if defined(ENABLE_CONFIGURATION_POLICY)
12 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" 12 #include "chrome/browser/policy/cloud/user_policy_signin_service.h"
13 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" 13 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
14 #endif 14 #endif
15 15
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_info_cache.h" 17 #include "chrome/browser/profiles/profile_info_cache.h"
18 #include "chrome/browser/profiles/profile_io_data.h" 18 #include "chrome/browser/profiles/profile_io_data.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/profiles/profile_window.h" 20 #include "chrome/browser/profiles/profile_window.h"
21 #include "chrome/browser/profiles/profiles_state.h"
21 #include "chrome/browser/signin/signin_manager.h" 22 #include "chrome/browser/signin/signin_manager.h"
22 #include "chrome/browser/signin/signin_manager_factory.h" 23 #include "chrome/browser/signin/signin_manager_factory.h"
23 #include "chrome/browser/sync/profile_sync_service.h" 24 #include "chrome/browser/sync/profile_sync_service.h"
24 #include "chrome/browser/sync/profile_sync_service_factory.h" 25 #include "chrome/browser/sync/profile_sync_service_factory.h"
25 #include "chrome/browser/sync/sync_prefs.h" 26 #include "chrome/browser/sync/sync_prefs.h"
26 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_dialogs.h" 28 #include "chrome/browser/ui/browser_dialogs.h"
28 #include "chrome/browser/ui/browser_finder.h" 29 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/browser_list.h" 30 #include "chrome/browser/ui/browser_list.h"
30 #include "chrome/browser/ui/browser_navigator.h" 31 #include "chrome/browser/ui/browser_navigator.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 default: 360 default:
360 DisplayFinalConfirmationBubble(l10n_util::GetStringUTF16( 361 DisplayFinalConfirmationBubble(l10n_util::GetStringUTF16(
361 IDS_SYNC_ERROR_SIGNING_IN)); 362 IDS_SYNC_ERROR_SIGNING_IN));
362 break; 363 break;
363 } 364 }
364 } 365 }
365 delete this; 366 delete this;
366 } 367 }
367 368
368 void OneClickSigninSyncStarter::SigninSuccess() { 369 void OneClickSigninSyncStarter::SigninSuccess() {
370 if (!profiles::IsNewProfileManagementEnabled())
371 MergeSessionComplete(GoogleServiceAuthError(GoogleServiceAuthError::NONE));
372 }
373
374 void OneClickSigninSyncStarter::MergeSessionComplete(
375 const GoogleServiceAuthError& error) {
376 // Regardless of whether the merge session completed sucessfully or not,
377 // continue with sync starting.
378
369 if (!sync_setup_completed_callback_.is_null()) 379 if (!sync_setup_completed_callback_.is_null())
370 sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS); 380 sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS);
371 381
372 switch (start_mode_) { 382 switch (start_mode_) {
373 case SYNC_WITH_DEFAULT_SETTINGS: { 383 case SYNC_WITH_DEFAULT_SETTINGS: {
374 // Just kick off the sync machine, no need to configure it first. 384 // Just kick off the sync machine, no need to configure it first.
375 ProfileSyncService* profile_sync_service = GetProfileSyncService(); 385 ProfileSyncService* profile_sync_service = GetProfileSyncService();
376 if (profile_sync_service) 386 if (profile_sync_service)
377 profile_sync_service->SetSyncSetupCompleted(); 387 profile_sync_service->SetSyncSetupCompleted();
378 FinishProfileSyncServiceSetup(); 388 FinishProfileSyncServiceSetup();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 false); 507 false);
498 contents->OpenURL(params); 508 contents->OpenURL(params);
499 509
500 // Activate the tab. 510 // Activate the tab.
501 Browser* browser = chrome::FindBrowserWithWebContents(contents); 511 Browser* browser = chrome::FindBrowserWithWebContents(contents);
502 int content_index = 512 int content_index =
503 browser->tab_strip_model()->GetIndexOfWebContents(contents); 513 browser->tab_strip_model()->GetIndexOfWebContents(contents);
504 browser->tab_strip_model()->ActivateTabAt(content_index, 514 browser->tab_strip_model()->ActivateTabAt(content_index,
505 false /* user_gesture */); 515 false /* user_gesture */);
506 } 516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698