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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_login_handler.cc

Issue 9838064: Add a sign-in promo message to the Other Devices menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, and only enable menu when tab sync is enabled. Created 8 years, 9 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
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/ntp/ntp_login_handler.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link); 226 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link);
227 // Record that the user was shown the promo. 227 // Record that the user was shown the promo.
228 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED); 228 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED);
229 } 229 }
230 #endif 230 #endif
231 } 231 }
232 232
233 StringValue header_value(header); 233 StringValue header_value(header);
234 StringValue sub_header_value(sub_header); 234 StringValue sub_header_value(sub_header);
235 StringValue icon_url_value(icon_url); 235 StringValue icon_url_value(icon_url);
236 web_ui()->CallJavascriptFunction( 236 base::FundamentalValue is_user_signed_in(!username.empty());
237 "ntp.updateLogin", header_value, sub_header_value, icon_url_value); 237 web_ui()->CallJavascriptFunction("ntp.updateLogin",
238 header_value, sub_header_value, icon_url_value, is_user_signed_in);
238 } 239 }
239 240
240 // static 241 // static
241 bool NTPLoginHandler::ShouldShow(Profile* profile) { 242 bool NTPLoginHandler::ShouldShow(Profile* profile) {
242 #if defined(OS_CHROMEOS) 243 #if defined(OS_CHROMEOS)
243 // For now we don't care about showing sync status on Chrome OS. The promo 244 // For now we don't care about showing sync status on Chrome OS. The promo
244 // UI and the avatar menu don't exist on that platform. 245 // UI and the avatar menu don't exist on that platform.
245 return false; 246 return false;
246 #else 247 #else
247 if (profile->IsOffTheRecord()) 248 if (profile->IsOffTheRecord())
(...skipping 16 matching lines...) Expand all
264 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE, 265 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE,
265 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); 266 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
266 values->SetString("login_status_url", chrome::kSyncLearnMoreURL); 267 values->SetString("login_status_url", chrome::kSyncLearnMoreURL);
267 values->SetString("login_status_learn_more", 268 values->SetString("login_status_learn_more",
268 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); 269 l10n_util::GetStringUTF16(IDS_LEARN_MORE));
269 values->SetString("login_status_advanced", 270 values->SetString("login_status_advanced",
270 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); 271 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED));
271 values->SetString("login_status_dismiss", 272 values->SetString("login_status_dismiss",
272 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); 273 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK));
273 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698