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 // views::WidgetDelegate: |
Peter Kasting
2014/12/23 00:49:03
Same comments regarding override groups.
Pritam Nikam
2014/12/23 06:22:29
Done.
| |
71 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s | 68 views::View* GetInitiallyFocusedView() 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 | 69 |
76 // Close the bubble. | 70 // views::BubbleDelegateView: |
77 void Close(); | 71 void Init() override; |
72 void WindowClosing() override; | |
73 | |
74 // ManagedFullScreenBubbleDelegateView: | |
75 using ManagedFullScreenBubbleDelegateView::AdjustForFullscreen; | |
Peter Kasting
2014/12/23 00:49:03
Again, don't do this.
Pritam Nikam
2014/12/23 06:22:29
Done.
| |
76 void Close() override; | |
78 | 77 |
79 // Refreshes the bubble's state: called to display a confirmation screen after | 78 // Refreshes the bubble's state: called to display a confirmation screen after |
80 // a user selects "Never for this site", for instance. | 79 // a user selects "Never for this site", for instance. |
81 void Refresh(); | 80 void Refresh(); |
82 | 81 |
83 // Called from PendingView if the user clicks on "Never for this site" in | 82 // Called from PendingView if the user clicks on "Never for this site" in |
84 // order to display a confirmation screen. | 83 // order to display a confirmation screen. |
85 void NotifyNeverForThisSiteClicked(); | 84 void NotifyNeverForThisSiteClicked(); |
86 | 85 |
87 // Called from ConfirmNeverView if the user confirms her intention to never | 86 // Called from ConfirmNeverView if the user confirms her intention to never |
88 // save passwords, and remove existing passwords, for a site. | 87 // save passwords, and remove existing passwords, for a site. |
89 void NotifyConfirmedNeverForThisSite(); | 88 void NotifyConfirmedNeverForThisSite(); |
90 | 89 |
91 // Called from ConfirmNeverView if the user clicks on "Undo" in order to | 90 // Called from ConfirmNeverView if the user clicks on "Undo" in order to |
92 // undo the action and refresh to PendingView. | 91 // undo the action and refresh to PendingView. |
93 void NotifyUndoNeverForThisSite(); | 92 void NotifyUndoNeverForThisSite(); |
94 | 93 |
95 // views::BubbleDelegateView: | |
96 void Init() override; | |
97 void WindowClosing() override; | |
98 | |
99 // views::WidgetDelegate: | |
100 views::View* GetInitiallyFocusedView() override; | |
101 | |
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) { | 94 void set_initially_focused_view(views::View* view) { |
108 DCHECK(!initially_focused_view_); | 95 DCHECK(!initially_focused_view_); |
109 initially_focused_view_ = view; | 96 initially_focused_view_ = view; |
110 } | 97 } |
111 | 98 |
112 // Singleton instance of the Password bubble. The Password bubble can only be | 99 // 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 | 100 // 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 | 101 // shown twice at the same time. The instance is owned by the Bubble and will |
115 // be deleted when the bubble closes. | 102 // be deleted when the bubble closes. |
116 static ManagePasswordsBubbleView* manage_passwords_bubble_; | 103 static ManagePasswordsBubbleView* manage_passwords_bubble_; |
117 | 104 |
118 ManagePasswordsIconView* anchor_view_; | 105 ManagePasswordsIconView* anchor_view_; |
119 | 106 |
120 views::View* initially_focused_view_; | 107 views::View* initially_focused_view_; |
121 | 108 |
122 // A helper to intercept mouse click events on the web contents. | 109 // A helper to intercept mouse click events on the web contents. |
123 class WebContentMouseHandler; | 110 class WebContentMouseHandler; |
124 scoped_ptr<WebContentMouseHandler> mouse_handler_; | 111 scoped_ptr<WebContentMouseHandler> mouse_handler_; |
125 | 112 |
126 // Used to register for fullscreen change notifications. | |
127 content::NotificationRegistrar registrar_; | |
128 | |
129 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 113 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
130 }; | 114 }; |
131 | 115 |
132 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 116 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
OLD | NEW |