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 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 12 #include "components/autofill/core/common/password_form.h" |
12 #include "components/autofill/core/common/password_generation_util.h" | 13 #include "components/autofill/core/common/password_generation_util.h" |
13 #include "content/public/common/password_form.h" | |
14 #include "ui/base/gtk/gtk_signal.h" | 14 #include "ui/base/gtk/gtk_signal.h" |
15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.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 WebContents; | 22 class WebContents; |
23 } | 23 } |
24 | 24 |
25 // PasswordGenerationBubbleGtk is a bubble use to show possible generated | 25 // PasswordGenerationBubbleGtk is a bubble use to show possible generated |
26 // passwords to users. It is set in page content, anchored at |anchor_rect|. | 26 // passwords to users. It is set in page content, anchored at |anchor_rect|. |
27 // If the generated password is accepted by the user, the renderer associated | 27 // If the generated password is accepted by the user, the renderer associated |
28 // with |render_view_host| and the |password_manager| are informed. | 28 // with |render_view_host| and the |password_manager| are informed. |
29 class PasswordGenerationBubbleGtk : public BubbleDelegateGtk { | 29 class PasswordGenerationBubbleGtk : public BubbleDelegateGtk { |
30 public: | 30 public: |
31 PasswordGenerationBubbleGtk(const gfx::Rect& anchor_rect, | 31 PasswordGenerationBubbleGtk(const gfx::Rect& anchor_rect, |
32 const content::PasswordForm& form, | 32 const autofill::PasswordForm& form, |
33 content::WebContents* web_contents, | 33 content::WebContents* web_contents, |
34 autofill::PasswordGenerator* password_generator); | 34 autofill::PasswordGenerator* password_generator); |
35 virtual ~PasswordGenerationBubbleGtk(); | 35 virtual ~PasswordGenerationBubbleGtk(); |
36 | 36 |
37 // Overridden from BubbleDelegateGtk: | 37 // Overridden from BubbleDelegateGtk: |
38 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | 38 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; |
39 | 39 |
40 private: | 40 private: |
41 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnDestroy); | 41 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnDestroy); |
42 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnAcceptClicked); | 42 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnAcceptClicked); |
43 CHROMEGTK_CALLBACK_2(PasswordGenerationBubbleGtk, void, OnRegenerateClicked, | 43 CHROMEGTK_CALLBACK_2(PasswordGenerationBubbleGtk, void, OnRegenerateClicked, |
44 GtkEntryIconPosition, GdkEvent*); | 44 GtkEntryIconPosition, GdkEvent*); |
45 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnPasswordEdited); | 45 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnPasswordEdited); |
46 CHROMEG_CALLBACK_0( | 46 CHROMEG_CALLBACK_0( |
47 PasswordGenerationBubbleGtk, void, OnLearnMoreLinkClicked, GtkButton*); | 47 PasswordGenerationBubbleGtk, void, OnLearnMoreLinkClicked, GtkButton*); |
48 | 48 |
49 BubbleGtk* bubble_; | 49 BubbleGtk* bubble_; |
50 GtkWidget* text_field_; | 50 GtkWidget* text_field_; |
51 | 51 |
52 // Form that contains the password field that we are generating a password | 52 // Form that contains the password field that we are generating a password |
53 // for. Used by the password_manager_. | 53 // for. Used by the password_manager_. |
54 content::PasswordForm form_; | 54 autofill::PasswordForm form_; |
55 | 55 |
56 // WebContents associated with the button that spawned this bubble. | 56 // WebContents associated with the button that spawned this bubble. |
57 content::WebContents* web_contents_; | 57 content::WebContents* web_contents_; |
58 | 58 |
59 // Object that deals with generating passwords. The class won't take the | 59 // Object that deals with generating passwords. The class won't take the |
60 // ownership of it. | 60 // ownership of it. |
61 autofill::PasswordGenerator* password_generator_; | 61 autofill::PasswordGenerator* password_generator_; |
62 | 62 |
63 // Store various status of the current living bubble. | 63 // Store various status of the current living bubble. |
64 autofill::password_generation::PasswordGenerationActions actions_; | 64 autofill::password_generation::PasswordGenerationActions actions_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleGtk); | 66 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleGtk); |
67 }; | 67 }; |
68 | 68 |
69 #endif // CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ | 69 #endif // CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ |
OLD | NEW |