| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_delegate_impl.h" | 5 #include "chrome/browser/password_manager_delegate_impl.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "chrome/browser/password_manager/password_form_manager.h" | 9 #include "chrome/browser/password_manager/password_form_manager.h" |
| 10 #include "chrome/browser/password_manager/password_manager.h" | 10 #include "chrome/browser/password_manager/password_manager.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 NUM_RESPONSE_TYPES, | 38 NUM_RESPONSE_TYPES, |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 virtual ~SavePasswordInfoBarDelegate(); | 41 virtual ~SavePasswordInfoBarDelegate(); |
| 42 | 42 |
| 43 // ConfirmInfoBarDelegate | 43 // ConfirmInfoBarDelegate |
| 44 virtual void InfoBarClosed(); | 44 virtual void InfoBarClosed(); |
| 45 virtual SkBitmap* GetIcon() const; | 45 virtual SkBitmap* GetIcon() const; |
| 46 virtual Type GetInfoBarType() const; | 46 virtual Type GetInfoBarType() const; |
| 47 virtual string16 GetMessageText() const; | 47 virtual string16 GetMessageText() const; |
| 48 virtual int GetButtons() const; | |
| 49 virtual string16 GetButtonLabel(InfoBarButton button) const; | 48 virtual string16 GetButtonLabel(InfoBarButton button) const; |
| 50 virtual bool Accept(); | 49 virtual bool Accept(); |
| 51 virtual bool Cancel(); | 50 virtual bool Cancel(); |
| 52 | 51 |
| 53 // The PasswordFormManager managing the form we're asking the user about, | 52 // The PasswordFormManager managing the form we're asking the user about, |
| 54 // and should update as per her decision. | 53 // and should update as per her decision. |
| 55 scoped_ptr<PasswordFormManager> form_to_save_; | 54 scoped_ptr<PasswordFormManager> form_to_save_; |
| 56 | 55 |
| 57 // Used to track the results we get from the info bar. | 56 // Used to track the results we get from the info bar. |
| 58 ResponseType infobar_response_; | 57 ResponseType infobar_response_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 } | 82 } |
| 84 | 83 |
| 85 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { | 84 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { |
| 86 return PAGE_ACTION_TYPE; | 85 return PAGE_ACTION_TYPE; |
| 87 } | 86 } |
| 88 | 87 |
| 89 string16 SavePasswordInfoBarDelegate::GetMessageText() const { | 88 string16 SavePasswordInfoBarDelegate::GetMessageText() const { |
| 90 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); | 89 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); |
| 91 } | 90 } |
| 92 | 91 |
| 93 int SavePasswordInfoBarDelegate::GetButtons() const { | |
| 94 return BUTTON_OK | BUTTON_CANCEL; | |
| 95 } | |
| 96 | |
| 97 string16 SavePasswordInfoBarDelegate::GetButtonLabel( | 92 string16 SavePasswordInfoBarDelegate::GetButtonLabel( |
| 98 InfoBarButton button) const { | 93 InfoBarButton button) const { |
| 99 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 94 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 100 IDS_PASSWORD_MANAGER_SAVE_BUTTON : IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON); | 95 IDS_PASSWORD_MANAGER_SAVE_BUTTON : IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON); |
| 101 } | 96 } |
| 102 | 97 |
| 103 bool SavePasswordInfoBarDelegate::Accept() { | 98 bool SavePasswordInfoBarDelegate::Accept() { |
| 104 DCHECK(form_to_save_.get()); | 99 DCHECK(form_to_save_.get()); |
| 105 form_to_save_->Save(); | 100 form_to_save_->Save(); |
| 106 infobar_response_ = REMEMBER_PASSWORD; | 101 infobar_response_ = REMEMBER_PASSWORD; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 130 } | 125 } |
| 131 | 126 |
| 132 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { | 127 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { |
| 133 return tab_contents_->profile(); | 128 return tab_contents_->profile(); |
| 134 } | 129 } |
| 135 | 130 |
| 136 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 131 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
| 137 return tab_contents_->controller().ssl_manager()-> | 132 return tab_contents_->controller().ssl_manager()-> |
| 138 ProcessedSSLErrorFromRequest(); | 133 ProcessedSSLErrorFromRequest(); |
| 139 } | 134 } |
| OLD | NEW |