| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auto_login_infobar_delegate.h" | 5 #include "chrome/browser/ui/auto_login_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/google/google_util.h" | 14 #include "chrome/browser/google/google_util.h" |
| 15 #include "chrome/browser/infobars/infobar.h" | |
| 16 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 19 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
| 20 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 19 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
| 21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 23 #include "components/infobars/core/infobar.h" |
| 24 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 24 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 25 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
| 26 #include "content/public/browser/page_navigator.h" | 26 #include "content/public/browser/page_navigator.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_contents_observer.h" | 28 #include "content/public/browser/web_contents_observer.h" |
| 29 #include "content/public/common/referrer.h" | 29 #include "content/public/common/referrer.h" |
| 30 #include "google_apis/gaia/gaia_constants.h" | 30 #include "google_apis/gaia/gaia_constants.h" |
| 31 #include "google_apis/gaia/gaia_urls.h" | 31 #include "google_apis/gaia/gaia_urls.h" |
| 32 #include "google_apis/gaia/ubertoken_fetcher.h" | 32 #include "google_apis/gaia/ubertoken_fetcher.h" |
| 33 #include "grit/chromium_strings.h" | 33 #include "grit/chromium_strings.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 void AutoLoginInfoBarDelegate::InfoBarDismissed() { | 182 void AutoLoginInfoBarDelegate::InfoBarDismissed() { |
| 183 RecordHistogramAction(DISMISSED); | 183 RecordHistogramAction(DISMISSED); |
| 184 button_pressed_ = true; | 184 button_pressed_ = true; |
| 185 } | 185 } |
| 186 | 186 |
| 187 int AutoLoginInfoBarDelegate::GetIconID() const { | 187 int AutoLoginInfoBarDelegate::GetIconID() const { |
| 188 return IDR_INFOBAR_AUTOLOGIN; | 188 return IDR_INFOBAR_AUTOLOGIN; |
| 189 } | 189 } |
| 190 | 190 |
| 191 InfoBarDelegate::Type AutoLoginInfoBarDelegate::GetInfoBarType() const { | 191 infobars::InfoBarDelegate::Type AutoLoginInfoBarDelegate::GetInfoBarType() |
| 192 const { |
| 192 return PAGE_ACTION_TYPE; | 193 return PAGE_ACTION_TYPE; |
| 193 } | 194 } |
| 194 | 195 |
| 195 AutoLoginInfoBarDelegate* | 196 AutoLoginInfoBarDelegate* |
| 196 AutoLoginInfoBarDelegate::AsAutoLoginInfoBarDelegate() { | 197 AutoLoginInfoBarDelegate::AsAutoLoginInfoBarDelegate() { |
| 197 return this; | 198 return this; |
| 198 } | 199 } |
| 199 | 200 |
| 200 base::string16 AutoLoginInfoBarDelegate::GetMessageText() const { | 201 base::string16 AutoLoginInfoBarDelegate::GetMessageText() const { |
| 201 return l10n_util::GetStringFUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE, | 202 return l10n_util::GetStringFUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 230 } | 231 } |
| 231 | 232 |
| 232 void AutoLoginInfoBarDelegate::GoogleSignedOut(const std::string& username) { | 233 void AutoLoginInfoBarDelegate::GoogleSignedOut(const std::string& username) { |
| 233 infobar()->RemoveSelf(); | 234 infobar()->RemoveSelf(); |
| 234 } | 235 } |
| 235 | 236 |
| 236 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) { | 237 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) { |
| 237 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, | 238 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, |
| 238 HISTOGRAM_BOUNDING_VALUE); | 239 HISTOGRAM_BOUNDING_VALUE); |
| 239 } | 240 } |
| OLD | NEW |