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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" 12 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h"
13 #include "chrome/browser/ui/autofill/popup_controller_common.h" 13 #include "chrome/browser/ui/autofill/popup_controller_common.h"
14 #include "components/autofill/core/common/password_form.h" 14 #include "components/autofill/core/common/password_form.h"
15 #include "ui/gfx/font_list.h" 15 #include "ui/gfx/font_list.h"
16 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
17 #include "ui/gfx/range/range.h"
17 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
18 #include "ui/gfx/rect_f.h" 19 #include "ui/gfx/rect_f.h"
19 20
20 namespace content { 21 namespace content {
21 struct NativeWebKeyboardEvent; 22 struct NativeWebKeyboardEvent;
22 class WebContents; 23 class WebContents;
23 } 24 }
24 25
25 class PasswordManager; 26 class PasswordManager;
26 27
(...skipping 22 matching lines...) Expand all
49 const gfx::RectF& bounds, 50 const gfx::RectF& bounds,
50 const PasswordForm& form, 51 const PasswordForm& form,
51 PasswordGenerator* generator, 52 PasswordGenerator* generator,
52 PasswordManager* password_manager, 53 PasswordManager* password_manager,
53 PasswordGenerationPopupObserver* observer, 54 PasswordGenerationPopupObserver* observer,
54 content::WebContents* web_contents, 55 content::WebContents* web_contents,
55 gfx::NativeView container_view); 56 gfx::NativeView container_view);
56 virtual ~PasswordGenerationPopupControllerImpl(); 57 virtual ~PasswordGenerationPopupControllerImpl();
57 58
58 // Create a PasswordGenerationPopupView if one doesn't already exist. 59 // Create a PasswordGenerationPopupView if one doesn't already exist.
59 // Does not update the view if one is already showing. 60 // If |display_password| is true, a generated password is shown that can be
60 void Show(); 61 // selected by the user. Otherwise just the text explaining generated
62 // passwords is shown.
63 void Show(bool display_password);
61 64
62 // Hides the popup and destroys |this|. 65 // Hides the popup and destroys |this|.
63 void HideAndDestroy(); 66 void HideAndDestroy();
64 67
65 // Accessors. 68 // Accessors.
66 content::WebContents* web_contents() { 69 content::WebContents* web_contents() {
67 return controller_common_.web_contents(); 70 return controller_common_.web_contents();
68 } 71 }
69 const gfx::RectF& element_bounds() { 72 const gfx::RectF& element_bounds() {
70 return controller_common_.element_bounds(); 73 return controller_common_.element_bounds();
(...skipping 10 matching lines...) Expand all
81 gfx::NativeView container_view); 84 gfx::NativeView container_view);
82 85
83 // PasswordGenerationPopupController implementation: 86 // PasswordGenerationPopupController implementation:
84 virtual void Hide() OVERRIDE; 87 virtual void Hide() OVERRIDE;
85 virtual void ViewDestroyed() OVERRIDE; 88 virtual void ViewDestroyed() OVERRIDE;
86 virtual void SetSelectionAtPoint(const gfx::Point& point) OVERRIDE; 89 virtual void SetSelectionAtPoint(const gfx::Point& point) OVERRIDE;
87 virtual void AcceptSelectionAtPoint(const gfx::Point& point) OVERRIDE; 90 virtual void AcceptSelectionAtPoint(const gfx::Point& point) OVERRIDE;
88 virtual void SelectionCleared() OVERRIDE; 91 virtual void SelectionCleared() OVERRIDE;
89 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE; 92 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE;
90 virtual bool ShouldHideOnOutsideClick() const OVERRIDE; 93 virtual bool ShouldHideOnOutsideClick() const OVERRIDE;
91 virtual void OnHelpLinkClicked() OVERRIDE; 94 virtual void OnSavedPasswordsLinkClicked() OVERRIDE;
92 virtual gfx::NativeView container_view() OVERRIDE; 95 virtual gfx::NativeView container_view() OVERRIDE;
96 virtual const gfx::FontList& font_list() const OVERRIDE;
93 virtual const gfx::Rect& popup_bounds() const OVERRIDE; 97 virtual const gfx::Rect& popup_bounds() const OVERRIDE;
94 virtual const gfx::Rect& password_bounds() const OVERRIDE; 98 virtual const gfx::Rect& password_bounds() const OVERRIDE;
95 virtual const gfx::Rect& divider_bounds() const OVERRIDE; 99 virtual const gfx::Rect& divider_bounds() const OVERRIDE;
96 virtual const gfx::Rect& help_bounds() const OVERRIDE; 100 virtual const gfx::Rect& help_bounds() const OVERRIDE;
101 virtual bool display_password() const OVERRIDE;
97 virtual bool password_selected() const OVERRIDE; 102 virtual bool password_selected() const OVERRIDE;
98 virtual base::string16 password() const OVERRIDE; 103 virtual base::string16 password() const OVERRIDE;
99 virtual base::string16 HelpText() OVERRIDE; 104 virtual base::string16 SuggestedText() OVERRIDE;
100 virtual base::string16 LearnMoreLink() OVERRIDE; 105 virtual const base::string16& HelpText() OVERRIDE;
106 virtual const gfx::Range& HelpTextLinkRange() OVERRIDE;
101 107
102 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); 108 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr();
103 109
104 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event); 110 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event);
105 111
106 // Set if the password is currently selected. 112 // Set if the password is currently selected.
107 void PasswordSelected(bool selected); 113 void PasswordSelected(bool selected);
108 114
109 // Accept the password. Causes the controller to hide itself as the popup 115 // Accept the password. Causes the controller to hide itself as the popup
110 // is no longer necessary. 116 // is no longer necessary.
111 void PasswordAccepted(); 117 void PasswordAccepted();
112 118
113 // Accept password if it's selected. 119 // Accept password if it's selected.
114 bool PossiblyAcceptPassword(); 120 bool PossiblyAcceptPassword();
115 121
116 // Get desired size of popup. Height depends on width because we do text 122 // Get desired size of popup. Height depends on width because we do text
117 // wrapping. 123 // wrapping.
118 int GetDesiredWidth(); 124 int GetDesiredWidth();
119 int GetDesiredHeight(int width); 125 int GetDesiredHeight(int width);
120 void CalculateBounds(); 126 void CalculateBounds();
121 127
122 PasswordForm form_; 128 PasswordForm form_;
123 PasswordGenerator* generator_; 129 PasswordGenerator* generator_;
124 PasswordManager* password_manager_; 130 PasswordManager* password_manager_;
131 // May be NULL.
125 PasswordGenerationPopupObserver* observer_; 132 PasswordGenerationPopupObserver* observer_;
126 133
127 // Contains common popup functionality. 134 // Contains common popup functionality.
128 PopupControllerCommon controller_common_; 135 PopupControllerCommon controller_common_;
129 136
130 // Handle to the popup. May be NULL if popup isn't showing. 137 // Handle to the popup. May be NULL if popup isn't showing.
131 PasswordGenerationPopupView* view_; 138 PasswordGenerationPopupView* view_;
132 139
133 // Font list used in the popup. 140 // Font list used in the popup.
134 gfx::FontList font_list_; 141 const gfx::FontList& font_list_;
142
143 // Help text and the range in the text that corresponds to the saved passwords
144 // link.
145 base::string16 help_text_;
146 gfx::Range link_range_;
135 147
136 base::string16 current_password_; 148 base::string16 current_password_;
137 bool password_selected_; 149 bool password_selected_;
138 150
151 // If a password will be shown in this popup.
152 bool display_password_;
153
139 // Bounds for all the elements of the popup. 154 // Bounds for all the elements of the popup.
140 gfx::Rect popup_bounds_; 155 gfx::Rect popup_bounds_;
141 gfx::Rect password_bounds_; 156 gfx::Rect password_bounds_;
142 gfx::Rect divider_bounds_; 157 gfx::Rect divider_bounds_;
143 gfx::Rect help_bounds_; 158 gfx::Rect help_bounds_;
144 159
145 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_; 160 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_;
146 161
147 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl); 162 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl);
148 }; 163 };
149 164
150 } // namespace autofill 165 } // namespace autofill
151 166
152 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_ H_ 167 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698