summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqsr@google.com <qsr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 23:51:39 +0000
committerqsr@google.com <qsr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 23:51:39 +0000
commit68f6ead5d0437c5b3f8580dec43e0d3c90ec35c9 (patch)
treee4b110d1ba08e94849c193257a8632d43161eada
parent2619d3318502ad7bc1c03f77bf5b699f8350c4c0 (diff)
downloadchromium_src-68f6ead5d0437c5b3f8580dec43e0d3c90ec35c9.zip
chromium_src-68f6ead5d0437c5b3f8580dec43e0d3c90ec35c9.tar.gz
chromium_src-68f6ead5d0437c5b3f8580dec43e0d3c90ec35c9.tar.bz2
Correct crash when calling ShowLoginDialog.
BUG=89800,89783 TEST= Review URL: http://codereview.chromium.org/7458013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93290 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/profile_sync_service.cc24
-rw-r--r--chrome/browser/sync/profile_sync_service.h2
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc4
-rw-r--r--chrome/browser/sync/sync_setup_flow.h3
-rw-r--r--chrome/browser/sync/sync_setup_flow_handler.h1
-rw-r--r--chrome/browser/sync/sync_setup_wizard.cc12
-rw-r--r--chrome/browser/sync/sync_setup_wizard.h3
-rw-r--r--chrome/browser/ui/webui/options/sync_setup_handler.cc6
-rw-r--r--chrome/browser/ui/webui/options/sync_setup_handler.h26
9 files changed, 34 insertions, 47 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index ebeca38..0cd4727 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -820,20 +820,36 @@ void ProfileSyncService::ShowLoginDialog() {
auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null.
}
- wizard_.ShowSyncSetup(SyncSetupWizard::GAIA_LOGIN);
+ ShowSyncSetup(SyncSetupWizard::GAIA_LOGIN);
NotifyObservers();
}
void ProfileSyncService::ShowErrorUI() {
- wizard_.ShowSyncSetup(SyncSetupWizard::NONFATAL_ERROR);
+ if (WizardIsVisible()) {
+ wizard_.Focus();
+ return;
+ }
+
+ ShowSyncSetup(SyncSetupWizard::NONFATAL_ERROR);
}
void ProfileSyncService::ShowConfigure(bool sync_everything) {
+ if (WizardIsVisible()) {
+ wizard_.Focus();
+ return;
+ }
+
if (sync_everything)
- wizard_.ShowSyncSetup(SyncSetupWizard::SYNC_EVERYTHING);
+ ShowSyncSetup(SyncSetupWizard::SYNC_EVERYTHING);
else
- wizard_.ShowSyncSetup(SyncSetupWizard::CONFIGURE);
+ ShowSyncSetup(SyncSetupWizard::CONFIGURE);
+}
+
+void ProfileSyncService::ShowSyncSetup(SyncSetupWizard::State state) {
+ wizard_.Step(state);
+ BrowserList::GetLastActiveWithProfile(profile())->ShowOptionsTab(
+ chrome::kSyncSetupSubPage);
}
SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() {
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index ec09eb9..51c12fe 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -260,6 +260,8 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// types to sync.
void ShowConfigure(bool sync_everything);
+ void ShowSyncSetup(SyncSetupWizard::State state);
+
// Pretty-printed strings for a given StatusSummary.
static std::string BuildSyncStatusSummaryText(
const browser_sync::SyncBackendHost::StatusSummary& summary);
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index 89e3d5f..b623976 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -206,10 +206,6 @@ void SyncSetupFlow::Focus() {
flow_handler_->Focus();
}
-void SyncSetupFlow::ShowSyncSetup() {
- flow_handler_->ShowSyncSetup();
-}
-
// A callback to notify the delegate that the dialog closed.
void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) {
DCHECK(json_retval.empty());
diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h
index eb5794a..f6efe74 100644
--- a/chrome/browser/sync/sync_setup_flow.h
+++ b/chrome/browser/sync/sync_setup_flow.h
@@ -72,9 +72,6 @@ class SyncSetupFlow {
// obscured by a browser window.
void Focus();
- // Show the sync setup ui.
- void ShowSyncSetup();
-
void OnUserSubmittedAuth(const std::string& username,
const std::string& password,
const std::string& captcha,
diff --git a/chrome/browser/sync/sync_setup_flow_handler.h b/chrome/browser/sync/sync_setup_flow_handler.h
index 2105bd1..a7c2ae3 100644
--- a/chrome/browser/sync/sync_setup_flow_handler.h
+++ b/chrome/browser/sync/sync_setup_flow_handler.h
@@ -26,7 +26,6 @@ class SyncSetupFlowHandler {
virtual void ShowSetupDone(const std::wstring& user) = 0;
virtual void SetFlow(SyncSetupFlow* flow) = 0;
virtual void Focus() = 0;
- virtual void ShowSyncSetup() = 0;
protected:
virtual ~SyncSetupFlowHandler() {}
diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc
index 18315e1..b8dc3dd 100644
--- a/chrome/browser/sync/sync_setup_wizard.cc
+++ b/chrome/browser/sync/sync_setup_wizard.cc
@@ -83,18 +83,6 @@ void SyncSetupWizard::Focus() {
flow->Focus();
}
-void SyncSetupWizard::ShowSyncSetup(State state) {
- SyncSetupFlow* flow = flow_container_->get_flow();
- if (flow) {
- flow->Focus();
- return;
- }
- Step(state);
- flow = flow_container_->get_flow();
- if (flow)
- flow->ShowSyncSetup();
-}
-
SyncSetupFlow* SyncSetupWizard::AttachSyncSetupHandler(
SyncSetupFlowHandler* handler) {
SyncSetupFlow* flow = flow_container_->get_flow();
diff --git a/chrome/browser/sync/sync_setup_wizard.h b/chrome/browser/sync/sync_setup_wizard.h
index d17da74..a9f3579 100644
--- a/chrome/browser/sync/sync_setup_wizard.h
+++ b/chrome/browser/sync/sync_setup_wizard.h
@@ -67,9 +67,6 @@ class SyncSetupWizard {
// not visible.
void Focus();
- // Show the sync setup tab.
- void ShowSyncSetup(State state);
-
// Attaches |handler| to the flow contained in |flow_container_|. Returns NULL
// if the flow does not exist or if an existing handler is already attached to
// the flow.
diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.cc b/chrome/browser/ui/webui/options/sync_setup_handler.cc
index f85e4fb..d4c0352 100644
--- a/chrome/browser/ui/webui/options/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/options/sync_setup_handler.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_setup_flow.h"
-#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "grit/chromium_strings.h"
@@ -333,11 +332,6 @@ void SyncSetupHandler::Focus() {
static_cast<RenderViewHostDelegate*>(web_ui_->tab_contents())->Activate();
}
-void SyncSetupHandler::ShowSyncSetup() {
- BrowserList::GetLastActiveWithProfile(web_ui_->GetProfile())->ShowOptionsTab(
- chrome::kSyncSetupSubPage);
-}
-
void SyncSetupHandler::OnDidClosePage(const ListValue* args) {
if (flow_) {
flow_->OnDialogClosed(std::string());
diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.h b/chrome/browser/ui/webui/options/sync_setup_handler.h
index 25dcb5ff..50f9888 100644
--- a/chrome/browser/ui/webui/options/sync_setup_handler.h
+++ b/chrome/browser/ui/webui/options/sync_setup_handler.h
@@ -17,22 +17,20 @@ class SyncSetupHandler : public OptionsPageUIHandler,
virtual ~SyncSetupHandler();
// OptionsPageUIHandler implementation.
- virtual void GetLocalizedValues(base::DictionaryValue* localized_strings)
- OVERRIDE;
- virtual void Initialize() OVERRIDE;
- virtual void RegisterMessages() OVERRIDE;
+ virtual void GetLocalizedValues(base::DictionaryValue* localized_strings);
+ virtual void Initialize();
+ virtual void RegisterMessages();
// SyncSetupFlowHandler implementation.
- virtual void ShowGaiaLogin(const base::DictionaryValue& args) OVERRIDE;
- virtual void ShowGaiaSuccessAndClose() OVERRIDE;
- virtual void ShowGaiaSuccessAndSettingUp() OVERRIDE;
- virtual void ShowConfigure(const base::DictionaryValue& args) OVERRIDE;
- virtual void ShowPassphraseEntry(const base::DictionaryValue& args) OVERRIDE;
- virtual void ShowSettingUp() OVERRIDE;
- virtual void ShowSetupDone(const std::wstring& user) OVERRIDE;
- virtual void SetFlow(SyncSetupFlow* flow) OVERRIDE;
- virtual void Focus() OVERRIDE;
- virtual void ShowSyncSetup() OVERRIDE;
+ virtual void ShowGaiaLogin(const base::DictionaryValue& args);
+ virtual void ShowGaiaSuccessAndClose();
+ virtual void ShowGaiaSuccessAndSettingUp();
+ virtual void ShowConfigure(const base::DictionaryValue& args);
+ virtual void ShowPassphraseEntry(const base::DictionaryValue& args);
+ virtual void ShowSettingUp();
+ virtual void ShowSetupDone(const std::wstring& user);
+ virtual void SetFlow(SyncSetupFlow* flow);
+ virtual void Focus();
protected:
FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin);