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

Unified Diff: chrome/browser/ui/webui/ntp/ntp_login_handler.cc

Issue 776423002: The Apps ntp page should not display an avatar menu when clicking on the username. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/ntp_login_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index 4e3f87b56d39bde72b9e0cedaf3308bf95a08cee..c28c0fe64496be109c21802c6a9dd70870f6b2d9 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -121,45 +121,26 @@ void NTPLoginHandler::HandleInitializeSyncLogin(const base::ListValue* args) {
void NTPLoginHandler::HandleShowSyncLoginUI(const base::ListValue* args) {
Profile* profile = Profile::FromWebUI(web_ui());
+ if (!signin::ShouldShowPromo(profile))
+ return;
+
std::string username =
SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername();
+ if (!username.empty())
+ return;
+
content::WebContents* web_contents = web_ui()->GetWebContents();
Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
if (!browser)
return;
- if (username.empty()) {
- // The user isn't signed in, show the sign in promo.
- if (signin::ShouldShowPromo(profile)) {
- signin::Source source =
- (web_contents->GetURL().spec() == chrome::kChromeUIAppsURL) ?
- signin::SOURCE_APPS_PAGE_LINK :
- signin::SOURCE_NTP_LINK;
- chrome::ShowBrowserSignin(browser, source);
- RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED);
- }
- } else if (args->GetSize() == 4) {
- // The user is signed in, show the profiles menu.
- double x = 0;
- double y = 0;
- double width = 0;
- double height = 0;
- bool success = args->GetDouble(0, &x);
- DCHECK(success);
- success = args->GetDouble(1, &y);
- DCHECK(success);
- success = args->GetDouble(2, &width);
- DCHECK(success);
- success = args->GetDouble(3, &height);
- DCHECK(success);
-
- double zoom = content::ZoomLevelToZoomFactor(
- ui_zoom::ZoomController::FromWebContents(web_contents)->GetZoomLevel());
- gfx::Rect rect(x * zoom, y * zoom, width * zoom, height * zoom);
-
- browser->window()->ShowAvatarBubble(web_ui()->GetWebContents(), rect);
- ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::NTP_AVATAR_BUBBLE);
- }
+ // The user isn't signed in, show the sign in promo.
+ signin::Source source =
+ web_contents->GetURL().spec() == chrome::kChromeUIAppsURL ?
+ signin::SOURCE_APPS_PAGE_LINK :
+ signin::SOURCE_NTP_LINK;
+ chrome::ShowBrowserSignin(browser, source);
+ RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED);
}
void NTPLoginHandler::RecordInHistogram(int type) {
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698