Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5892)

Unified Diff: chrome/browser/ui/autofill/password_generation_popup_controller_impl.h

Issue 147533005: [Password Generation] Update UI to match final mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replace_password_generation_ui
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d36c884ad13ba9e654140a1521a4be5ee4798610..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,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(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() {
return controller_common_.web_contents();
@@ -73,7 +84,7 @@ class PasswordGenerationPopupControllerImpl
private:
PasswordGenerationPopupControllerImpl(
const gfx::RectF& bounds,
- const PasswordForm& form,
+ 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.
+ PasswordForm* form_;
PasswordGenerator* generator_;
PasswordManager* password_manager_;
PasswordGenerationPopupObserver* observer_;
@@ -130,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_;

Powered by Google App Engine
This is Rietveld 408576698