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_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
11 #include "chrome/browser/autofill/password_generator.h" | 11 #include "base/basictypes.h" |
12 #include "ui/base/gtk/gtk_signal.h" | 12 #include "ui/base/gtk/gtk_signal.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 #include "webkit/forms/password_form.h" | 14 #include "webkit/forms/password_form.h" |
15 | 15 |
| 16 namespace autofill { |
| 17 class PasswordGenerator; |
| 18 } |
| 19 |
16 namespace content { | 20 namespace content { |
17 class RenderViewHost; | 21 class RenderViewHost; |
18 } | 22 } |
19 | 23 |
20 class BubbleGtk; | 24 class BubbleGtk; |
21 class PasswordManager; | 25 class PasswordManager; |
22 class Profile; | 26 class Profile; |
23 | 27 |
24 // PasswordGenerationBubbleGtk is a bubble use to show possible generated | 28 // PasswordGenerationBubbleGtk is a bubble use to show possible generated |
25 // passwords to users. It is set in page content, anchored at |anchor_rect|. | 29 // passwords to users. It is set in page content, anchored at |anchor_rect|. |
26 // If the generated password is accepted by the user, the renderer associated | 30 // If the generated password is accepted by the user, the renderer associated |
27 // with |render_view_host| and the |password_manager| are informed. | 31 // with |render_view_host| and the |password_manager| are informed. |
28 class PasswordGenerationBubbleGtk { | 32 class PasswordGenerationBubbleGtk { |
29 public: | 33 public: |
30 PasswordGenerationBubbleGtk(const gfx::Rect& anchor_rect, | 34 PasswordGenerationBubbleGtk(const gfx::Rect& anchor_rect, |
31 const webkit::forms::PasswordForm& form, | 35 const webkit::forms::PasswordForm& form, |
32 GtkWidget* anchor_widget, | 36 GtkWidget* anchor_widget, |
33 Profile* profile, | 37 Profile* profile, |
34 content::RenderViewHost* render_view_host, | 38 content::RenderViewHost* render_view_host, |
| 39 autofill::PasswordGenerator* password_generator, |
35 PasswordManager* password_manager); | 40 PasswordManager* password_manager); |
36 virtual ~PasswordGenerationBubbleGtk(); | 41 virtual ~PasswordGenerationBubbleGtk(); |
37 | 42 |
38 private: | 43 private: |
39 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnDestroy); | 44 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnDestroy); |
40 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnAcceptClicked); | 45 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnAcceptClicked); |
41 CHROMEG_CALLBACK_0( | 46 CHROMEG_CALLBACK_0( |
42 PasswordGenerationBubbleGtk, void, OnLearnMoreLinkClicked, GtkButton*); | 47 PasswordGenerationBubbleGtk, void, OnLearnMoreLinkClicked, GtkButton*); |
43 | 48 |
44 BubbleGtk* bubble_; | 49 BubbleGtk* bubble_; |
45 GtkWidget* text_field_; | 50 GtkWidget* text_field_; |
46 Profile* profile_; | 51 Profile* profile_; |
47 | 52 |
48 // Form that contains the password field that we are generating a password | 53 // Form that contains the password field that we are generating a password |
49 // for. Used by the password_manager_. | 54 // for. Used by the password_manager_. |
50 webkit::forms::PasswordForm form_; | 55 webkit::forms::PasswordForm form_; |
51 | 56 |
52 // RenderViewHost associated with the button that spawned this bubble. | 57 // RenderViewHost associated with the button that spawned this bubble. |
53 content::RenderViewHost* render_view_host_; | 58 content::RenderViewHost* render_view_host_; |
54 | 59 |
| 60 // Object that deals with generating passwords. The class won't take the |
| 61 // ownership of it. |
| 62 autofill::PasswordGenerator* password_generator_; |
| 63 |
55 // PasswordManager for this tab. | 64 // PasswordManager for this tab. |
56 PasswordManager* password_manager_; | 65 PasswordManager* password_manager_; |
57 | 66 |
58 // Class that deals with generating passwords. | |
59 autofill::PasswordGenerator password_generator_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleGtk); | 67 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleGtk); |
62 }; | 68 }; |
63 | 69 |
64 #endif // CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ | 70 #endif // CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ |
OLD | NEW |