OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "chrome/browser/ui/views/managed_full_screen_bubble_delegate_view.h" |
10 #include "content/public/browser/notification_registrar.h" | |
11 #include "ui/views/bubble/bubble_delegate.h" | |
12 | 10 |
13 class ManagePasswordsIconView; | 11 class ManagePasswordsIconView; |
14 | 12 |
15 namespace content { | 13 namespace content { |
16 class WebContents; | 14 class WebContents; |
17 } | 15 } |
18 | 16 |
19 // The ManagePasswordsBubbleView controls the contents of the bubble which | 17 // The ManagePasswordsBubbleView controls the contents of the bubble which |
20 // pops up when Chrome offers to save a user's password, or when the user | 18 // pops up when Chrome offers to save a user's password, or when the user |
21 // interacts with the Omnibox icon. It has two distinct states: | 19 // interacts with the Omnibox icon. It has two distinct states: |
22 // | 20 // |
23 // 1. PendingView: Offers the user the possibility of saving credentials. | 21 // 1. PendingView: Offers the user the possibility of saving credentials. |
24 // 2. ManageView: Displays the current page's saved credentials. | 22 // 2. ManageView: Displays the current page's saved credentials. |
25 // 3. BlacklistedView: Informs the user that the current page is blacklisted. | 23 // 3. BlacklistedView: Informs the user that the current page is blacklisted. |
26 // | 24 // |
27 class ManagePasswordsBubbleView : public ManagePasswordsBubble, | 25 class ManagePasswordsBubbleView : public ManagePasswordsBubble, |
28 public views::BubbleDelegateView, | 26 public ManagedFullScreenBubbleDelegateView { |
29 public content::NotificationObserver { | |
30 public: | 27 public: |
31 // Shows the bubble. | 28 // Shows the bubble. |
32 static void ShowBubble(content::WebContents* web_contents, | 29 static void ShowBubble(content::WebContents* web_contents, |
33 DisplayReason reason); | 30 DisplayReason reason); |
34 | 31 |
35 // Closes the existing bubble. | 32 // Closes the existing bubble. |
36 static void CloseBubble(); | 33 static void CloseBubble(); |
37 | 34 |
38 // Makes the bubble the foreground window. | 35 // Makes the bubble the foreground window. |
39 static void ActivateBubble(); | 36 static void ActivateBubble(); |
(...skipping 20 matching lines...) Expand all Loading... | |
60 class ManageView; | 57 class ManageView; |
61 class PendingView; | 58 class PendingView; |
62 class SaveConfirmationView; | 59 class SaveConfirmationView; |
63 class SetupOSPasswordView; | 60 class SetupOSPasswordView; |
64 | 61 |
65 ManagePasswordsBubbleView(content::WebContents* web_contents, | 62 ManagePasswordsBubbleView(content::WebContents* web_contents, |
66 ManagePasswordsIconView* anchor_view, | 63 ManagePasswordsIconView* anchor_view, |
67 DisplayReason reason); | 64 DisplayReason reason); |
68 ~ManagePasswordsBubbleView() override; | 65 ~ManagePasswordsBubbleView() override; |
69 | 66 |
70 // If the bubble is not anchored to a view, places the bubble in the top | 67 // ManagedFullScreenBubbleDelegateView: |
Peter Kasting
2014/12/19 22:11:36
See earlier comments regarding override order.
Pritam Nikam
2014/12/22 08:19:10
Done.
| |
71 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s | 68 void Close() override; |
72 // browser window. Because the positioning is based on the size of the | |
73 // bubble, this must be called after the bubble is created. | |
74 void AdjustForFullscreen(const gfx::Rect& screen_bounds); | |
75 | |
76 // Close the bubble. | |
77 void Close(); | |
78 | 69 |
79 // Refreshes the bubble's state: called to display a confirmation screen after | 70 // Refreshes the bubble's state: called to display a confirmation screen after |
80 // a user selects "Never for this site", for instance. | 71 // a user selects "Never for this site", for instance. |
81 void Refresh(); | 72 void Refresh(); |
82 | 73 |
83 // Called from PendingView if the user clicks on "Never for this site" in | 74 // Called from PendingView if the user clicks on "Never for this site" in |
84 // order to display a confirmation screen. | 75 // order to display a confirmation screen. |
85 void NotifyNeverForThisSiteClicked(); | 76 void NotifyNeverForThisSiteClicked(); |
86 | 77 |
87 // Called from ConfirmNeverView if the user confirms her intention to never | 78 // Called from ConfirmNeverView if the user confirms her intention to never |
88 // save passwords, and remove existing passwords, for a site. | 79 // save passwords, and remove existing passwords, for a site. |
89 void NotifyConfirmedNeverForThisSite(); | 80 void NotifyConfirmedNeverForThisSite(); |
90 | 81 |
91 // Called from ConfirmNeverView if the user clicks on "Undo" in order to | 82 // Called from ConfirmNeverView if the user clicks on "Undo" in order to |
92 // undo the action and refresh to PendingView. | 83 // undo the action and refresh to PendingView. |
93 void NotifyUndoNeverForThisSite(); | 84 void NotifyUndoNeverForThisSite(); |
94 | 85 |
95 // views::BubbleDelegateView: | 86 // views::BubbleDelegateView: |
96 void Init() override; | 87 void Init() override; |
97 void WindowClosing() override; | 88 void WindowClosing() override; |
98 | 89 |
99 // views::WidgetDelegate: | 90 // views::WidgetDelegate: |
100 views::View* GetInitiallyFocusedView() override; | 91 views::View* GetInitiallyFocusedView() override; |
101 | 92 |
102 // content::NotificationObserver: | |
103 void Observe(int type, | |
104 const content::NotificationSource& source, | |
105 const content::NotificationDetails& details) override; | |
106 | |
107 void set_initially_focused_view(views::View* view) { | 93 void set_initially_focused_view(views::View* view) { |
108 DCHECK(!initially_focused_view_); | 94 DCHECK(!initially_focused_view_); |
109 initially_focused_view_ = view; | 95 initially_focused_view_ = view; |
110 } | 96 } |
111 | 97 |
112 // Singleton instance of the Password bubble. The Password bubble can only be | 98 // Singleton instance of the Password bubble. The Password bubble can only be |
113 // shown on the active browser window, so there is no case in which it will be | 99 // shown on the active browser window, so there is no case in which it will be |
114 // shown twice at the same time. The instance is owned by the Bubble and will | 100 // shown twice at the same time. The instance is owned by the Bubble and will |
115 // be deleted when the bubble closes. | 101 // be deleted when the bubble closes. |
116 static ManagePasswordsBubbleView* manage_passwords_bubble_; | 102 static ManagePasswordsBubbleView* manage_passwords_bubble_; |
117 | 103 |
118 ManagePasswordsIconView* anchor_view_; | 104 ManagePasswordsIconView* anchor_view_; |
119 | 105 |
120 views::View* initially_focused_view_; | 106 views::View* initially_focused_view_; |
121 | 107 |
122 // A helper to intercept mouse click events on the web contents. | 108 // A helper to intercept mouse click events on the web contents. |
123 class WebContentMouseHandler; | 109 class WebContentMouseHandler; |
124 scoped_ptr<WebContentMouseHandler> mouse_handler_; | 110 scoped_ptr<WebContentMouseHandler> mouse_handler_; |
125 | 111 |
126 // Used to register for fullscreen change notifications. | |
127 content::NotificationRegistrar registrar_; | |
128 | |
129 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 112 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
130 }; | 113 }; |
131 | 114 |
132 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 115 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
OLD | NEW |