| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/sync/profile_sync_service_factory.h" | 25 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 28 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/browser/ui/chrome_pages.h" | 29 #include "chrome/browser/ui/chrome_pages.h" |
| 30 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 30 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 31 #include "chrome/browser/web_resource/promo_resource_service.h" | 31 #include "chrome/browser/web_resource/promo_resource_service.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 34 #include "components/signin/core/browser/signin_manager.h" | 34 #include "components/signin/core/browser/signin_manager.h" |
| 35 #include "content/public/browser/host_zoom_map.h" |
| 35 #include "content/public/browser/notification_details.h" | 36 #include "content/public/browser/notification_details.h" |
| 36 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 37 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 38 #include "content/public/browser/web_ui.h" | 39 #include "content/public/browser/web_ui.h" |
| 39 #include "content/public/common/page_zoom.h" | 40 #include "content/public/common/page_zoom.h" |
| 40 #include "grit/chromium_strings.h" | 41 #include "grit/chromium_strings.h" |
| 41 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| 42 #include "net/base/escape.h" | 43 #include "net/base/escape.h" |
| 43 #include "skia/ext/image_operations.h" | 44 #include "skia/ext/image_operations.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 double height = 0; | 150 double height = 0; |
| 150 bool success = args->GetDouble(0, &x); | 151 bool success = args->GetDouble(0, &x); |
| 151 DCHECK(success); | 152 DCHECK(success); |
| 152 success = args->GetDouble(1, &y); | 153 success = args->GetDouble(1, &y); |
| 153 DCHECK(success); | 154 DCHECK(success); |
| 154 success = args->GetDouble(2, &width); | 155 success = args->GetDouble(2, &width); |
| 155 DCHECK(success); | 156 DCHECK(success); |
| 156 success = args->GetDouble(3, &height); | 157 success = args->GetDouble(3, &height); |
| 157 DCHECK(success); | 158 DCHECK(success); |
| 158 | 159 |
| 159 double zoom = content::ZoomLevelToZoomFactor(web_contents->GetZoomLevel()); | 160 double zoom = content::ZoomLevelToZoomFactor( |
| 161 content::HostZoomMap::GetZoomLevel(web_contents)); |
| 160 gfx::Rect rect(x * zoom, y * zoom, width * zoom, height * zoom); | 162 gfx::Rect rect(x * zoom, y * zoom, width * zoom, height * zoom); |
| 161 | 163 |
| 162 browser->window()->ShowAvatarBubble(web_ui()->GetWebContents(), rect); | 164 browser->window()->ShowAvatarBubble(web_ui()->GetWebContents(), rect); |
| 163 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::NTP_AVATAR_BUBBLE); | 165 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::NTP_AVATAR_BUBBLE); |
| 164 } | 166 } |
| 165 } | 167 } |
| 166 | 168 |
| 167 void NTPLoginHandler::RecordInHistogram(int type) { | 169 void NTPLoginHandler::RecordInHistogram(int type) { |
| 168 // Invalid type to record. | 170 // Invalid type to record. |
| 169 if (type < NTP_SIGN_IN_PROMO_VIEWED || | 171 if (type < NTP_SIGN_IN_PROMO_VIEWED || |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 values->SetString("login_status_message", message); | 275 values->SetString("login_status_message", message); |
| 274 values->SetString("login_status_url", | 276 values->SetString("login_status_url", |
| 275 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 277 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
| 276 values->SetString("login_status_advanced", | 278 values->SetString("login_status_advanced", |
| 277 hide_sync ? base::string16() : | 279 hide_sync ? base::string16() : |
| 278 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 280 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
| 279 values->SetString("login_status_dismiss", | 281 values->SetString("login_status_dismiss", |
| 280 hide_sync ? base::string16() : | 282 hide_sync ? base::string16() : |
| 281 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 283 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
| 282 } | 284 } |
| OLD | NEW |