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 "base/memory/scoped_ptr.h" | |
12 #include "ui/base/gtk/gtk_signal.h" | 13 #include "ui/base/gtk/gtk_signal.h" |
13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
14 | 15 |
16 namespace autofill { | |
17 class PasswordGenerator; | |
18 } | |
19 | |
15 namespace content { | 20 namespace content { |
16 class RenderViewHost; | 21 class RenderViewHost; |
17 } | 22 } |
18 | 23 |
19 class BubbleGtk; | 24 class BubbleGtk; |
20 class Profile; | 25 class Profile; |
21 | 26 |
22 // PasswordGenerationBubbleGtk is a bubble use to show possible generated | 27 // PasswordGenerationBubbleGtk is a bubble use to show possible generated |
23 // passwords to users. It is set in page content, anchored at |anchor_rect|. | 28 // passwords to users. It is set in page content, anchored at |anchor_rect|. |
24 // If the generated password is accepted by the user, the renderer associated | 29 // If the generated password is accepted by the user, the renderer associated |
25 // with |render_view_host| is informed of this password. | 30 // with |render_view_host| is informed of this password. |
26 class PasswordGenerationBubbleGtk { | 31 class PasswordGenerationBubbleGtk { |
27 public: | 32 public: |
28 PasswordGenerationBubbleGtk(const gfx::Rect& anchor_rect, | 33 PasswordGenerationBubbleGtk(const gfx::Rect& anchor_rect, |
29 GtkWidget* anchor_widget, | 34 GtkWidget* anchor_widget, |
30 Profile* profile, | 35 Profile* profile, |
31 content::RenderViewHost* render_view_host); | 36 content::RenderViewHost* render_view_host, |
37 autofill::PasswordGenerator* password_generator); | |
32 virtual ~PasswordGenerationBubbleGtk(); | 38 virtual ~PasswordGenerationBubbleGtk(); |
33 | 39 |
34 private: | 40 private: |
35 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnDestroy); | 41 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnDestroy); |
36 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnAcceptClicked); | 42 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk, void, OnAcceptClicked); |
37 CHROMEG_CALLBACK_0( | 43 CHROMEG_CALLBACK_0( |
38 PasswordGenerationBubbleGtk, void, OnLearnMoreLinkClicked, GtkButton*); | 44 PasswordGenerationBubbleGtk, void, OnLearnMoreLinkClicked, GtkButton*); |
39 | 45 |
40 BubbleGtk* bubble_; | 46 BubbleGtk* bubble_; |
41 GtkWidget* text_field_; | 47 GtkWidget* text_field_; |
42 Profile* profile_; | 48 Profile* profile_; |
43 | 49 |
44 // RenderViewHost associated with the button that spawned this bubble. | 50 // RenderViewHost associated with the button that spawned this bubble. |
45 content::RenderViewHost* render_view_host_; | 51 content::RenderViewHost* render_view_host_; |
46 | 52 |
47 // Class that deals with generating passwords. | 53 // Object that deals with generating passwords. |
48 autofill::PasswordGenerator password_generator_; | 54 scoped_ptr<autofill::PasswordGenerator> password_generator_; |
Ilya Sherman
2012/06/04 22:49:15
If the AutofillManager owns this object, this shou
Garrett Casto
2012/06/04 22:58:57
Is a weak_ptr necessary, or does just a bare point
Ilya Sherman
2012/06/04 23:08:22
A bare pointer suffices. I didn't actually mean t
zysxqn
2012/06/04 23:17:19
Done.
| |
49 | 55 |
50 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleGtk); | 56 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleGtk); |
51 }; | 57 }; |
52 | 58 |
53 #endif // CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ | 59 #endif // CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_ |
OLD | NEW |