| 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 <stddef.h> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" | 13 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" |
| 13 #include "chrome/browser/ui/autofill/popup_controller_common.h" | 14 #include "chrome/browser/ui/autofill/popup_controller_common.h" |
| 15 #include "chrome/browser/ui/autofill/popup_view_common.h" |
| 14 #include "components/autofill/core/common/password_form.h" | 16 #include "components/autofill/core/common/password_form.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/rect_f.h" | 18 #include "ui/gfx/geometry/rect_f.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 18 #include "ui/gfx/range/range.h" | 20 #include "ui/gfx/range/range.h" |
| 19 | 21 |
| 20 namespace content { | 22 namespace content { |
| 21 struct NativeWebKeyboardEvent; | 23 struct NativeWebKeyboardEvent; |
| 22 class WebContents; | 24 class WebContents; |
| 23 } | 25 } |
| 24 | 26 |
| 25 namespace password_manager { | 27 namespace password_manager { |
| 26 class PasswordManager; | 28 class PasswordManager; |
| 27 class PasswordManagerDriver; | 29 class PasswordManagerDriver; |
| 28 } | 30 } |
| 29 | 31 |
| 30 namespace autofill { | 32 namespace autofill { |
| 31 | 33 |
| 32 class PasswordGenerator; | 34 class PasswordGenerator; |
| 33 class PasswordGenerationPopupObserver; | 35 class PasswordGenerationPopupObserver; |
| 34 class PasswordGenerationPopupView; | 36 class PasswordGenerationPopupView; |
| 37 struct Suggestion; |
| 35 | 38 |
| 36 // This class controls a PasswordGenerationPopupView. It is responsible for | 39 // This class controls a PasswordGenerationPopupView. It is responsible for |
| 37 // determining the location of the popup, handling keypress events while the | 40 // determining the location of the popup, handling keypress events while the |
| 38 // popup is active, and notifying both the renderer and the password manager | 41 // popup is active, and notifying both the renderer and the password manager |
| 39 // if the password is accepted. | 42 // if the password is accepted. |
| 40 class PasswordGenerationPopupControllerImpl | 43 class PasswordGenerationPopupControllerImpl |
| 41 : public PasswordGenerationPopupController { | 44 : public PasswordGenerationPopupController { |
| 42 public: | 45 public: |
| 43 // Create a controller or return |previous| if it is suitable. Will hide | 46 // Create a controller or return |previous| if it is suitable. Will hide |
| 44 // |previous| if it is not returned. |bounds| is the bounds of the element | 47 // |previous| if it is not returned. |bounds| is the bounds of the element |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // PasswordGenerationPopupController implementation: | 94 // PasswordGenerationPopupController implementation: |
| 92 void Hide() override; | 95 void Hide() override; |
| 93 void ViewDestroyed() override; | 96 void ViewDestroyed() override; |
| 94 void SetSelectionAtPoint(const gfx::Point& point) override; | 97 void SetSelectionAtPoint(const gfx::Point& point) override; |
| 95 bool AcceptSelectedLine() override; | 98 bool AcceptSelectedLine() override; |
| 96 void SelectionCleared() override; | 99 void SelectionCleared() override; |
| 97 void PasswordAccepted() override; | 100 void PasswordAccepted() override; |
| 98 void OnSavedPasswordsLinkClicked() override; | 101 void OnSavedPasswordsLinkClicked() override; |
| 99 int GetMinimumWidth() override; | 102 int GetMinimumWidth() override; |
| 100 gfx::NativeView container_view() override; | 103 gfx::NativeView container_view() override; |
| 101 const gfx::Rect& popup_bounds() const override; | 104 gfx::Rect popup_bounds() const override; |
| 102 const gfx::RectF& element_bounds() const override; | 105 const gfx::RectF& element_bounds() const override; |
| 103 bool IsRTL() const override; | 106 bool IsRTL() const override; |
| 107 const std::vector<autofill::Suggestion> GetSuggestions() override; |
| 108 #if !defined(OS_ANDROID) |
| 109 int GetElidedValueWidthForRow(size_t row) override; |
| 110 int GetElidedLabelWidthForRow(size_t row) override; |
| 111 #endif |
| 112 |
| 104 bool display_password() const override; | 113 bool display_password() const override; |
| 105 bool password_selected() const override; | 114 bool password_selected() const override; |
| 106 base::string16 password() const override; | 115 base::string16 password() const override; |
| 107 base::string16 SuggestedText() override; | 116 base::string16 SuggestedText() override; |
| 108 const base::string16& HelpText() override; | 117 const base::string16& HelpText() override; |
| 109 const gfx::Range& HelpTextLinkRange() override; | 118 const gfx::Range& HelpTextLinkRange() override; |
| 110 | 119 |
| 111 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); | 120 base::WeakPtr<PasswordGenerationPopupControllerImpl> GetWeakPtr(); |
| 112 | 121 |
| 113 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event); | 122 bool HandleKeyPressEvent(const content::NativeWebKeyboardEvent& event); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 142 | 151 |
| 143 base::string16 current_password_; | 152 base::string16 current_password_; |
| 144 bool password_selected_; | 153 bool password_selected_; |
| 145 | 154 |
| 146 // If a password will be shown in this popup. | 155 // If a password will be shown in this popup. |
| 147 bool display_password_; | 156 bool display_password_; |
| 148 | 157 |
| 149 // Bounds for all the elements of the popup. | 158 // Bounds for all the elements of the popup. |
| 150 gfx::Rect popup_bounds_; | 159 gfx::Rect popup_bounds_; |
| 151 | 160 |
| 161 PopupViewCommon view_common_; |
| 162 |
| 152 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_; | 163 base::WeakPtrFactory<PasswordGenerationPopupControllerImpl> weak_ptr_factory_; |
| 153 | 164 |
| 154 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl); | 165 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupControllerImpl); |
| 155 }; | 166 }; |
| 156 | 167 |
| 157 } // namespace autofill | 168 } // namespace autofill |
| 158 | 169 |
| 159 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_
H_ | 170 #endif // CHROME_BROWSER_UI_AUTOFILL_PASSWORD_GENERATION_POPUP_CONTROLLER_IMPL_
H_ |
| OLD | NEW |