Chromium Code Reviews| Index: chrome/browser/ui/webui/sync_promo_handler.cc |
| diff --git a/chrome/browser/ui/webui/sync_promo_handler.cc b/chrome/browser/ui/webui/sync_promo_handler.cc |
| index dfd6bee41f6127419c306746a03e733b202bf684..65209365f0442a1c0192e9404f51b36eff60a6bb 100644 |
| --- a/chrome/browser/ui/webui/sync_promo_handler.cc |
| +++ b/chrome/browser/ui/webui/sync_promo_handler.cc |
| @@ -13,6 +13,7 @@ |
| #include "chrome/browser/sync/sync_setup_flow.h" |
| #include "chrome/browser/tabs/tab_strip_model.h" |
| #include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/browser_list.h" |
| #include "chrome/common/chrome_notification_types.h" |
| #include "chrome/common/extensions/extension_constants.h" |
| #include "chrome/common/pref_names.h" |
| @@ -22,7 +23,8 @@ |
| #include "content/common/notification_service.h" |
| SyncPromoHandler::SyncPromoHandler(ProfileManager* profile_manager) |
| - : SyncSetupHandler(profile_manager), window_already_closed_(false) { |
| + : SyncSetupHandler(profile_manager), |
| + window_already_closed_(false) { |
| } |
| SyncPromoHandler::~SyncPromoHandler() { |
| @@ -122,9 +124,19 @@ void SyncPromoHandler::ShowSetupUI() { |
| void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) { |
| CloseSyncSetup(); |
| - web_ui_->tab_contents()->OpenURL(GURL(chrome::kChromeUINewTabURL), |
| - GURL(), CURRENT_TAB, |
| - PageTransition::LINK); |
| + |
| + // If there's no previous page on this tab then it means that the promo was |
|
James Hawkins
2011/10/12 17:34:18
Is this the best signal we have that the promo was
sail
2011/10/12 17:54:12
An alternative would be to add some kind of parame
|
| + // displayed at startup. In this case we want to close the browser tab that |
| + // the promo is in. |
| + if (!web_ui_->tab_contents()->controller().CanGoBack()) { |
| + Browser* browser = |
| + BrowserList::FindBrowserWithTabContents(web_ui_->tab_contents()); |
| + browser->CloseTabContents(web_ui_->tab_contents()); |
| + } else { |
| + web_ui_->tab_contents()->OpenURL(GURL(chrome::kChromeUINewTabURL), |
| + GURL(), CURRENT_TAB, |
| + PageTransition::LINK); |
| + } |
| } |
| void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { |