Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc

Issue 9193004: Fix flashing window when deleting profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated sync_promo_handler2.cc Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h" 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) { 194 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) {
195 CloseSyncSetup(); 195 CloseSyncSetup();
196 196
197 // If the user has signed in then set the pref to show them NTP bubble 197 // If the user has signed in then set the pref to show them NTP bubble
198 // confirming that they're signed in. 198 // confirming that they're signed in.
199 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); 199 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername);
200 if (!username.empty()) 200 if (!username.empty())
201 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); 201 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true);
202 202
203 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( 203 // If the browser window is being closed then don't try to navigate to
204 web_ui()->GetWebContents()->GetURL()); 204 // another URL. This prevents the browser window from flashing during
205 OpenURLParams params( 205 // close.
206 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); 206 Browser* browser =
207 web_ui()->GetWebContents()->OpenURL(params); 207 BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
208 if (browser && !browser->IsAttemptingToCloseBrowser()) {
209 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
210 web_ui()->GetWebContents()->GetURL());
211 OpenURLParams params(
212 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
213 web_ui()->GetWebContents()->OpenURL(params);
214 }
208 } 215 }
209 216
210 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { 217 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) {
211 // If the promo is also the Chrome launch page, we want to show the title and 218 // If the promo is also the Chrome launch page, we want to show the title and
212 // log an event if we are running an experiment. 219 // log an event if we are running an experiment.
213 bool is_launch_page = SyncPromoUI::GetIsLaunchPageForSyncPromoURL( 220 bool is_launch_page = SyncPromoUI::GetIsLaunchPageForSyncPromoURL(
214 web_ui()->GetWebContents()->GetURL()); 221 web_ui()->GetWebContents()->GetURL());
215 if (is_launch_page && sync_promo_trial::IsExperimentActive()) 222 if (is_launch_page && sync_promo_trial::IsExperimentActive())
216 sync_promo_trial::RecordUserSawMessage(); 223 sync_promo_trial::RecordUserSawMessage();
217 base::FundamentalValue visible(is_launch_page); 224 base::FundamentalValue visible(is_launch_page);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 Profile* profile = Profile::FromWebUI(web_ui()); 300 Profile* profile = Profile::FromWebUI(web_ui());
294 sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile); 301 sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile);
295 } 302 }
296 } 303 }
297 304
298 void SyncPromoHandler::RecordUserFlowAction(int action) { 305 void SyncPromoHandler::RecordUserFlowAction(int action) {
299 // Send an enumeration to our single user flow histogram. 306 // Send an enumeration to our single user flow histogram.
300 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, 307 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action,
301 SYNC_PROMO_BUCKET_BOUNDARY); 308 SYNC_PROMO_BUCKET_BOUNDARY);
302 } 309 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698