Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | |
| 14 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/managed_mode.h" | |
| 15 #include "chrome/browser/prefs/pref_notifier.h" | 17 #include "chrome/browser/prefs/pref_notifier.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_info_cache.h" | 20 #include "chrome/browser/profiles/profile_info_cache.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/profiles/profile_metrics.h" | 22 #include "chrome/browser/profiles/profile_metrics.h" |
| 21 #include "chrome/browser/sync/profile_sync_service.h" | 23 #include "chrome/browser/sync/profile_sync_service.h" |
| 22 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 23 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 return; | 132 return; |
| 131 | 133 |
| 132 if (username.empty()) { | 134 if (username.empty()) { |
| 133 #if !defined(OS_ANDROID) | 135 #if !defined(OS_ANDROID) |
| 134 // The user isn't signed in, show the sync promo. | 136 // The user isn't signed in, show the sync promo. |
| 135 if (SyncPromoUI::ShouldShowSyncPromo(profile)) { | 137 if (SyncPromoUI::ShouldShowSyncPromo(profile)) { |
| 136 browser->ShowSyncSetup(SyncPromoUI::SOURCE_NTP_LINK); | 138 browser->ShowSyncSetup(SyncPromoUI::SOURCE_NTP_LINK); |
| 137 RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED); | 139 RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED); |
| 138 } | 140 } |
| 139 #endif | 141 #endif |
| 140 } else if (args->GetSize() == 4) { | 142 } else if (args->GetSize() == 4 && |
| 143 browser->command_updater()->IsCommandEnabled( | |
| 144 IDC_SHOW_AVATAR_MENU)) { | |
|
Dan Beam
2013/08/12 19:40:28
bauerb@: ^ why was this check added? this means t
| |
| 141 // The user is signed in, show the profiles menu. | 145 // The user is signed in, show the profiles menu. |
| 142 double x = 0; | 146 double x = 0; |
| 143 double y = 0; | 147 double y = 0; |
| 144 double width = 0; | 148 double width = 0; |
| 145 double height = 0; | 149 double height = 0; |
| 146 bool success = args->GetDouble(0, &x); | 150 bool success = args->GetDouble(0, &x); |
| 147 DCHECK(success); | 151 DCHECK(success); |
| 148 success = args->GetDouble(1, &y); | 152 success = args->GetDouble(1, &y); |
| 149 DCHECK(success); | 153 DCHECK(success); |
| 150 success = args->GetDouble(2, &width); | 154 success = args->GetDouble(2, &width); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | 270 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); |
| 267 values->SetString("login_status_url", | 271 values->SetString("login_status_url", |
| 268 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 272 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
| 269 values->SetString("login_status_advanced", | 273 values->SetString("login_status_advanced", |
| 270 hide_sync ? string16() : | 274 hide_sync ? string16() : |
| 271 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 275 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
| 272 values->SetString("login_status_dismiss", | 276 values->SetString("login_status_dismiss", |
| 273 hide_sync ? string16() : | 277 hide_sync ? string16() : |
| 274 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 278 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
| 275 } | 279 } |
| OLD | NEW |