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"
20 class PasswordGenerationPopupController
;
22 class PasswordGenerationPopupViewViews
: public AutofillPopupBaseView
,
23 public PasswordGenerationPopupView
,
24 public views::StyledLabelListener
{
26 PasswordGenerationPopupViewViews(
27 PasswordGenerationPopupController
* controller
,
28 views::FocusManager
* focus_manager
);
30 // PasswordGenerationPopupView implementation
33 gfx::Size
GetPreferredSizeOfPasswordView() override
;
34 void UpdateBoundsAndRedrawPopup() override
;
35 void PasswordSelectionUpdated() override
;
36 bool IsPointInPasswordBounds(const gfx::Point
& point
) override
;
39 // Helper class to do layout of the password portion of the popup.
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_
;
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_