| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/timer/timer.h" |
| 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" |
| 10 #include "chrome/browser/ui/views/passwords/save_password_refusal_combobox_model
.h" | 11 #include "chrome/browser/ui/views/passwords/save_password_refusal_combobox_model
.h" |
| 11 #include "ui/views/bubble/bubble_delegate.h" | 12 #include "ui/views/bubble/bubble_delegate.h" |
| 12 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/controls/combobox/combobox.h" | 14 #include "ui/views/controls/combobox/combobox.h" |
| 14 #include "ui/views/controls/combobox/combobox_listener.h" | 15 #include "ui/views/controls/combobox/combobox_listener.h" |
| 15 #include "ui/views/controls/link.h" | 16 #include "ui/views/controls/link.h" |
| 16 #include "ui/views/controls/link_listener.h" | 17 #include "ui/views/controls/link_listener.h" |
| 17 #include "ui/views/controls/styled_label_listener.h" | 18 #include "ui/views/controls/styled_label_listener.h" |
| 18 | 19 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 165 |
| 165 // Returns a pointer to the bubble. | 166 // Returns a pointer to the bubble. |
| 166 static const ManagePasswordsBubbleView* manage_password_bubble() { | 167 static const ManagePasswordsBubbleView* manage_password_bubble() { |
| 167 return manage_passwords_bubble_; | 168 return manage_passwords_bubble_; |
| 168 } | 169 } |
| 169 | 170 |
| 170 const View* initially_focused_view() const { | 171 const View* initially_focused_view() const { |
| 171 return initially_focused_view_; | 172 return initially_focused_view_; |
| 172 } | 173 } |
| 173 | 174 |
| 175 bool IsTimerRunning() const { |
| 176 return timer_.IsRunning(); |
| 177 } |
| 178 |
| 174 private: | 179 private: |
| 175 ManagePasswordsBubbleView(content::WebContents* web_contents, | 180 ManagePasswordsBubbleView(content::WebContents* web_contents, |
| 176 ManagePasswordsIconView* anchor_view, | 181 ManagePasswordsIconView* anchor_view, |
| 177 DisplayReason reason); | 182 DisplayReason reason); |
| 178 virtual ~ManagePasswordsBubbleView(); | 183 virtual ~ManagePasswordsBubbleView(); |
| 179 | 184 |
| 180 // If the bubble is not anchored to a view, places the bubble in the top | 185 // If the bubble is not anchored to a view, places the bubble in the top |
| 181 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s | 186 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s |
| 182 // browser window. Because the positioning is based on the size of the | 187 // browser window. Because the positioning is based on the size of the |
| 183 // bubble, this must be called after the bubble is created. | 188 // bubble, this must be called after the bubble is created. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 195 void NotifyNeverForThisSiteClicked(); | 200 void NotifyNeverForThisSiteClicked(); |
| 196 | 201 |
| 197 // Called from ConfirmNeverView if the user confirms her intention to never | 202 // Called from ConfirmNeverView if the user confirms her intention to never |
| 198 // save passwords, and remove existing passwords, for a site. | 203 // save passwords, and remove existing passwords, for a site. |
| 199 void NotifyConfirmedNeverForThisSite(); | 204 void NotifyConfirmedNeverForThisSite(); |
| 200 | 205 |
| 201 // Called from ConfirmNeverView if the user clicks on "Undo" in order to | 206 // Called from ConfirmNeverView if the user clicks on "Undo" in order to |
| 202 // undo the action and refresh to PendingView. | 207 // undo the action and refresh to PendingView. |
| 203 void NotifyUndoNeverForThisSite(); | 208 void NotifyUndoNeverForThisSite(); |
| 204 | 209 |
| 210 // Starts a timer which will close the bubble if it's inactive. |
| 211 void StartTimerIfNecessary(); |
| 212 |
| 205 // views::BubbleDelegateView: | 213 // views::BubbleDelegateView: |
| 206 virtual void Init() OVERRIDE; | 214 virtual void Init() OVERRIDE; |
| 207 virtual void WindowClosing() OVERRIDE; | 215 virtual void WindowClosing() OVERRIDE; |
| 216 virtual void OnWidgetActivationChanged(views::Widget* widget, |
| 217 bool active) OVERRIDE; |
| 208 | 218 |
| 209 // views::WidgetDelegate | 219 // views::WidgetDelegate |
| 210 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 220 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 211 | 221 |
| 222 // views::View methods. |
| 223 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 224 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 225 |
| 212 void set_initially_focused_view(views::View* view) { | 226 void set_initially_focused_view(views::View* view) { |
| 213 DCHECK(!initially_focused_view_); | 227 DCHECK(!initially_focused_view_); |
| 214 initially_focused_view_ = view; | 228 initially_focused_view_ = view; |
| 215 } | 229 } |
| 216 | 230 |
| 217 // Singleton instance of the Password bubble. The Password bubble can only be | 231 // Singleton instance of the Password bubble. The Password bubble can only be |
| 218 // shown on the active browser window, so there is no case in which it will be | 232 // shown on the active browser window, so there is no case in which it will be |
| 219 // shown twice at the same time. | 233 // shown twice at the same time. |
| 220 static ManagePasswordsBubbleView* manage_passwords_bubble_; | 234 static ManagePasswordsBubbleView* manage_passwords_bubble_; |
| 221 | 235 |
| 222 ManagePasswordsIconView* anchor_view_; | 236 ManagePasswordsIconView* anchor_view_; |
| 223 | 237 |
| 224 // If true upon destruction, the user has confirmed that she never wants to | 238 // If true upon destruction, the user has confirmed that she never wants to |
| 225 // save passwords for a particular site. | 239 // save passwords for a particular site. |
| 226 bool never_save_passwords_; | 240 bool never_save_passwords_; |
| 227 | 241 |
| 228 views::View* initially_focused_view_; | 242 views::View* initially_focused_view_; |
| 229 | 243 |
| 244 // Timer used to close the bubble after timeout. |
| 245 base::OneShotTimer<ManagePasswordsBubbleView> timer_; |
| 246 |
| 230 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 247 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
| 231 }; | 248 }; |
| 232 | 249 |
| 233 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 250 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
| OLD | NEW |