Commit e0dc2cb4 authored by shess@chromium.org's avatar shess@chromium.org

Pass Setup Chrome Sync to main profile from Incognito.

Incognito mode doesn't have a sync service.

Additionally, if there is no browser window associated with the main
profile, create one.

BUG=90570, 90466
TEST="Set Up Chrome Sync" from Incognito wrench menu doesn't crash (and opens tab in main profile).
TEST=Test also works if all main-profile windows are closed.
TEST=On Mac, close all windows and select "Set Up Sync" from Chrome menu.


Review URL: http://codereview.chromium.org/7477021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95381 0039d316-1c4b-4281-b951-d872f2087c98
parent 82d105ec
......@@ -38,6 +38,7 @@
#include "chrome/browser/sync/signin_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
......@@ -808,8 +809,14 @@ void ProfileSyncService::ShowConfigure(bool sync_everything) {
void ProfileSyncService::ShowSyncSetup(SyncSetupWizard::State state) {
wizard_.Step(state);
BrowserList::GetLastActiveWithProfile(profile())->ShowOptionsTab(
chrome::kSyncSetupSubPage);
Browser* browser = BrowserList::GetLastActiveWithProfile(profile());
if (!browser) {
browser = Browser::Create(profile());
browser->ShowOptionsTab(chrome::kSyncSetupSubPage);
browser->window()->Show();
} else {
browser->ShowOptionsTab(chrome::kSyncSetupSubPage);
}
}
SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() {
......
......@@ -4814,9 +4814,10 @@ void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) {
}
void Browser::ShowSyncSetup() {
ProfileSyncService* service = profile()->GetProfileSyncService();
ProfileSyncService* service =
profile()->GetOriginalProfile()->GetProfileSyncService();
if (service->HasSyncSetupCompleted())
ShowOptionsTab(chrome::kSyncSetupSubPage);
else
profile()->GetProfileSyncService()->ShowLoginDialog();
service->ShowLoginDialog();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment