From 4d4e4af1cc0f3cfc483e2d90c00f99dccf27071d Mon Sep 17 00:00:00 2001 From: "akalin@chromium.org" Date: Wed, 7 Apr 2010 22:16:00 +0000 Subject: Integrated customize sync dialog with sync setup wizard on OS X. Changed ShowHtmlDialog() on OS X to return the created window. BUG=34209 TEST=manual Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=43796 Review URL: http://codereview.chromium.org/1535018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43886 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/sync/sync_setup_flow.cc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'chrome/browser/sync/sync_setup_flow.cc') diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 1ccc8a3..595b3a3 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -55,9 +55,11 @@ static std::string GetJsonResponse(const Value* content) { } void FlowHandler::RegisterMessages() { -#if defined(OS_WIN) || defined(OS_LINUX) dom_ui_->RegisterMessageCallback("ShowCustomize", NewCallback(this, &FlowHandler::HandleUserClickedCustomize)); + // On OS X, the customize dialog is modal to the HTML window so we + // don't need to hook up the two functions below. +#if defined(OS_WIN) || defined(OS_LINUX) dom_ui_->RegisterMessageCallback("ClickCustomizeOk", NewCallback(this, &FlowHandler::ClickCustomizeOk)); dom_ui_->RegisterMessageCallback("ClickCustomizeCancel", @@ -177,7 +179,8 @@ SyncSetupFlow::SyncSetupFlow(SyncSetupWizard::State start_state, login_start_time_(base::TimeTicks::Now()), flow_handler_(new FlowHandler()), owns_flow_handler_(true), - service_(service) { + service_(service), + html_dialog_window_(NULL) { flow_handler_->set_flow(this); } @@ -261,11 +264,7 @@ void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service, args->SetString(L"captchaUrl", error.captcha().image_url.spec()); -#if defined(OS_WIN) || defined(OS_LINUX) args->SetBoolean(L"showCustomize", true); -#else - args->SetBoolean(L"showCustomize", false); -#endif } void SyncSetupFlow::GetDOMMessageHandlers( @@ -338,21 +337,23 @@ SyncSetupFlow* SyncSetupFlow::Run(ProfileSyncService* service, SyncSetupFlow* flow = new SyncSetupFlow(start, end, json_args, container, service); +#if defined(OS_MACOSX) + // TODO(akalin): Figure out a cleaner way to do this than to have this + // gross per-OS behavior, i.e. have a cross-platform ShowHtmlDialog() + // function that is not tied to a browser instance. Note that if we do + // that, we'll have to fix sync_setup_wizard_unittest.cc as it relies on + // being able to intercept ShowHtmlDialog() calls. + flow->html_dialog_window_ = + html_dialog_window_controller::ShowHtmlDialog( + flow, service->profile()); +#else Browser* b = BrowserList::GetLastActive(); if (b) { b->BrowserShowHtmlDialog(flow, NULL); } else { - // TODO(akalin): Figure out a cleaner way to do this than to have this - // gross per-OS behavior, i.e. have a cross-platform ShowHtmlDialog() - // function that is not tied to a browser instance. Note that if we do - // that, we'll have to fix sync_setup_wizard_unittest.cc as it relies on - // being able to intercept ShowHtmlDialog() calls. -#if defined(OS_MACOSX) - html_dialog_window_controller::ShowHtmlDialog(flow, service->profile()); -#else delete flow; return NULL; -#endif } +#endif // defined(OS_MACOSX) return flow; } -- cgit v1.1