| 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/app_launcher_login_handler.h" | 5 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/metrics/user_metrics.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_attributes_entry.h" | 20 #include "chrome/browser/profiles/profile_attributes_entry.h" |
| 20 #include "chrome/browser/profiles/profile_attributes_storage.h" | 21 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/profiles/profile_metrics.h" | 23 #include "chrome/browser/profiles/profile_metrics.h" |
| 23 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
| 24 #include "chrome/browser/signin/signin_promo_util.h" | 25 #include "chrome/browser/signin/signin_promo_util.h" |
| 25 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 26 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/browser/ui/chrome_pages.h" | 30 #include "chrome/browser/ui/chrome_pages.h" |
| 30 #include "chrome/browser/ui/webui/profile_info_watcher.h" | 31 #include "chrome/browser/ui/webui/profile_info_watcher.h" |
| 31 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 32 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 33 #include "chrome/grit/chromium_strings.h" | 34 #include "chrome/grit/chromium_strings.h" |
| 34 #include "chrome/grit/generated_resources.h" | 35 #include "chrome/grit/generated_resources.h" |
| 35 #include "components/browser_sync/profile_sync_service.h" | 36 #include "components/browser_sync/profile_sync_service.h" |
| 36 #include "components/prefs/pref_service.h" | 37 #include "components/prefs/pref_service.h" |
| 37 #include "components/signin/core/browser/signin_manager.h" | 38 #include "components/signin/core/browser/signin_manager.h" |
| 38 #include "content/public/browser/host_zoom_map.h" | 39 #include "content/public/browser/host_zoom_map.h" |
| 39 #include "content/public/browser/user_metrics.h" | |
| 40 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
| 41 #include "content/public/browser/web_ui.h" | 41 #include "content/public/browser/web_ui.h" |
| 42 #include "content/public/common/page_zoom.h" | 42 #include "content/public/common/page_zoom.h" |
| 43 #include "net/base/escape.h" | 43 #include "net/base/escape.h" |
| 44 #include "skia/ext/image_operations.h" | 44 #include "skia/ext/image_operations.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 46 #include "ui/base/webui/web_ui_util.h" | 46 #include "ui/base/webui/web_ui_util.h" |
| 47 #include "ui/gfx/canvas.h" | 47 #include "ui/gfx/canvas.h" |
| 48 #include "ui/gfx/image/image.h" | 48 #include "ui/gfx/image/image.h" |
| 49 #include "ui/gfx/skia_util.h" | 49 #include "ui/gfx/skia_util.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 base::string16 signed_in_link = l10n_util::GetStringUTF16( | 203 base::string16 signed_in_link = l10n_util::GetStringUTF16( |
| 204 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_LINK); | 204 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_LINK); |
| 205 signed_in_link = | 205 signed_in_link = |
| 206 CreateElementWithClass(signed_in_link, "a", "", "action-link"); | 206 CreateElementWithClass(signed_in_link, "a", "", "action-link"); |
| 207 header = l10n_util::GetStringFUTF16( | 207 header = l10n_util::GetStringFUTF16( |
| 208 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER, | 208 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER, |
| 209 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); | 209 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
| 210 sub_header = l10n_util::GetStringFUTF16( | 210 sub_header = l10n_util::GetStringFUTF16( |
| 211 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link); | 211 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link); |
| 212 | 212 |
| 213 content::RecordAction( | 213 base::RecordAction( |
| 214 web_ui()->GetWebContents()->GetURL().spec() == | 214 web_ui()->GetWebContents()->GetURL().spec() == |
| 215 chrome::kChromeUIAppsURL | 215 chrome::kChromeUIAppsURL |
| 216 ? base::UserMetricsAction("Signin_Impression_FromAppsPageLink") | 216 ? base::UserMetricsAction("Signin_Impression_FromAppsPageLink") |
| 217 : base::UserMetricsAction("Signin_Impression_FromNTP")); | 217 : base::UserMetricsAction("Signin_Impression_FromNTP")); |
| 218 // Record that the user was shown the promo. | 218 // Record that the user was shown the promo. |
| 219 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED); | 219 RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED); |
| 220 } | 220 } |
| 221 #endif | 221 #endif |
| 222 } | 222 } |
| 223 | 223 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 values->SetString("login_status_message", message); | 255 values->SetString("login_status_message", message); |
| 256 values->SetString("login_status_url", | 256 values->SetString("login_status_url", |
| 257 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 257 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
| 258 values->SetString("login_status_advanced", | 258 values->SetString("login_status_advanced", |
| 259 hide_sync ? base::string16() : | 259 hide_sync ? base::string16() : |
| 260 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 260 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
| 261 values->SetString("login_status_dismiss", | 261 values->SetString("login_status_dismiss", |
| 262 hide_sync ? base::string16() : | 262 hide_sync ? base::string16() : |
| 263 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 263 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
| 264 } | 264 } |
| OLD | NEW |