summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-23 19:10:40 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-23 19:10:40 +0000
commitac0b4435e814ab938523287c1fd33a13b905f843 (patch)
tree3ffd9f1258d5581e0d211ee3c66796b753dff000
parentb1aefb90cc07d3ff7d2d23db30301c9ba89510ae (diff)
downloadchromium_src-ac0b4435e814ab938523287c1fd33a13b905f843.zip
chromium_src-ac0b4435e814ab938523287c1fd33a13b905f843.tar.gz
chromium_src-ac0b4435e814ab938523287c1fd33a13b905f843.tar.bz2
Fix flashing window when deleting profile
Deleting a profile with the sync promo open would cause the delete profile's browser window to temporarily re-open. The problem was that the sync promo was attempting to navigate to a page when the promo was closed. Fix was to disable the navigation if the browser window was being closed. BUG=108801 TEST= Review URL: http://codereview.chromium.org/9193004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118710 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc19
-rw-r--r--chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc17
2 files changed, 25 insertions, 11 deletions
diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
index 1fceceb..d75dd2e 100644
--- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
+++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -200,11 +200,18 @@ void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) {
if (!username.empty())
prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true);
- GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
- web_ui()->GetWebContents()->GetURL());
- OpenURLParams params(
- url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
- web_ui()->GetWebContents()->OpenURL(params);
+ // If the browser window is being closed then don't try to navigate to
+ // another URL. This prevents the browser window from flashing during
+ // close.
+ Browser* browser =
+ BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ if (browser && !browser->IsAttemptingToCloseBrowser()) {
+ GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
+ web_ui()->GetWebContents()->GetURL());
+ OpenURLParams params(
+ url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
+ web_ui()->GetWebContents()->OpenURL(params);
+ }
}
void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) {
diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc
index cabbfc8..3f442cc 100644
--- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc
+++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -204,10 +204,17 @@ void SyncPromoHandler2::HandleCloseSyncPromo(const base::ListValue* args) {
if (!username.empty())
prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true);
- GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
- web_ui_->tab_contents()->GetURL());
- web_ui_->tab_contents()->OpenURL(url, GURL(), CURRENT_TAB,
- content::PAGE_TRANSITION_LINK);
+ // If the browser window is being closed then don't try to navigate to
+ // another URL. This prevents the browser window from flashing during
+ // close.
+ Browser* browser =
+ BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ if (browser && !browser->IsAttemptingToCloseBrowser()) {
+ GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
+ web_ui_->tab_contents()->GetURL());
+ web_ui_->tab_contents()->OpenURL(url, GURL(), CURRENT_TAB,
+ content::PAGE_TRANSITION_LINK);
+ }
}
void SyncPromoHandler2::HandleInitializeSyncPromo(const base::ListValue* args) {