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" | |
10 #include "content/public/browser/notification_registrar.h" | |
9 #include "ui/views/bubble/bubble_delegate.h" | 11 #include "ui/views/bubble/bubble_delegate.h" |
10 | 12 |
11 class ManagePasswordsIconView; | 13 class ManagePasswordsIconView; |
12 | 14 |
13 namespace content { | 15 namespace content { |
14 class WebContents; | 16 class WebContents; |
15 } | 17 } |
16 | 18 |
17 // The ManagePasswordsBubbleView controls the contents of the bubble which | 19 // 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 | 20 // 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 // interacts with the Omnibox icon. It has two distinct states: |
20 // | 22 // |
21 // 1. PendingView: Offers the user the possibility of saving credentials. | 23 // 1. PendingView: Offers the user the possibility of saving credentials. |
22 // 2. ManageView: Displays the current page's saved credentials. | 24 // 2. ManageView: Displays the current page's saved credentials. |
23 // 3. BlacklistedView: Informs the user that the current page is blacklisted. | 25 // 3. BlacklistedView: Informs the user that the current page is blacklisted. |
24 // | 26 // |
25 class ManagePasswordsBubbleView : public ManagePasswordsBubble, | 27 class ManagePasswordsBubbleView : public ManagePasswordsBubble, |
26 public views::BubbleDelegateView { | 28 public views::BubbleDelegateView, |
29 public content::NotificationObserver { | |
Mike West
2014/10/14 11:09:47
It's worth asking views OWNERS whether or not regi
msw
2014/10/20 18:14:44
This seems like a good signal for the browser-scop
| |
27 public: | 30 public: |
28 // Shows the bubble. | 31 // Shows the bubble. |
29 static void ShowBubble(content::WebContents* web_contents, | 32 static void ShowBubble(content::WebContents* web_contents, |
30 DisplayReason reason); | 33 DisplayReason reason); |
31 | 34 |
32 // Closes the existing bubble. | 35 // Closes the existing bubble. |
33 static void CloseBubble(); | 36 static void CloseBubble(); |
34 | 37 |
35 // Makes the bubble the foreground window. | 38 // Makes the bubble the foreground window. |
36 static void ActivateBubble(); | 39 static void ActivateBubble(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 // undo the action and refresh to PendingView. | 89 // undo the action and refresh to PendingView. |
87 void NotifyUndoNeverForThisSite(); | 90 void NotifyUndoNeverForThisSite(); |
88 | 91 |
89 // views::BubbleDelegateView: | 92 // views::BubbleDelegateView: |
90 virtual void Init() override; | 93 virtual void Init() override; |
91 virtual void WindowClosing() override; | 94 virtual void WindowClosing() override; |
92 | 95 |
93 // views::WidgetDelegate | 96 // views::WidgetDelegate |
94 virtual views::View* GetInitiallyFocusedView() override; | 97 virtual views::View* GetInitiallyFocusedView() override; |
95 | 98 |
99 // content::NotificationObserver method. | |
vabr (Chromium)
2014/10/14 11:26:30
nit: There should be a single format of this type
vasilii
2014/10/22 12:14:35
Done.
| |
100 virtual void Observe(int type, | |
101 const content::NotificationSource& source, | |
102 const content::NotificationDetails& details) override; | |
103 | |
96 void set_initially_focused_view(views::View* view) { | 104 void set_initially_focused_view(views::View* view) { |
97 DCHECK(!initially_focused_view_); | 105 DCHECK(!initially_focused_view_); |
98 initially_focused_view_ = view; | 106 initially_focused_view_ = view; |
99 } | 107 } |
100 | 108 |
101 // Singleton instance of the Password bubble. The Password bubble can only be | 109 // Singleton instance of the Password bubble. The Password bubble can only be |
102 // shown on the active browser window, so there is no case in which it will be | 110 // shown on the active browser window, so there is no case in which it will be |
103 // shown twice at the same time. The instance is owned by the Bubble and will | 111 // shown twice at the same time. The instance is owned by the Bubble and will |
104 // be deleted when the bubble closes. | 112 // be deleted when the bubble closes. |
105 static ManagePasswordsBubbleView* manage_passwords_bubble_; | 113 static ManagePasswordsBubbleView* manage_passwords_bubble_; |
106 | 114 |
107 ManagePasswordsIconView* anchor_view_; | 115 ManagePasswordsIconView* anchor_view_; |
108 | 116 |
109 // If true upon destruction, the user has confirmed that she never wants to | 117 // If true upon destruction, the user has confirmed that she never wants to |
110 // save passwords for a particular site. | 118 // save passwords for a particular site. |
111 bool never_save_passwords_; | 119 bool never_save_passwords_; |
112 | 120 |
113 views::View* initially_focused_view_; | 121 views::View* initially_focused_view_; |
114 | 122 |
115 // A helper to intercept mouse click events on the web contents. | 123 // A helper to intercept mouse click events on the web contents. |
116 class WebContentMouseHandler; | 124 class WebContentMouseHandler; |
117 scoped_ptr<WebContentMouseHandler> mouse_handler_; | 125 scoped_ptr<WebContentMouseHandler> mouse_handler_; |
118 | 126 |
127 // Used to register for fullscreen change notifications. | |
128 content::NotificationRegistrar registrar_; | |
129 | |
119 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 130 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
120 }; | 131 }; |
121 | 132 |
122 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 133 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
OLD | NEW |