| 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" |
| 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" | |
| 16 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/gfx/range/range.h" | 16 #include "ui/gfx/range/range.h" |
| 18 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 19 #include "ui/gfx/rect_f.h" | 18 #include "ui/gfx/rect_f.h" |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 struct NativeWebKeyboardEvent; | 21 struct NativeWebKeyboardEvent; |
| 23 class WebContents; | 22 class WebContents; |
| 24 } | 23 } |
| 25 | 24 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 content::WebContents* web_contents, | 84 content::WebContents* web_contents, |
| 86 gfx::NativeView container_view); | 85 gfx::NativeView container_view); |
| 87 | 86 |
| 88 // PasswordGenerationPopupController implementation: | 87 // PasswordGenerationPopupController implementation: |
| 89 virtual void Hide() OVERRIDE; | 88 virtual void Hide() OVERRIDE; |
| 90 virtual void ViewDestroyed() OVERRIDE; | 89 virtual void ViewDestroyed() OVERRIDE; |
| 91 virtual void SetSelectionAtPoint(const gfx::Point& point) OVERRIDE; | 90 virtual void SetSelectionAtPoint(const gfx::Point& point) OVERRIDE; |
| 92 virtual bool AcceptSelectedLine() OVERRIDE; | 91 virtual bool AcceptSelectedLine() OVERRIDE; |
| 93 virtual void SelectionCleared() OVERRIDE; | 92 virtual void SelectionCleared() OVERRIDE; |
| 94 virtual void OnSavedPasswordsLinkClicked() OVERRIDE; | 93 virtual void OnSavedPasswordsLinkClicked() OVERRIDE; |
| 94 virtual int GetMinimumWidth() OVERRIDE; |
| 95 virtual gfx::NativeView container_view() OVERRIDE; | 95 virtual gfx::NativeView container_view() OVERRIDE; |
| 96 virtual const gfx::FontList& font_list() const OVERRIDE; | |
| 97 virtual const gfx::Rect& popup_bounds() const OVERRIDE; | 96 virtual const gfx::Rect& popup_bounds() const OVERRIDE; |
| 98 virtual const gfx::Rect& password_bounds() const OVERRIDE; | |
| 99 virtual const gfx::Rect& divider_bounds() const OVERRIDE; | |
| 100 virtual const gfx::Rect& help_bounds() const OVERRIDE; | |
| 101 virtual bool display_password() const OVERRIDE; | 97 virtual bool display_password() const OVERRIDE; |
| 102 virtual bool password_selected() const OVERRIDE; | 98 virtual bool password_selected() const OVERRIDE; |
| 103 virtual base::string16 password() const OVERRIDE; | 99 virtual base::string16 password() const OVERRIDE; |
| 104 virtual base::string16 SuggestedText() OVERRIDE; | 100 virtual base::string16 SuggestedText() OVERRIDE; |
| 105 virtual const base::string16& HelpText() OVERRIDE; | 101 virtual const base::string16& HelpText() OVERRIDE; |
| 106 virtual const gfx::Range& HelpTextLinkRange() OVERRIDE; | 102 virtual const gfx::Range& HelpTextLinkRange() OVERRIDE; |
| 107 | 103 |
| 108 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); | 104 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); |
| 109 | 105 |
| 110 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event); | 106 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event); |
| 111 | 107 |
| 112 // Set if the password is currently selected. | 108 // Set if the password is currently selected. |
| 113 void PasswordSelected(bool selected); | 109 void PasswordSelected(bool selected); |
| 114 | 110 |
| 115 // Accept the password. Causes the controller to hide itself as the popup | 111 // Accept the password. Causes the controller to hide itself as the popup |
| 116 // is no longer necessary. | 112 // is no longer necessary. |
| 117 void PasswordAccepted(); | 113 void PasswordAccepted(); |
| 118 | 114 |
| 119 // Accept password if it's selected. | 115 // Accept password if it's selected. |
| 120 bool PossiblyAcceptPassword(); | 116 bool PossiblyAcceptPassword(); |
| 121 | 117 |
| 122 // Get desired size of popup. Height depends on width because we do text | 118 // Get desired size of popup. Height depends on width because we do text |
| 123 // wrapping. | 119 // wrapping. |
| 124 int GetDesiredWidth(); | |
| 125 int GetDesiredHeight(int width); | |
| 126 void CalculateBounds(); | 120 void CalculateBounds(); |
| 127 | 121 |
| 128 PasswordForm form_; | 122 PasswordForm form_; |
| 129 password_manager::PasswordManager* password_manager_; | 123 password_manager::PasswordManager* password_manager_; |
| 130 | 124 |
| 131 // May be NULL. | 125 // May be NULL. |
| 132 PasswordGenerationPopupObserver* observer_; | 126 PasswordGenerationPopupObserver* observer_; |
| 133 | 127 |
| 134 // Controls how passwords are generated. | 128 // Controls how passwords are generated. |
| 135 scoped_ptr<PasswordGenerator> generator_; | 129 scoped_ptr<PasswordGenerator> generator_; |
| 136 | 130 |
| 137 // Contains common popup functionality. | 131 // Contains common popup functionality. |
| 138 PopupControllerCommon controller_common_; | 132 PopupControllerCommon controller_common_; |
| 139 | 133 |
| 140 // Handle to the popup. May be NULL if popup isn't showing. | 134 // Handle to the popup. May be NULL if popup isn't showing. |
| 141 PasswordGenerationPopupView* view_; | 135 PasswordGenerationPopupView* view_; |
| 142 | 136 |
| 143 // Font list used in the popup. | |
| 144 const gfx::FontList& font_list_; | |
| 145 | |
| 146 // Help text and the range in the text that corresponds to the saved passwords | 137 // Help text and the range in the text that corresponds to the saved passwords |
| 147 // link. | 138 // link. |
| 148 base::string16 help_text_; | 139 base::string16 help_text_; |
| 149 gfx::Range link_range_; | 140 gfx::Range link_range_; |
| 150 | 141 |
| 151 base::string16 current_password_; | 142 base::string16 current_password_; |
| 152 bool password_selected_; | 143 bool password_selected_; |
| 153 | 144 |
| 154 // If a password will be shown in this popup. | 145 // If a password will be shown in this popup. |
| 155 bool display_password_; | 146 bool display_password_; |
| 156 | 147 |
| 157 // Bounds for all the elements of the popup. | 148 // Bounds for all the elements of the popup. |
| 158 gfx::Rect popup_bounds_; | 149 gfx::Rect popup_bounds_; |
| 159 gfx::Rect password_bounds_; | |
| 160 gfx::Rect divider_bounds_; | |
| 161 gfx::Rect help_bounds_; | |
| 162 | 150 |
| 163 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_; | 151 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_; |
| 164 | 152 |
| 165 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl); | 153 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl); |
| 166 }; | 154 }; |
| 167 | 155 |
| 168 } // namespace autofill | 156 } // namespace autofill |
| 169 | 157 |
| 170 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_
H_ | 158 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_
H_ |
| OLD | NEW |