1 // Copyright 2013 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_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
8 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
9 #include "chrome/browser/ui/views/managed_full_screen_bubble_delegate_view.h"
11 class ManagePasswordsIconView
;
17 // The ManagePasswordsBubbleView controls the contents of the bubble which
18 // pops up when Chrome offers to save a user's password, or when the user
19 // interacts with the Omnibox icon. It has two distinct states:
21 // 1. PendingView: Offers the user the possibility of saving credentials.
22 // 2. ManageView: Displays the current page's saved credentials.
23 // 3. BlacklistedView: Informs the user that the current page is blacklisted.
25 class ManagePasswordsBubbleView
: public ManagePasswordsBubble
,
26 public ManagedFullScreenBubbleDelegateView
{
29 static void ShowBubble(content::WebContents
* web_contents
,
30 DisplayReason reason
);
32 // Closes the existing bubble.
33 static void CloseBubble();
35 // Makes the bubble the foreground window.
36 static void ActivateBubble();
38 // Returns a pointer to the bubble.
39 static ManagePasswordsBubbleView
* manage_password_bubble() {
40 return manage_passwords_bubble_
;
43 content::WebContents
* web_contents() const;
45 #if defined(UNIT_TEST)
46 const View
* initially_focused_view() const {
47 return initially_focused_view_
;
50 static void set_auto_signin_toast_timeout(int seconds
) {
51 auto_signin_toast_timeout_
= seconds
;
56 class AccountChooserView
;
58 class BlacklistedView
;
61 class SaveConfirmationView
;
62 class UpdatePendingView
;
63 class WebContentMouseHandler
;
65 ManagePasswordsBubbleView(content::WebContents
* web_contents
,
66 ManagePasswordsIconView
* anchor_view
,
67 DisplayReason reason
);
68 ~ManagePasswordsBubbleView() override
;
70 // ManagedFullScreenBubbleDelegateView:
71 views::View
* GetInitiallyFocusedView() override
;
73 void Close() override
;
76 void OnWidgetClosing(views::Widget
* widget
) override
;
79 bool ShouldShowCloseButton() const override
;
81 // Refreshes the bubble's state: called to display a confirmation screen after
82 // a user selects "Never for this site", for instance.
85 void set_initially_focused_view(views::View
* view
) {
86 DCHECK(!initially_focused_view_
);
87 initially_focused_view_
= view
;
90 // Singleton instance of the Password bubble. The Password bubble can only be
91 // shown on the active browser window, so there is no case in which it will be
92 // shown twice at the same time. The instance is owned by the Bubble and will
93 // be deleted when the bubble closes.
94 static ManagePasswordsBubbleView
* manage_passwords_bubble_
;
96 // The timeout in seconds for the auto sign-in toast.
97 static int auto_signin_toast_timeout_
;
99 ManagePasswordsIconView
* anchor_view_
;
101 views::View
* initially_focused_view_
;
103 // A helper to intercept mouse click events on the web contents.
104 scoped_ptr
<WebContentMouseHandler
> mouse_handler_
;
106 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView
);
109 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_