Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 const gfx::RectF& bounds, | 49 const gfx::RectF& bounds, |
| 50 const PasswordForm& form, | 50 const PasswordForm& form, |
| 51 PasswordGenerator* generator, | 51 PasswordGenerator* generator, |
| 52 PasswordManager* password_manager, | 52 PasswordManager* password_manager, |
| 53 PasswordGenerationPopupObserver* observer, | 53 PasswordGenerationPopupObserver* observer, |
| 54 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
| 55 gfx::NativeView container_view); | 55 gfx::NativeView container_view); |
| 56 virtual ~PasswordGenerationPopupControllerImpl(); | 56 virtual ~PasswordGenerationPopupControllerImpl(); |
| 57 | 57 |
| 58 // Create a PasswordGenerationPopupView if one doesn't already exist. | 58 // Create a PasswordGenerationPopupView if one doesn't already exist. |
| 59 // Does not update the view if one is already showing. | 59 // If |display_password| is true, a generated password is shown that can be |
| 60 void Show(); | 60 // selected by the user. Otherwise just the text explaining generated |
| 61 // passwords is shown. | |
| 62 void Show(bool display_password); | |
| 61 | 63 |
| 62 // Hides the popup and destroys |this|. | 64 // Hides the popup and destroys |this|. |
| 63 void HideAndDestroy(); | 65 void HideAndDestroy(); |
| 64 | 66 |
| 65 // Accessors. | 67 // Accessors. |
| 66 content::WebContents* web_contents() { | 68 content::WebContents* web_contents() { |
| 67 return controller_common_.web_contents(); | 69 return controller_common_.web_contents(); |
| 68 } | 70 } |
| 69 const gfx::RectF& element_bounds() { | 71 const gfx::RectF& element_bounds() { |
| 70 return controller_common_.element_bounds(); | 72 return controller_common_.element_bounds(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 81 gfx::NativeView container_view); | 83 gfx::NativeView container_view); |
| 82 | 84 |
| 83 // PasswordGenerationPopupController implementation: | 85 // PasswordGenerationPopupController implementation: |
| 84 virtual void Hide() OVERRIDE; | 86 virtual void Hide() OVERRIDE; |
| 85 virtual void ViewDestroyed() OVERRIDE; | 87 virtual void ViewDestroyed() OVERRIDE; |
| 86 virtual void SetSelectionAtPoint(const gfx::Point& point) OVERRIDE; | 88 virtual void SetSelectionAtPoint(const gfx::Point& point) OVERRIDE; |
| 87 virtual void AcceptSelectionAtPoint(const gfx::Point& point) OVERRIDE; | 89 virtual void AcceptSelectionAtPoint(const gfx::Point& point) OVERRIDE; |
| 88 virtual void SelectionCleared() OVERRIDE; | 90 virtual void SelectionCleared() OVERRIDE; |
| 89 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE; | 91 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE; |
| 90 virtual bool ShouldHideOnOutsideClick() const OVERRIDE; | 92 virtual bool ShouldHideOnOutsideClick() const OVERRIDE; |
| 91 virtual void OnHelpLinkClicked() OVERRIDE; | 93 virtual void OnSavedPasswordsLinkClicked() OVERRIDE; |
| 92 virtual gfx::NativeView container_view() OVERRIDE; | 94 virtual gfx::NativeView container_view() OVERRIDE; |
| 95 virtual const gfx::FontList& font_list() const OVERRIDE; | |
| 93 virtual const gfx::Rect& popup_bounds() const OVERRIDE; | 96 virtual const gfx::Rect& popup_bounds() const OVERRIDE; |
| 94 virtual const gfx::Rect& password_bounds() const OVERRIDE; | 97 virtual const gfx::Rect& password_bounds() const OVERRIDE; |
| 95 virtual const gfx::Rect& divider_bounds() const OVERRIDE; | 98 virtual const gfx::Rect& divider_bounds() const OVERRIDE; |
| 96 virtual const gfx::Rect& help_bounds() const OVERRIDE; | 99 virtual const gfx::Rect& help_bounds() const OVERRIDE; |
| 100 virtual bool display_password() const OVERRIDE; | |
| 97 virtual bool password_selected() const OVERRIDE; | 101 virtual bool password_selected() const OVERRIDE; |
| 98 virtual base::string16 password() const OVERRIDE; | 102 virtual base::string16 password() const OVERRIDE; |
| 103 virtual base::string16 SuggestedText() OVERRIDE; | |
| 99 virtual base::string16 HelpText() OVERRIDE; | 104 virtual base::string16 HelpText() OVERRIDE; |
| 100 virtual base::string16 LearnMoreLink() OVERRIDE; | 105 virtual base::string16 SavedPasswordsLink() OVERRIDE; |
| 101 | 106 |
| 102 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); | 107 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); |
| 103 | 108 |
| 104 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event); | 109 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event); |
| 105 | 110 |
| 106 // Set if the password is currently selected. | 111 // Set if the password is currently selected. |
| 107 void PasswordSelected(bool selected); | 112 void PasswordSelected(bool selected); |
| 108 | 113 |
| 109 // Accept the password. Causes the controller to hide itself as the popup | 114 // Accept the password. Causes the controller to hide itself as the popup |
| 110 // is no longer necessary. | 115 // is no longer necessary. |
| 111 void PasswordAccepted(); | 116 void PasswordAccepted(); |
| 112 | 117 |
| 113 // Accept password if it's selected. | 118 // Accept password if it's selected. |
| 114 bool PossiblyAcceptPassword(); | 119 bool PossiblyAcceptPassword(); |
| 115 | 120 |
| 116 // Get desired size of popup. Height depends on width because we do text | 121 // Get desired size of popup. Height depends on width because we do text |
| 117 // wrapping. | 122 // wrapping. |
| 118 int GetDesiredWidth(); | 123 int GetDesiredWidth(); |
| 119 int GetDesiredHeight(int width); | 124 int GetDesiredHeight(int width); |
| 120 void CalculateBounds(); | 125 void CalculateBounds(); |
| 121 | 126 |
| 122 PasswordForm form_; | 127 PasswordForm form_; |
| 123 PasswordGenerator* generator_; | 128 PasswordGenerator* generator_; |
| 124 PasswordManager* password_manager_; | 129 PasswordManager* password_manager_; |
| 130 // May be NULL. | |
| 125 PasswordGenerationPopupObserver* observer_; | 131 PasswordGenerationPopupObserver* observer_; |
| 126 | 132 |
| 127 // Contains common popup functionality. | 133 // Contains common popup functionality. |
| 128 PopupControllerCommon controller_common_; | 134 PopupControllerCommon controller_common_; |
| 129 | 135 |
| 130 // Handle to the popup. May be NULL if popup isn't showing. | 136 // Handle to the popup. May be NULL if popup isn't showing. |
| 131 PasswordGenerationPopupView* view_; | 137 PasswordGenerationPopupView* view_; |
| 132 | 138 |
| 133 // Font list used in the popup. | 139 // Font list used in the popup. |
| 134 gfx::FontList font_list_; | 140 gfx::FontList font_list_; |
|
Evan Stade
2014/02/11 19:42:14
const ref
Garrett Casto
2014/02/11 23:24:06
Done.
| |
| 135 | 141 |
| 136 base::string16 current_password_; | 142 base::string16 current_password_; |
| 137 bool password_selected_; | 143 bool password_selected_; |
| 138 | 144 |
| 145 // If a password will be shown in this popup. | |
| 146 bool display_password_; | |
| 147 | |
| 139 // Bounds for all the elements of the popup. | 148 // Bounds for all the elements of the popup. |
| 140 gfx::Rect popup_bounds_; | 149 gfx::Rect popup_bounds_; |
| 141 gfx::Rect password_bounds_; | 150 gfx::Rect password_bounds_; |
| 142 gfx::Rect divider_bounds_; | 151 gfx::Rect divider_bounds_; |
| 143 gfx::Rect help_bounds_; | 152 gfx::Rect help_bounds_; |
| 144 | 153 |
| 145 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_; | 154 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_; |
| 146 | 155 |
| 147 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl); | 156 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl); |
| 148 }; | 157 }; |
| 149 | 158 |
| 150 } // namespace autofill | 159 } // namespace autofill |
| 151 | 160 |
| 152 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_ H_ | 161 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_ H_ |
| OLD | NEW |