Chromium Code Reviews| Index: chrome/browser/ui/autofill/password_generation_popup_controller_impl.h |
| diff --git a/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h b/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h |
| index 14386f40abe93d5f45a8ac9df7de1718d442b0c2..76ac87d8f8bd34e272258585b1479322465eeeee 100644 |
| --- a/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h |
| +++ b/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h |
| @@ -42,12 +42,13 @@ class PasswordGenerationPopupControllerImpl |
| // that we are showing the dropdown for in screen space. |form| is the |
| // identifier for the form that we are filling, and is used to notify |
| // |password_manager| if the password is generated. |generator| is used to |
| - // create the password shown. If not NULL, |observer| will be notified of |
| - // changes of the popup state. |
| + // create the password shown. These three parameters may be NULL if a |
| + // generated password won't be suggested. If not NULL, |observer| will be |
| + // notified of changes of the popup state. |
| static base::WeakPtr<PasswordGenerationPopupControllerImpl> GetOrCreate( |
| base::WeakPtr<PasswordGenerationPopupControllerImpl> previous, |
| const gfx::RectF& bounds, |
| - const PasswordForm& form, |
| + const PasswordForm* form, |
| PasswordGenerator* generator, |
| PasswordManager* password_manager, |
| PasswordGenerationPopupObserver* observer, |
| @@ -56,12 +57,22 @@ class PasswordGenerationPopupControllerImpl |
| virtual ~PasswordGenerationPopupControllerImpl(); |
| // Create a PasswordGenerationPopupView if one doesn't already exist. |
| - // Does not update the view if one is already showing. |
| - void Show(); |
| + // If |display_password| is true, a generated password is shown that can be |
| + // selected by the user. Otherwise just the text explaining generated |
| + // passwords is shown. |
| + void Show(bool display_password); |
| // Hides the popup and destroys |this|. |
| void HideAndDestroy(); |
| + // Setters |
| + void set_form(const PasswordForm* form) { form_ = form; } |
|
Evan Stade
2014/02/07 21:45:48
why are these public? why do you need them at all?
Garrett Casto
2014/02/10 11:02:44
They were there because in the editing form of the
|
| + void set_generator(PasswordGenerator* generator) { generator_ = generator; } |
| + void set_password_manager(PasswordManager* password_manager) { |
| + password_manager_ = password_manager; |
| + } |
| + |
| + |
| // Accessors. |
| content::WebContents* web_contents() { |
| return controller_common_.web_contents(); |
| @@ -73,7 +84,7 @@ class PasswordGenerationPopupControllerImpl |
| private: |
| PasswordGenerationPopupControllerImpl( |
| const gfx::RectF& bounds, |
| - const PasswordForm& form, |
| + const PasswordForm* form, |
| PasswordGenerator* generator, |
| PasswordManager* password_manager, |
| PasswordGenerationPopupObserver* observer, |
| @@ -88,16 +99,19 @@ class PasswordGenerationPopupControllerImpl |
| virtual void SelectionCleared() OVERRIDE; |
| virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE; |
| virtual bool ShouldHideOnOutsideClick() const OVERRIDE; |
| - virtual void OnHelpLinkClicked() OVERRIDE; |
| + virtual void OnSavedPasswordsLinkClicked() OVERRIDE; |
| virtual gfx::NativeView container_view() OVERRIDE; |
| + virtual const gfx::FontList& font_list() const OVERRIDE; |
| virtual const gfx::Rect& popup_bounds() const OVERRIDE; |
| virtual const gfx::Rect& password_bounds() const OVERRIDE; |
| virtual const gfx::Rect& divider_bounds() const OVERRIDE; |
| virtual const gfx::Rect& help_bounds() const OVERRIDE; |
| + virtual bool display_password() const OVERRIDE; |
| virtual bool password_selected() const OVERRIDE; |
| virtual base::string16 password() const OVERRIDE; |
| + virtual base::string16 SuggestedText() OVERRIDE; |
| virtual base::string16 HelpText() OVERRIDE; |
| - virtual base::string16 LearnMoreLink() OVERRIDE; |
| + virtual base::string16 SavedPasswordsLink() OVERRIDE; |
| base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); |
| @@ -119,7 +133,8 @@ class PasswordGenerationPopupControllerImpl |
| int GetDesiredHeight(int width); |
| void CalculateBounds(); |
| - PasswordForm form_; |
| + // These members may be NULL. |
| + const PasswordForm* form_; |
|
Evan Stade
2014/02/07 21:45:48
why can this be null?
Garrett Casto
2014/02/10 11:02:44
N/A now, but if a password isn't displayed this va
|
| PasswordGenerator* generator_; |
| PasswordManager* password_manager_; |
| PasswordGenerationPopupObserver* observer_; |
| @@ -136,6 +151,9 @@ class PasswordGenerationPopupControllerImpl |
| base::string16 current_password_; |
| bool password_selected_; |
| + // If a password will be shown in this popup. |
| + bool display_password_; |
| + |
| // Bounds for all the elements of the popup. |
| gfx::Rect popup_bounds_; |
| gfx::Rect password_bounds_; |