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

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: Fix typo in chromeos Created 6 years, 11 months 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
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_starter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/browser_list.h" 29 #include "chrome/browser/ui/browser_list.h"
30 #include "chrome/browser/ui/browser_navigator.h" 30 #include "chrome/browser/ui/browser_navigator.h"
31 #include "chrome/browser/ui/browser_tabstrip.h" 31 #include "chrome/browser/ui/browser_tabstrip.h"
32 #include "chrome/browser/ui/browser_window.h" 32 #include "chrome/browser/ui/browser_window.h"
33 #include "chrome/browser/ui/chrome_pages.h" 33 #include "chrome/browser/ui/chrome_pages.h"
34 #include "chrome/browser/ui/tabs/tab_strip_model.h" 34 #include "chrome/browser/ui/tabs/tab_strip_model.h"
35 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 35 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
36 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 36 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
37 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" 37 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h"
38 #include "chrome/common/profile_management_switches.h"
38 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
39 #include "grit/chromium_strings.h" 40 #include "grit/chromium_strings.h"
40 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
41 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
42 #include "ui/base/resource/resource_bundle.h" 43 #include "ui/base/resource/resource_bundle.h"
43 44
44 OneClickSigninSyncStarter::OneClickSigninSyncStarter( 45 OneClickSigninSyncStarter::OneClickSigninSyncStarter(
45 Profile* profile, 46 Profile* profile,
46 Browser* browser, 47 Browser* browser,
47 const std::string& session_index, 48 const std::string& session_index,
(...skipping 311 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 (switches::IsEnableWebBasedSignin())
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 false); 512 false);
503 contents->OpenURL(params); 513 contents->OpenURL(params);
504 514
505 // Activate the tab. 515 // Activate the tab.
506 Browser* browser = chrome::FindBrowserWithWebContents(contents); 516 Browser* browser = chrome::FindBrowserWithWebContents(contents);
507 int content_index = 517 int content_index =
508 browser->tab_strip_model()->GetIndexOfWebContents(contents); 518 browser->tab_strip_model()->GetIndexOfWebContents(contents);
509 browser->tab_strip_model()->ActivateTabAt(content_index, 519 browser->tab_strip_model()->ActivateTabAt(content_index,
510 false /* user_gesture */); 520 false /* user_gesture */);
511 } 521 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_starter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698