Chromium Code Reviews| 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 #include "ui/base/ui_features.h" |
| 12 #include "ui/views/controls/styled_label_listener.h" | |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 class WebContents; | 15 class WebContents; |
| 15 } | 16 } |
| 16 | 17 |
| 17 // The ManagePasswordsBubbleView controls the contents of the bubble which | 18 // 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 | 19 // 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: | 20 // interacts with the Omnibox icon. It has two distinct states: |
| 20 // | 21 // |
| 21 // 1. PendingView: Offers the user the possibility of saving credentials. | 22 // 1. PendingView: Offers the user the possibility of saving credentials. |
| 22 // 2. ManageView: Displays the current page's saved credentials. | 23 // 2. ManageView: Displays the current page's saved credentials. |
| 23 // 3. BlacklistedView: Informs the user that the current page is blacklisted. | 24 // 3. BlacklistedView: Informs the user that the current page is blacklisted. |
| 24 // | 25 // |
| 25 class ManagePasswordsBubbleView : public LocationBarBubbleDelegateView { | 26 class ManagePasswordsBubbleView : public LocationBarBubbleDelegateView, |
| 27 public views::StyledLabelListener { | |
| 26 public: | 28 public: |
| 27 static constexpr int kDesiredBubbleWidth = 370; | 29 static constexpr int kDesiredBubbleWidth = 370; |
| 28 | 30 |
| 29 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) | 31 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) |
| 30 // Shows the bubble. | 32 // Shows the bubble. |
| 31 static void ShowBubble(content::WebContents* web_contents, | 33 static void ShowBubble(content::WebContents* web_contents, |
| 32 DisplayReason reason); | 34 DisplayReason reason); |
| 33 #endif | 35 #endif |
| 34 | 36 |
| 35 // Closes the existing bubble. | 37 // Closes the existing bubble. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 class UpdatePendingView; | 73 class UpdatePendingView; |
| 72 | 74 |
| 73 ~ManagePasswordsBubbleView() override; | 75 ~ManagePasswordsBubbleView() override; |
| 74 | 76 |
| 75 // LocationBarBubbleDelegateView: | 77 // LocationBarBubbleDelegateView: |
| 76 int GetDialogButtons() const override; | 78 int GetDialogButtons() const override; |
| 77 views::View* GetInitiallyFocusedView() override; | 79 views::View* GetInitiallyFocusedView() override; |
| 78 void Init() override; | 80 void Init() override; |
| 79 void CloseBubble() override; | 81 void CloseBubble() override; |
| 80 | 82 |
| 81 // WidgetDelegate: | 83 // views::BubbleDialogDelegateView: |
|
Peter Kasting
2017/06/17 01:16:20
Nit: You don't directly subclass this class, or Wi
Bret
2017/06/21 22:37:54
Moved both lists under LocationBarBubbleDelegateVi
| |
| 84 views::View* CreateTitleView(const base::string16& title_text) override; | |
| 85 | |
| 86 // views::WidgetDelegate: | |
| 82 base::string16 GetWindowTitle() const override; | 87 base::string16 GetWindowTitle() const override; |
| 83 gfx::ImageSkia GetWindowIcon() override; | 88 gfx::ImageSkia GetWindowIcon() override; |
| 84 bool ShouldShowWindowTitle() const override; | |
| 85 bool ShouldShowWindowIcon() const override; | 89 bool ShouldShowWindowIcon() const override; |
| 86 bool ShouldShowCloseButton() const override; | 90 bool ShouldShowCloseButton() const override; |
| 87 | 91 |
| 92 // views::StyledLabelListener: | |
| 93 void StyledLabelLinkClicked(views::StyledLabel* label, | |
| 94 const gfx::Range& range, | |
| 95 int event_flags) override; | |
| 96 | |
| 88 // Refreshes the bubble's state. | 97 // Refreshes the bubble's state. |
| 89 void Refresh(); | 98 void Refresh(); |
| 90 | 99 |
| 91 // Sets up a child view according to the model state. | 100 // Sets up a child view according to the model state. |
| 92 void CreateChild(); | 101 void CreateChild(); |
| 93 | 102 |
| 94 void set_initially_focused_view(views::View* view) { | 103 void set_initially_focused_view(views::View* view) { |
| 95 DCHECK(!initially_focused_view_); | 104 DCHECK(!initially_focused_view_); |
| 96 initially_focused_view_ = view; | 105 initially_focused_view_ = view; |
| 97 } | 106 } |
| 98 | 107 |
| 99 // Singleton instance of the Password bubble. The Password bubble can only be | 108 // Singleton instance of the Password bubble. The Password bubble can only be |
| 100 // shown on the active browser window, so there is no case in which it will be | 109 // shown on the active browser window, so there is no case in which it will be |
| 101 // shown twice at the same time. The instance is owned by the Bubble and will | 110 // shown twice at the same time. The instance is owned by the Bubble and will |
| 102 // be deleted when the bubble closes. | 111 // be deleted when the bubble closes. |
| 103 static ManagePasswordsBubbleView* manage_passwords_bubble_; | 112 static ManagePasswordsBubbleView* manage_passwords_bubble_; |
| 104 | 113 |
| 105 // The timeout in seconds for the auto sign-in toast. | 114 // The timeout in seconds for the auto sign-in toast. |
| 106 static int auto_signin_toast_timeout_; | 115 static int auto_signin_toast_timeout_; |
| 107 | 116 |
| 108 ManagePasswordsBubbleModel model_; | 117 ManagePasswordsBubbleModel model_; |
| 109 | 118 |
| 110 views::View* initially_focused_view_; | 119 views::View* initially_focused_view_; |
| 111 | 120 |
| 121 // Used by BubbleFrameView as the dialog title. | |
| 122 views::StyledLabel* title_view_; | |
| 123 | |
| 112 std::unique_ptr<WebContentMouseHandler> mouse_handler_; | 124 std::unique_ptr<WebContentMouseHandler> mouse_handler_; |
| 113 | 125 |
| 114 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 126 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
| 115 }; | 127 }; |
| 116 | 128 |
| 117 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 129 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
| OLD | NEW |