| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 10 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
| 11 #include "ui/base/ui_features.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 class WebContents; | 14 class WebContents; |
| 14 } | 15 } |
| 15 | 16 |
| 16 // The ManagePasswordsBubbleView controls the contents of the bubble which | 17 // The ManagePasswordsBubbleView controls the contents of the bubble which |
| 17 // 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 |
| 18 // interacts with the Omnibox icon. It has two distinct states: | 19 // interacts with the Omnibox icon. It has two distinct states: |
| 19 // | 20 // |
| 20 // 1. PendingView: Offers the user the possibility of saving credentials. | 21 // 1. PendingView: Offers the user the possibility of saving credentials. |
| 21 // 2. ManageView: Displays the current page's saved credentials. | 22 // 2. ManageView: Displays the current page's saved credentials. |
| 22 // 3. BlacklistedView: Informs the user that the current page is blacklisted. | 23 // 3. BlacklistedView: Informs the user that the current page is blacklisted. |
| 23 // | 24 // |
| 24 class ManagePasswordsBubbleView : public LocationBarBubbleDelegateView { | 25 class ManagePasswordsBubbleView : public LocationBarBubbleDelegateView { |
| 25 public: | 26 public: |
| 26 static constexpr int kDesiredBubbleWidth = 370; | 27 static constexpr int kDesiredBubbleWidth = 370; |
| 27 | 28 |
| 29 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) |
| 28 // Shows the bubble. | 30 // Shows the bubble. |
| 29 static void ShowBubble(content::WebContents* web_contents, | 31 static void ShowBubble(content::WebContents* web_contents, |
| 30 DisplayReason reason); | 32 DisplayReason reason); |
| 33 #endif |
| 31 | 34 |
| 32 // Closes the existing bubble. | 35 // Closes the existing bubble. |
| 33 static void CloseCurrentBubble(); | 36 static void CloseCurrentBubble(); |
| 34 | 37 |
| 35 // Makes the bubble the foreground window. | 38 // Makes the bubble the foreground window. |
| 36 static void ActivateBubble(); | 39 static void ActivateBubble(); |
| 37 | 40 |
| 38 // Returns a pointer to the bubble. | 41 // Returns a pointer to the bubble. |
| 39 static ManagePasswordsBubbleView* manage_password_bubble() { | 42 static ManagePasswordsBubbleView* manage_password_bubble() { |
| 40 return manage_passwords_bubble_; | 43 return manage_passwords_bubble_; |
| 41 } | 44 } |
| 42 | 45 |
| 46 ManagePasswordsBubbleView(content::WebContents* web_contents, |
| 47 views::View* anchor_view, |
| 48 const gfx::Point& anchor_point, |
| 49 DisplayReason reason); |
| 50 |
| 43 content::WebContents* web_contents() const; | 51 content::WebContents* web_contents() const; |
| 44 | 52 |
| 45 #if defined(UNIT_TEST) | 53 #if defined(UNIT_TEST) |
| 46 const View* initially_focused_view() const { | 54 const View* initially_focused_view() const { |
| 47 return initially_focused_view_; | 55 return initially_focused_view_; |
| 48 } | 56 } |
| 49 | 57 |
| 50 static void set_auto_signin_toast_timeout(int seconds) { | 58 static void set_auto_signin_toast_timeout(int seconds) { |
| 51 auto_signin_toast_timeout_ = seconds; | 59 auto_signin_toast_timeout_ = seconds; |
| 52 } | 60 } |
| 53 #endif | 61 #endif |
| 54 | 62 |
| 55 ManagePasswordsBubbleModel* model() { return &model_; } | 63 ManagePasswordsBubbleModel* model() { return &model_; } |
| 56 | 64 |
| 57 private: | 65 private: |
| 58 class AutoSigninView; | 66 class AutoSigninView; |
| 59 class ManageView; | 67 class ManageView; |
| 60 class PendingView; | 68 class PendingView; |
| 61 class SaveConfirmationView; | 69 class SaveConfirmationView; |
| 62 class SignInPromoView; | 70 class SignInPromoView; |
| 63 class UpdatePendingView; | 71 class UpdatePendingView; |
| 64 | 72 |
| 65 ManagePasswordsBubbleView(content::WebContents* web_contents, | |
| 66 views::View* anchor_view, | |
| 67 DisplayReason reason); | |
| 68 ~ManagePasswordsBubbleView() override; | 73 ~ManagePasswordsBubbleView() override; |
| 69 | 74 |
| 70 // LocationBarBubbleDelegateView: | 75 // LocationBarBubbleDelegateView: |
| 71 views::View* GetInitiallyFocusedView() override; | 76 views::View* GetInitiallyFocusedView() override; |
| 72 void Init() override; | 77 void Init() override; |
| 73 void CloseBubble() override; | 78 void CloseBubble() override; |
| 74 | 79 |
| 75 // WidgetDelegate: | 80 // WidgetDelegate: |
| 76 base::string16 GetWindowTitle() const override; | 81 base::string16 GetWindowTitle() const override; |
| 77 gfx::ImageSkia GetWindowIcon() override; | 82 gfx::ImageSkia GetWindowIcon() override; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 102 ManagePasswordsBubbleModel model_; | 107 ManagePasswordsBubbleModel model_; |
| 103 | 108 |
| 104 views::View* initially_focused_view_; | 109 views::View* initially_focused_view_; |
| 105 | 110 |
| 106 std::unique_ptr<WebContentMouseHandler> mouse_handler_; | 111 std::unique_ptr<WebContentMouseHandler> mouse_handler_; |
| 107 | 112 |
| 108 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 113 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
| 109 }; | 114 }; |
| 110 | 115 |
| 111 #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 |