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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_
10 #include "base/basictypes.h"
11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
12 #include "components/autofill/core/common/password_form.h"
13 #include "components/autofill/core/common/password_generation_util.h"
14 #include "ui/base/gtk/gtk_signal.h"
15 #include "ui/gfx/rect.h"
18 class PasswordGenerator
;
25 // PasswordGenerationBubbleGtk is a bubble use to show possible generated
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
28 // with |render_view_host| and the |password_manager| are informed.
29 class PasswordGenerationBubbleGtk
: public BubbleDelegateGtk
{
31 PasswordGenerationBubbleGtk(const gfx::Rect
& anchor_rect
,
32 const autofill::PasswordForm
& form
,
33 content::WebContents
* web_contents
,
34 autofill::PasswordGenerator
* password_generator
);
35 virtual ~PasswordGenerationBubbleGtk();
37 // Overridden from BubbleDelegateGtk:
38 virtual void BubbleClosing(BubbleGtk
* bubble
, bool closed_by_escape
) OVERRIDE
;
41 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk
, void, OnDestroy
);
42 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk
, void, OnAcceptClicked
);
43 CHROMEGTK_CALLBACK_2(PasswordGenerationBubbleGtk
, void, OnRegenerateClicked
,
44 GtkEntryIconPosition
, GdkEvent
*);
45 CHROMEGTK_CALLBACK_0(PasswordGenerationBubbleGtk
, void, OnPasswordEdited
);
47 PasswordGenerationBubbleGtk
, void, OnLearnMoreLinkClicked
, GtkButton
*);
50 GtkWidget
* text_field_
;
52 // Form that contains the password field that we are generating a password
53 // for. Used by the password_manager_.
54 autofill::PasswordForm form_
;
56 // WebContents associated with the button that spawned this bubble.
57 content::WebContents
* web_contents_
;
59 // Object that deals with generating passwords. The class won't take the
61 autofill::PasswordGenerator
* password_generator_
;
63 // Store various status of the current living bubble.
64 autofill::password_generation::PasswordGenerationActions actions_
;
66 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleGtk
);
69 #endif // CHROME_BROWSER_UI_GTK_PASSWORD_GENERATION_BUBBLE_GTK_H_