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