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

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

Issue 11434074: browser: Move FindBrowserWithWebContents() into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // If the user has signed in then set the pref to show them NTP bubble 186 // If the user has signed in then set the pref to show them NTP bubble
187 // confirming that they're signed in. 187 // confirming that they're signed in.
188 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); 188 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername);
189 if (!username.empty()) 189 if (!username.empty())
190 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); 190 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true);
191 191
192 // If the browser window is being closed then don't try to navigate to 192 // If the browser window is being closed then don't try to navigate to
193 // another URL. This prevents the browser window from flashing during 193 // another URL. This prevents the browser window from flashing during
194 // close. 194 // close.
195 Browser* browser = 195 Browser* browser =
196 browser::FindBrowserWithWebContents(web_ui()->GetWebContents()); 196 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents());
197 if (!browser || !browser->IsAttemptingToCloseBrowser()) { 197 if (!browser || !browser->IsAttemptingToCloseBrowser()) {
198 // Close the window if it was opened in auto-close mode. 198 // Close the window if it was opened in auto-close mode.
199 const GURL& sync_url = web_ui()->GetWebContents()->GetURL(); 199 const GURL& sync_url = web_ui()->GetWebContents()->GetURL();
200 if (SyncPromoUI::GetAutoCloseForSyncPromoURL(sync_url)) { 200 if (SyncPromoUI::GetAutoCloseForSyncPromoURL(sync_url)) {
201 web_ui()->GetWebContents()->Close(); 201 web_ui()->GetWebContents()->Close();
202 } else { 202 } else {
203 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(sync_url); 203 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(sync_url);
204 OpenURLParams params( 204 OpenURLParams params(
205 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); 205 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
206 web_ui()->GetWebContents()->OpenURL(params); 206 web_ui()->GetWebContents()->OpenURL(params);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Send an enumeration to our single user flow histogram. 280 // Send an enumeration to our single user flow histogram.
281 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, 281 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action,
282 SYNC_PROMO_BUCKET_BOUNDARY); 282 SYNC_PROMO_BUCKET_BOUNDARY);
283 } 283 }
284 284
285 void SyncPromoHandler::CloseUI() { 285 void SyncPromoHandler::CloseUI() {
286 // Callers should not ever try to close the promo UI (should only call 286 // Callers should not ever try to close the promo UI (should only call
287 // CloseUI() if the user is already logged in). 287 // CloseUI() if the user is already logged in).
288 NOTREACHED() << "Cannot close the promo UI"; 288 NOTREACHED() << "Cannot close the promo UI";
289 } 289 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/manage_profile_handler.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698