| 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/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.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 23 matching lines...) Expand all Loading... |
| 34 enum ResponseType { | 34 enum ResponseType { |
| 35 NO_RESPONSE = 0, | 35 NO_RESPONSE = 0, |
| 36 REMEMBER_PASSWORD, | 36 REMEMBER_PASSWORD, |
| 37 DONT_REMEMBER_PASSWORD, | 37 DONT_REMEMBER_PASSWORD, |
| 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 gfx::Image* GetIcon() const OVERRIDE; |
| 45 virtual gfx::Image* GetIcon() const; | 45 virtual Type GetInfoBarType() const OVERRIDE; |
| 46 virtual Type GetInfoBarType() const; | 46 virtual string16 GetMessageText() const OVERRIDE; |
| 47 virtual string16 GetMessageText() const; | 47 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 48 virtual string16 GetButtonLabel(InfoBarButton button) const; | 48 virtual bool Accept() OVERRIDE; |
| 49 virtual bool Accept(); | 49 virtual bool Cancel() OVERRIDE; |
| 50 virtual bool Cancel(); | |
| 51 | 50 |
| 52 // The PasswordFormManager managing the form we're asking the user about, | 51 // The PasswordFormManager managing the form we're asking the user about, |
| 53 // and should update as per her decision. | 52 // and should update as per her decision. |
| 54 scoped_ptr<PasswordFormManager> form_to_save_; | 53 scoped_ptr<PasswordFormManager> form_to_save_; |
| 55 | 54 |
| 56 // Used to track the results we get from the info bar. | 55 // Used to track the results we get from the info bar. |
| 57 ResponseType infobar_response_; | 56 ResponseType infobar_response_; |
| 58 | 57 |
| 59 DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); | 58 DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( | 61 SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( |
| 63 TabContents* tab_contents, | 62 TabContents* tab_contents, |
| 64 PasswordFormManager* form_to_save) | 63 PasswordFormManager* form_to_save) |
| 65 : ConfirmInfoBarDelegate(tab_contents), | 64 : ConfirmInfoBarDelegate(tab_contents), |
| 66 form_to_save_(form_to_save), | 65 form_to_save_(form_to_save), |
| 67 infobar_response_(NO_RESPONSE) { | 66 infobar_response_(NO_RESPONSE) { |
| 68 } | 67 } |
| 69 | 68 |
| 70 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { | 69 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
| 71 } | |
| 72 | |
| 73 void SavePasswordInfoBarDelegate::InfoBarClosed() { | |
| 74 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", | 70 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
| 75 infobar_response_, NUM_RESPONSE_TYPES); | 71 infobar_response_, NUM_RESPONSE_TYPES); |
| 76 delete this; | |
| 77 } | 72 } |
| 78 | 73 |
| 79 gfx::Image* SavePasswordInfoBarDelegate::GetIcon() const { | 74 gfx::Image* SavePasswordInfoBarDelegate::GetIcon() const { |
| 80 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 75 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 81 IDR_INFOBAR_SAVE_PASSWORD); | 76 IDR_INFOBAR_SAVE_PASSWORD); |
| 82 } | 77 } |
| 83 | 78 |
| 84 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { | 79 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { |
| 85 return PAGE_ACTION_TYPE; | 80 return PAGE_ACTION_TYPE; |
| 86 } | 81 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 120 } |
| 126 | 121 |
| 127 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { | 122 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { |
| 128 return tab_contents_->profile(); | 123 return tab_contents_->profile(); |
| 129 } | 124 } |
| 130 | 125 |
| 131 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 126 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
| 132 return tab_contents_->controller().ssl_manager()-> | 127 return tab_contents_->controller().ssl_manager()-> |
| 133 ProcessedSSLErrorFromRequest(); | 128 ProcessedSSLErrorFromRequest(); |
| 134 } | 129 } |
| OLD | NEW |