Credential Manager API: add a new "Manage accounts" bubble.
[chromium-blink-merge.git] / chrome / browser / ui / views / passwords / manage_passwords_bubble_view.h
blob00dbccac989b3bdc26488a5d326df26b2640dedc
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;
13 namespace content {
14 class WebContents;
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 {
27 public:
28 // Shows the bubble.
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_;
52 private:
53 class AskUserToSubmitURLView;
54 class AccountChooserView;
55 class AutoSigninView;
56 class BlacklistedView;
57 class ConfirmNeverView;
58 class ManageView;
59 class ManageAccountsView;
60 class PendingView;
61 class SaveConfirmationView;
62 class WebContentMouseHandler;
64 ManagePasswordsBubbleView(content::WebContents* web_contents,
65 ManagePasswordsIconView* anchor_view,
66 DisplayReason reason);
67 ~ManagePasswordsBubbleView() override;
69 // ManagedFullScreenBubbleDelegateView:
70 views::View* GetInitiallyFocusedView() override;
71 void Init() override;
72 void WindowClosing() override;
73 void Close() override;
75 // Refreshes the bubble's state: called to display a confirmation screen after
76 // a user selects "Never for this site", for instance.
77 void Refresh();
79 // Called from PendingView if the user clicks on "Never for this site" in
80 // order to display a confirmation screen.
81 void NotifyNeverForThisSiteClicked();
83 // Called from ConfirmNeverView if the user confirms her intention to never
84 // save passwords, and remove existing passwords, for a site.
85 void NotifyConfirmedNeverForThisSite();
87 // Called from ConfirmNeverView if the user clicks on "Undo" in order to
88 // undo the action and refresh to PendingView.
89 void NotifyUndoNeverForThisSite();
91 void set_initially_focused_view(views::View* view) {
92 DCHECK(!initially_focused_view_);
93 initially_focused_view_ = view;
96 // Singleton instance of the Password bubble. The Password bubble can only be
97 // shown on the active browser window, so there is no case in which it will be
98 // shown twice at the same time. The instance is owned by the Bubble and will
99 // be deleted when the bubble closes.
100 static ManagePasswordsBubbleView* manage_passwords_bubble_;
102 ManagePasswordsIconView* anchor_view_;
104 views::View* initially_focused_view_;
106 // A helper to intercept mouse click events on the web contents.
107 scoped_ptr<WebContentMouseHandler> mouse_handler_;
109 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView);
112 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_