| 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/auto_login_info_bar_delegate.h" | 5 #include "chrome/browser/ui/auto_login_info_bar_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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
| 14 #include "chrome/browser/infobars/infobar_tab_helper.h" | 14 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/signin/ubertoken_fetcher.h" | 17 #include "chrome/browser/signin/ubertoken_fetcher.h" |
| 18 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 18 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 20 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 20 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 21 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/net/gaia/gaia_constants.h" | 23 #include "chrome/common/net/gaia/gaia_constants.h" |
| 24 #include "chrome/common/net/gaia/gaia_urls.h" | 24 #include "chrome/common/net/gaia/gaia_urls.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
| 28 #include "content/public/browser/notification_observer.h" | 28 #include "content/public/browser/notification_observer.h" |
| 29 #include "content/public/browser/notification_registrar.h" | 29 #include "content/public/browser/notification_registrar.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 bool AutoLoginInfoBarDelegate::Accept() { | 183 bool AutoLoginInfoBarDelegate::Accept() { |
| 184 // AutoLoginRedirector deletes itself. | 184 // AutoLoginRedirector deletes itself. |
| 185 new AutoLoginRedirector(&owner()->web_contents()->GetController(), args_); | 185 new AutoLoginRedirector(&owner()->web_contents()->GetController(), args_); |
| 186 RecordHistogramAction(HISTOGRAM_ACCEPTED); | 186 RecordHistogramAction(HISTOGRAM_ACCEPTED); |
| 187 button_pressed_ = true; | 187 button_pressed_ = true; |
| 188 return true; | 188 return true; |
| 189 } | 189 } |
| 190 | 190 |
| 191 bool AutoLoginInfoBarDelegate::Cancel() { | 191 bool AutoLoginInfoBarDelegate::Cancel() { |
| 192 PrefService* pref_service = | 192 PrefService* pref_service = TabContents::FromWebContents( |
| 193 TabContentsWrapper::GetCurrentWrapperForContents( | 193 owner()->web_contents())->profile()->GetPrefs(); |
| 194 owner()->web_contents())->profile()->GetPrefs(); | |
| 195 pref_service->SetBoolean(prefs::kAutologinEnabled, false); | 194 pref_service->SetBoolean(prefs::kAutologinEnabled, false); |
| 196 RecordHistogramAction(HISTOGRAM_REJECTED); | 195 RecordHistogramAction(HISTOGRAM_REJECTED); |
| 197 button_pressed_ = true; | 196 button_pressed_ = true; |
| 198 return true; | 197 return true; |
| 199 } | 198 } |
| 200 | 199 |
| 201 void AutoLoginInfoBarDelegate::RecordHistogramAction(int action) { | 200 void AutoLoginInfoBarDelegate::RecordHistogramAction(int action) { |
| 202 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, HISTOGRAM_MAX); | 201 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, HISTOGRAM_MAX); |
| 203 } | 202 } |
| OLD | NEW |