Index: chrome/browser/password_manager_delegate_impl.cc |
=================================================================== |
--- chrome/browser/password_manager_delegate_impl.cc (revision 71863) |
+++ chrome/browser/password_manager_delegate_impl.cc (working copy) |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -27,78 +27,95 @@ |
class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate { |
public: |
SavePasswordInfoBarDelegate(TabContents* tab_contents, |
- PasswordFormManager* form_to_save) |
- : ConfirmInfoBarDelegate(tab_contents), |
- form_to_save_(form_to_save), |
- infobar_response_(NO_RESPONSE) {} |
+ PasswordFormManager* form_to_save); |
- virtual ~SavePasswordInfoBarDelegate() {} |
+ private: |
+ enum ResponseType { |
+ NO_RESPONSE = 0, |
+ REMEMBER_PASSWORD, |
+ DONT_REMEMBER_PASSWORD, |
+ NUM_RESPONSE_TYPES, |
+ }; |
- // Begin ConfirmInfoBarDelegate implementation. |
- virtual void InfoBarClosed() { |
- UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
- infobar_response_, NUM_RESPONSE_TYPES); |
- delete this; |
- } |
+ virtual ~SavePasswordInfoBarDelegate(); |
- virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; } |
+ // ConfirmInfoBarDelegate |
+ virtual void InfoBarClosed(); |
+ virtual SkBitmap* GetIcon() const; |
+ virtual Type GetInfoBarType() const; |
+ virtual string16 GetMessageText() const; |
+ virtual int GetButtons() const; |
+ virtual string16 GetButtonLabel(InfoBarButton button) const; |
+ virtual bool Accept(); |
+ virtual bool Cancel(); |
- virtual string16 GetMessageText() const { |
- return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); |
- } |
- |
- virtual SkBitmap* GetIcon() const { |
- return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
- IDR_INFOBAR_SAVE_PASSWORD); |
- } |
- |
- virtual int GetButtons() const { |
- return BUTTON_OK | BUTTON_CANCEL; |
- } |
- |
- virtual string16 GetButtonLabel(InfoBarButton button) const { |
- if (button == BUTTON_OK) |
- return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON); |
- if (button == BUTTON_CANCEL) |
- return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON); |
- NOTREACHED(); |
- return string16(); |
- } |
- |
- virtual bool Accept() { |
- DCHECK(form_to_save_.get()); |
- form_to_save_->Save(); |
- infobar_response_ = REMEMBER_PASSWORD; |
- return true; |
- } |
- |
- virtual bool Cancel() { |
- DCHECK(form_to_save_.get()); |
- form_to_save_->PermanentlyBlacklist(); |
- infobar_response_ = DONT_REMEMBER_PASSWORD; |
- return true; |
- } |
- // End ConfirmInfoBarDelegate implementation. |
- |
- private: |
// The PasswordFormManager managing the form we're asking the user about, |
// and should update as per her decision. |
scoped_ptr<PasswordFormManager> form_to_save_; |
// Used to track the results we get from the info bar. |
- enum ResponseType { |
- NO_RESPONSE = 0, |
- REMEMBER_PASSWORD, |
- DONT_REMEMBER_PASSWORD, |
- NUM_RESPONSE_TYPES, |
- }; |
ResponseType infobar_response_; |
DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); |
}; |
-//---------------------------------------------------------------------------- |
+SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( |
+ TabContents* tab_contents, |
+ PasswordFormManager* form_to_save) |
+ : ConfirmInfoBarDelegate(tab_contents), |
+ form_to_save_(form_to_save), |
+ infobar_response_(NO_RESPONSE) { |
+} |
+SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
+} |
+ |
+void SavePasswordInfoBarDelegate::InfoBarClosed() { |
+ UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
+ infobar_response_, NUM_RESPONSE_TYPES); |
+ delete this; |
+} |
+ |
+SkBitmap* SavePasswordInfoBarDelegate::GetIcon() const { |
+ return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
+ IDR_INFOBAR_SAVE_PASSWORD); |
+} |
+ |
+InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { |
+ return PAGE_ACTION_TYPE; |
+} |
+ |
+string16 SavePasswordInfoBarDelegate::GetMessageText() const { |
+ return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); |
+} |
+ |
+int SavePasswordInfoBarDelegate::GetButtons() const { |
+ return BUTTON_OK | BUTTON_CANCEL; |
+} |
+ |
+string16 SavePasswordInfoBarDelegate::GetButtonLabel( |
+ InfoBarButton button) const { |
+ return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
+ IDS_PASSWORD_MANAGER_SAVE_BUTTON : IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON); |
+} |
+ |
+bool SavePasswordInfoBarDelegate::Accept() { |
+ DCHECK(form_to_save_.get()); |
+ form_to_save_->Save(); |
+ infobar_response_ = REMEMBER_PASSWORD; |
+ return true; |
+} |
+ |
+bool SavePasswordInfoBarDelegate::Cancel() { |
+ DCHECK(form_to_save_.get()); |
+ form_to_save_->PermanentlyBlacklist(); |
+ infobar_response_ = DONT_REMEMBER_PASSWORD; |
+ return true; |
+} |
+ |
+ |
+// PasswordManagerDelegateImpl ------------------------------------------------ |
+ |
void PasswordManagerDelegateImpl::FillPasswordForm( |
const webkit_glue::PasswordFormFillData& form_data) { |
tab_contents_->render_view_host()->FillPasswordForm(form_data); |
Property changes on: chrome/browser/password_manager_delegate_impl.cc |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |