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 686d7866326c691485dd7ab2e38ba7977ecdbcf0..d16f69ff97f6bf4cbedc1066135dea81a6d0b035 100644 |
--- a/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h |
+++ b/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h |
@@ -12,7 +12,7 @@ |
#include "chrome/browser/ui/autofill/password_generation_popup_controller.h" |
#include "chrome/browser/ui/autofill/popup_controller_common.h" |
#include "components/autofill/core/common/password_form.h" |
-#include "ui/gfx/font.h" |
+#include "ui/gfx/font_list.h" |
#include "ui/gfx/native_widget_types.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/rect_f.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, |
+ PasswordForm* form, |
PasswordGenerator* generator, |
PasswordManager* password_manager, |
PasswordGenerationPopupObserver* observer, |
@@ -56,8 +57,21 @@ 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(PasswordForm* form) { form_ = form; } |
+ void set_generator(PasswordGenerator* generator) { generator_ = generator; } |
+ void set_password_manager(PasswordManager* password_manager) { |
+ password_manager_ = password_manager; |
+ } |
+ |
// Accessors. |
content::WebContents* web_contents() { |
@@ -70,7 +84,7 @@ class PasswordGenerationPopupControllerImpl |
private: |
PasswordGenerationPopupControllerImpl( |
const gfx::RectF& bounds, |
- const PasswordForm& form, |
+ PasswordForm* form, |
PasswordGenerator* generator, |
PasswordManager* password_manager, |
PasswordGenerationPopupObserver* observer, |
@@ -85,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(); |
@@ -116,7 +133,8 @@ class PasswordGenerationPopupControllerImpl |
int GetDesiredHeight(int width); |
void CalculateBounds(); |
- PasswordForm form_; |
+ // These members may be NULL. |
+ PasswordForm* form_; |
PasswordGenerator* generator_; |
PasswordManager* password_manager_; |
PasswordGenerationPopupObserver* observer_; |
@@ -127,12 +145,15 @@ class PasswordGenerationPopupControllerImpl |
// Handle to the popup. May be NULL if popup isn't showing. |
PasswordGenerationPopupView* view_; |
- // Font used in the popup. |
- gfx::Font font_; |
+ // Fonts used in the popup. |
+ gfx::FontList font_list_; |
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_; |