| 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/password_manager/password_manager_delegate_impl.h" | 5 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 REMEMBER_PASSWORD, | 50 REMEMBER_PASSWORD, |
| 51 DONT_REMEMBER_PASSWORD, | 51 DONT_REMEMBER_PASSWORD, |
| 52 NUM_RESPONSE_TYPES, | 52 NUM_RESPONSE_TYPES, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 SavePasswordInfoBarDelegate(InfoBarService* infobar_service, | 55 SavePasswordInfoBarDelegate(InfoBarService* infobar_service, |
| 56 PasswordFormManager* form_to_save); | 56 PasswordFormManager* form_to_save); |
| 57 virtual ~SavePasswordInfoBarDelegate(); | 57 virtual ~SavePasswordInfoBarDelegate(); |
| 58 | 58 |
| 59 // ConfirmInfoBarDelegate | 59 // ConfirmInfoBarDelegate |
| 60 virtual gfx::Image* GetIcon() const OVERRIDE; | 60 virtual int GetIconID() const OVERRIDE; |
| 61 virtual Type GetInfoBarType() const OVERRIDE; | 61 virtual Type GetInfoBarType() const OVERRIDE; |
| 62 virtual string16 GetMessageText() const OVERRIDE; | 62 virtual string16 GetMessageText() const OVERRIDE; |
| 63 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 63 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 64 virtual bool Accept() OVERRIDE; | 64 virtual bool Accept() OVERRIDE; |
| 65 virtual bool Cancel() OVERRIDE; | 65 virtual bool Cancel() OVERRIDE; |
| 66 | 66 |
| 67 virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; | 67 virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; |
| 68 | 68 |
| 69 // The PasswordFormManager managing the form we're asking the user about, | 69 // The PasswordFormManager managing the form we're asking the user about, |
| 70 // and should update as per her decision. | 70 // and should update as per her decision. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 : ConfirmInfoBarDelegate(infobar_service), | 108 : ConfirmInfoBarDelegate(infobar_service), |
| 109 form_to_save_(form_to_save), | 109 form_to_save_(form_to_save), |
| 110 infobar_response_(NO_RESPONSE) { | 110 infobar_response_(NO_RESPONSE) { |
| 111 } | 111 } |
| 112 | 112 |
| 113 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { | 113 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
| 114 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", | 114 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
| 115 infobar_response_, NUM_RESPONSE_TYPES); | 115 infobar_response_, NUM_RESPONSE_TYPES); |
| 116 } | 116 } |
| 117 | 117 |
| 118 gfx::Image* SavePasswordInfoBarDelegate::GetIcon() const { | 118 int SavePasswordInfoBarDelegate::GetIconID() const { |
| 119 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 119 return IDR_INFOBAR_SAVE_PASSWORD; |
| 120 IDR_INFOBAR_SAVE_PASSWORD); | |
| 121 } | 120 } |
| 122 | 121 |
| 123 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { | 122 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { |
| 124 return PAGE_ACTION_TYPE; | 123 return PAGE_ACTION_TYPE; |
| 125 } | 124 } |
| 126 | 125 |
| 127 string16 SavePasswordInfoBarDelegate::GetMessageText() const { | 126 string16 SavePasswordInfoBarDelegate::GetMessageText() const { |
| 128 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); | 127 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); |
| 129 } | 128 } |
| 130 | 129 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 191 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
| 193 content::NavigationEntry* entry = | 192 content::NavigationEntry* entry = |
| 194 web_contents_->GetController().GetActiveEntry(); | 193 web_contents_->GetController().GetActiveEntry(); |
| 195 if (!entry) { | 194 if (!entry) { |
| 196 NOTREACHED(); | 195 NOTREACHED(); |
| 197 return false; | 196 return false; |
| 198 } | 197 } |
| 199 | 198 |
| 200 return net::IsCertStatusError(entry->GetSSL().cert_status); | 199 return net::IsCertStatusError(entry->GetSSL().cert_status); |
| 201 } | 200 } |
| OLD | NEW |