Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / views / autofill / password_generation_popup_view_views.h
blob54e3e1f7f880dbd8ab4c970755d967c60ccd032e
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_VIEWS_H_
8 #include "chrome/browser/ui/autofill/password_generation_popup_view.h"
9 #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h"
10 #include "ui/gfx/font_list.h"
11 #include "ui/views/controls/styled_label_listener.h"
13 namespace views {
14 class StyledLabel;
15 class View;
18 namespace autofill {
20 class PasswordGenerationPopupController;
22 class PasswordGenerationPopupViewViews : public AutofillPopupBaseView,
23 public PasswordGenerationPopupView,
24 public views::StyledLabelListener {
25 public:
26 PasswordGenerationPopupViewViews(
27 PasswordGenerationPopupController* controller,
28 views::Widget* parent_widget);
30 // PasswordGenerationPopupView implementation
31 void Show() override;
32 void Hide() override;
33 gfx::Size GetPreferredSizeOfPasswordView() override;
34 void UpdateBoundsAndRedrawPopup() override;
35 void PasswordSelectionUpdated() override;
36 bool IsPointInPasswordBounds(const gfx::Point& point) override;
38 private:
39 // Helper class to do layout of the password portion of the popup.
40 class PasswordBox;
42 ~PasswordGenerationPopupViewViews() override;
44 // Helper function to create |password_view_|.
45 void CreatePasswordView();
47 // views:Views implementation.
48 void Layout() override;
49 void OnPaint(gfx::Canvas* canvas) override;
50 void GetAccessibleState(ui::AXViewState* state) override;
52 // views::StyledLabelListener implementation
53 void StyledLabelLinkClicked(const gfx::Range& range,
54 int event_flags) override;
56 // Sub views. Used to change bounds when updating. Weak references.
57 PasswordBox* password_view_;
58 views::StyledLabel* help_label_;
60 // Fonts to use.
61 gfx::FontList font_list_;
63 // Size of the divider between the password and the help text.
64 gfx::Rect divider_bounds_;
66 // Controller for this view. Weak reference.
67 PasswordGenerationPopupController* controller_;
69 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupViewViews);
72 } // namespace autofill
74 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_VIEWS_H_