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 // Whether the bubble is currently showing.
39 static bool IsShowing();
41 // Returns a pointer to the bubble.
42 static const ManagePasswordsBubbleView
* manage_password_bubble() {
43 return manage_passwords_bubble_
;
46 content::WebContents
* web_contents() const;
48 const View
* initially_focused_view() const {
49 return initially_focused_view_
;
53 class AccountChooserView
;
55 class BlacklistedView
;
56 class ConfirmNeverView
;
58 class ManageAccountsView
;
60 class SaveConfirmationView
;
61 class WebContentMouseHandler
;
63 ManagePasswordsBubbleView(content::WebContents
* web_contents
,
64 ManagePasswordsIconView
* anchor_view
,
65 DisplayReason reason
);
66 ~ManagePasswordsBubbleView() override
;
68 // ManagedFullScreenBubbleDelegateView:
69 views::View
* GetInitiallyFocusedView() override
;
71 void Close() override
;
74 void OnWidgetClosing(views::Widget
* widget
) override
;
76 // Refreshes the bubble's state: called to display a confirmation screen after
77 // a user selects "Never for this site", for instance.
80 // Called from PendingView if the user clicks on "Never for this site" in
81 // order to display a confirmation screen.
82 void NotifyNeverForThisSiteClicked();
84 // Called from ConfirmNeverView if the user confirms her intention to never
85 // save passwords, and remove existing passwords, for a site.
86 void NotifyConfirmedNeverForThisSite();
88 // Called from ConfirmNeverView if the user clicks on "Undo" in order to
89 // undo the action and refresh to PendingView.
90 void NotifyUndoNeverForThisSite();
92 void set_initially_focused_view(views::View
* view
) {
93 DCHECK(!initially_focused_view_
);
94 initially_focused_view_
= view
;
97 // Singleton instance of the Password bubble. The Password bubble can only be
98 // shown on the active browser window, so there is no case in which it will be
99 // shown twice at the same time. The instance is owned by the Bubble and will
100 // be deleted when the bubble closes.
101 static ManagePasswordsBubbleView
* manage_passwords_bubble_
;
103 ManagePasswordsIconView
* anchor_view_
;
105 views::View
* initially_focused_view_
;
107 // A helper to intercept mouse click events on the web contents.
108 scoped_ptr
<WebContentMouseHandler
> mouse_handler_
;
110 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView
);
113 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_