OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
11 #include "ui/views/bubble/bubble_delegate.h" | 11 #include "ui/views/bubble/bubble_delegate.h" |
12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/controls/link_listener.h" | 13 #include "ui/views/controls/link_listener.h" |
14 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
15 #include "webkit/forms/password_form.h" | 15 #include "webkit/forms/password_form.h" |
16 | 16 |
17 namespace autofill { | 17 namespace autofill { |
18 class PasswordGenerator; | 18 class PasswordGenerator; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class PageNavigator; | 22 class PageNavigator; |
23 class RenderViewHost; | 23 class RenderViewHost; |
24 } | 24 } |
25 | 25 |
26 namespace views { | 26 namespace views { |
| 27 class ImageButton; |
27 class TextButton; | 28 class TextButton; |
28 class Textfield; | 29 class Textfield; |
29 } | 30 } |
30 | 31 |
31 class PasswordManager; | 32 class PasswordManager; |
32 | 33 |
33 // PasswordGenerationBubbleView is a bubble used to show possible generated | 34 // PasswordGenerationBubbleView is a bubble used to show possible generated |
34 // passwords to users. It is set in the page content, anchored at |anchor_rect|. | 35 // passwords to users. It is set in the page content, anchored at |anchor_rect|. |
35 // If the generated password is accepted by the user, the renderer associated | 36 // If the generated password is accepted by the user, the renderer associated |
36 // with |render_view_host| and the |password_manager| are informed. | 37 // with |render_view_host| and the |password_manager| are informed. |
37 class PasswordGenerationBubbleView : public views::BubbleDelegateView, | 38 class PasswordGenerationBubbleView : public views::BubbleDelegateView, |
38 public views::ButtonListener, | 39 public views::ButtonListener, |
39 public views::LinkListener { | 40 public views::LinkListener { |
40 public: | 41 public: |
41 PasswordGenerationBubbleView(const gfx::Rect& anchor_rect, | 42 PasswordGenerationBubbleView(const gfx::Rect& anchor_rect, |
42 const webkit::forms::PasswordForm& form, | 43 const webkit::forms::PasswordForm& form, |
43 views::View* anchor_view, | 44 views::View* anchor_view, |
44 content::RenderViewHost* render_view_host, | 45 content::RenderViewHost* render_view_host, |
45 autofill::PasswordGenerator* password_generator, | 46 autofill::PasswordGenerator* password_generator, |
46 content::PageNavigator* navigator, | 47 content::PageNavigator* navigator, |
47 PasswordManager* password_manager); | 48 PasswordManager* password_manager, |
| 49 ui::ThemeProvider* theme_provider); |
48 virtual ~PasswordGenerationBubbleView(); | 50 virtual ~PasswordGenerationBubbleView(); |
49 | 51 |
50 private: | 52 private: |
51 // views::BubbleDelegateView | 53 // views::BubbleDelegateView |
52 virtual void Init() OVERRIDE; | 54 virtual void Init() OVERRIDE; |
53 virtual gfx::Rect GetAnchorRect() OVERRIDE; | 55 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
54 | 56 |
55 // views::ButtonListener | 57 // views::ButtonListener |
56 virtual void ButtonPressed(views::Button* sender, | 58 virtual void ButtonPressed(views::Button* sender, |
57 const views::Event& event) OVERRIDE; | 59 const views::Event& event) OVERRIDE; |
58 | 60 |
59 // views::LinkListener | 61 // views::LinkListener |
60 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 62 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
61 | 63 |
62 // views::WidgetDelegate | 64 // views::WidgetDelegate |
63 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 65 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
64 | 66 |
65 // Subviews | 67 // Subviews |
66 views::TextButton* accept_button_; | 68 views::TextButton* accept_button_; |
| 69 views::ImageButton* regenerate_button_; |
67 views::Textfield* text_field_; | 70 views::Textfield* text_field_; |
68 | 71 |
69 // Location that the bubble points to | 72 // Location that the bubble points to |
70 gfx::Rect anchor_rect_; | 73 gfx::Rect anchor_rect_; |
71 | 74 |
72 // The form associated with the password field(s) that we are generated. | 75 // The form associated with the password field(s) that we are generated. |
73 webkit::forms::PasswordForm form_; | 76 webkit::forms::PasswordForm form_; |
74 | 77 |
75 // RenderViewHost associated with the button that spawned this bubble. | 78 // RenderViewHost associated with the button that spawned this bubble. |
76 content::RenderViewHost* render_view_host_; | 79 content::RenderViewHost* render_view_host_; |
77 | 80 |
78 // Object to generate passwords. The class won't take the ownership of it. | 81 // Object to generate passwords. The class won't take the ownership of it. |
79 autofill::PasswordGenerator* password_generator_; | 82 autofill::PasswordGenerator* password_generator_; |
80 | 83 |
81 // An object used to handle page loads that originate from link clicks | 84 // An object used to handle page loads that originate from link clicks |
82 // within this UI. | 85 // within this UI. |
83 content::PageNavigator* navigator_; | 86 content::PageNavigator* navigator_; |
84 | 87 |
85 // PasswordManager associated with this tab. | 88 // PasswordManager associated with this tab. |
86 PasswordManager* password_manager_; | 89 PasswordManager* password_manager_; |
87 | 90 |
| 91 // Theme provider used to draw the regenerate button. |
| 92 ui::ThemeProvider* theme_provider_; |
| 93 |
88 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleView); | 94 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleView); |
89 }; | 95 }; |
90 | 96 |
91 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ | 97 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ |
OLD | NEW |