| 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_model.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 9 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" | 9 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
| 10 | 10 |
| 11 class ManagePasswordsIconViews; | 11 class ManagePasswordsIconViews; |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class WebContents; | 14 class WebContents; |
| 15 } | 15 } |
| 16 | 16 |
| 17 // The ManagePasswordsBubbleView controls the contents of the bubble which | 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 | 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: | 19 // interacts with the Omnibox icon. It has two distinct states: |
| 20 // | 20 // |
| 21 // 1. PendingView: Offers the user the possibility of saving credentials. | 21 // 1. PendingView: Offers the user the possibility of saving credentials. |
| 22 // 2. ManageView: Displays the current page's saved credentials. | 22 // 2. ManageView: Displays the current page's saved credentials. |
| 23 // 3. BlacklistedView: Informs the user that the current page is blacklisted. | 23 // 3. BlacklistedView: Informs the user that the current page is blacklisted. |
| 24 // | 24 // |
| 25 class ManagePasswordsBubbleView : public LocationBarBubbleDelegateView { | 25 class ManagePasswordsBubbleView : public LocationBarBubbleDelegateView { |
| 26 public: | 26 public: |
| 27 // Shows the bubble. | 27 // Shows the bubble. |
| 28 static void ShowBubble(content::WebContents* web_contents, | 28 static void ShowBubble(content::WebContents* web_contents, |
| 29 ManagePasswordsBubbleModel::DisplayReason reason); | 29 DisplayReason reason); |
| 30 | 30 |
| 31 // Closes the existing bubble. | 31 // Closes the existing bubble. |
| 32 static void CloseBubble(); | 32 static void CloseBubble(); |
| 33 | 33 |
| 34 // Makes the bubble the foreground window. | 34 // Makes the bubble the foreground window. |
| 35 static void ActivateBubble(); | 35 static void ActivateBubble(); |
| 36 | 36 |
| 37 // Returns a pointer to the bubble. | 37 // Returns a pointer to the bubble. |
| 38 static ManagePasswordsBubbleView* manage_password_bubble() { | 38 static ManagePasswordsBubbleView* manage_password_bubble() { |
| 39 return manage_passwords_bubble_; | 39 return manage_passwords_bubble_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 58 class AutoSigninView; | 58 class AutoSigninView; |
| 59 class BlacklistedView; | 59 class BlacklistedView; |
| 60 class ManageView; | 60 class ManageView; |
| 61 class PendingView; | 61 class PendingView; |
| 62 class SaveConfirmationView; | 62 class SaveConfirmationView; |
| 63 class UpdatePendingView; | 63 class UpdatePendingView; |
| 64 class WebContentMouseHandler; | 64 class WebContentMouseHandler; |
| 65 | 65 |
| 66 ManagePasswordsBubbleView(content::WebContents* web_contents, | 66 ManagePasswordsBubbleView(content::WebContents* web_contents, |
| 67 ManagePasswordsIconViews* anchor_view, | 67 ManagePasswordsIconViews* anchor_view, |
| 68 ManagePasswordsBubbleModel::DisplayReason reason); | 68 DisplayReason reason); |
| 69 ~ManagePasswordsBubbleView() override; | 69 ~ManagePasswordsBubbleView() override; |
| 70 | 70 |
| 71 // LocationBarBubbleDelegateView: | 71 // LocationBarBubbleDelegateView: |
| 72 views::View* GetInitiallyFocusedView() override; | 72 views::View* GetInitiallyFocusedView() override; |
| 73 void Init() override; | 73 void Init() override; |
| 74 void Close() override; | 74 void Close() override; |
| 75 | 75 |
| 76 // WidgetObserver: | |
| 77 void OnWidgetClosing(views::Widget* widget) override; | |
| 78 | |
| 79 // WidgetDelegate: | 76 // WidgetDelegate: |
| 80 bool ShouldShowCloseButton() const override; | 77 bool ShouldShowCloseButton() const override; |
| 81 | 78 |
| 82 // Refreshes the bubble's state: called to display a confirmation screen after | 79 // Refreshes the bubble's state: called to display a confirmation screen after |
| 83 // a user selects "Never for this site", for instance. | 80 // a user selects "Never for this site", for instance. |
| 84 void Refresh(); | 81 void Refresh(); |
| 85 | 82 |
| 86 void set_initially_focused_view(views::View* view) { | 83 void set_initially_focused_view(views::View* view) { |
| 87 DCHECK(!initially_focused_view_); | 84 DCHECK(!initially_focused_view_); |
| 88 initially_focused_view_ = view; | 85 initially_focused_view_ = view; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 103 | 100 |
| 104 views::View* initially_focused_view_; | 101 views::View* initially_focused_view_; |
| 105 | 102 |
| 106 // A helper to intercept mouse click events on the web contents. | 103 // A helper to intercept mouse click events on the web contents. |
| 107 scoped_ptr<WebContentMouseHandler> mouse_handler_; | 104 scoped_ptr<WebContentMouseHandler> mouse_handler_; |
| 108 | 105 |
| 109 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 106 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
| 110 }; | 107 }; |
| 111 | 108 |
| 112 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 109 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
| OLD | NEW |