OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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::IsEnableInlineSignin()) | |
371 MergeSessionComplete(GoogleServiceAuthError(GoogleServiceAuthError::NONE)); | |
guohui
2013/12/19 19:28:02
So if only new profile management is turned on we
Roger Tawa OOO till Jul 10th
2013/12/19 20:46:33
We do want to ship inline sign in without profile
| |
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 Loading... | |
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 } |
OLD | NEW |