Move AutofillPopup from NativeWindow to WebContents (#12514)

This commit is contained in:
Cheng Zhao 2018-04-05 09:53:51 +09:00 committed by GitHub
parent 3a45d541f3
commit c75dd93b92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 123 additions and 126 deletions

View file

@ -18,22 +18,28 @@ namespace atom {
class AutofillPopupView;
class AutofillPopup {
class AutofillPopup : public views::ViewObserver {
public:
explicit AutofillPopup(gfx::NativeView);
AutofillPopup();
~AutofillPopup();
void CreateView(content::RenderFrameHost* render_frame,
bool offscreen, views::Widget* widget, const gfx::RectF& bounds);
bool offscreen,
views::View* parent,
const gfx::RectF& bounds);
void Hide();
void SetItems(const std::vector<base::string16>& values,
const std::vector<base::string16>& labels);
void UpdatePopupBounds(int height_compensation);
void UpdatePopupBounds();
private:
friend class AutofillPopupView;
// views::ViewObserver:
void OnViewBoundsChanged(views::View* view) override;
void OnViewIsDeleting(views::View* view) override;
void AcceptSuggestion(int index);
int GetDesiredPopupHeight();
@ -48,9 +54,6 @@ class AutofillPopup {
base::string16 GetLabelAt(int i);
int LineFromY(int y) const;
// The native view that contains this
gfx::NativeView container_view_;
int selected_index_;
// Popup location
@ -70,10 +73,13 @@ class AutofillPopup {
// For sending the accepted suggestion to the render frame that
// asked to open the popup
content::RenderFrameHost* frame_host_;
content::RenderFrameHost* frame_host_ = nullptr;
// The popup view. The lifetime is managed by the owning Widget
AutofillPopupView* view_;
AutofillPopupView* view_ = nullptr;
// The parent view that the popup view shows on. Weak ref.
views::View* parent_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(AutofillPopup);
};