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 "chrome/browser/ui/passwords/manage_passwords_bubble.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" |
10 #include "ui/views/bubble/bubble_delegate.h" | 10 #include "ui/views/bubble/bubble_delegate.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 class ManagePasswordsBubbleView : public ManagePasswordsBubble, | 29 class ManagePasswordsBubbleView : public ManagePasswordsBubble, |
30 public views::BubbleDelegateView, | 30 public views::BubbleDelegateView, |
31 public views::ButtonListener, | 31 public views::ButtonListener, |
32 public views::ComboboxListener, | 32 public views::ComboboxListener, |
33 public views::LinkListener { | 33 public views::LinkListener { |
34 public: | 34 public: |
35 // Shows the bubble. | 35 // Shows the bubble. |
36 static void ShowBubble(content::WebContents* web_contents, | 36 static void ShowBubble(content::WebContents* web_contents, |
37 ManagePasswordsIconView* icon_view, | |
38 DisplayReason reason); | 37 DisplayReason reason); |
39 | 38 |
40 // Closes any existing bubble. | 39 // Closes any existing bubble. |
41 static void CloseBubble(); | 40 static void CloseBubble(); |
42 | 41 |
43 // Whether the bubble is currently showing. | 42 // Whether the bubble is currently showing. |
44 static bool IsShowing(); | 43 static bool IsShowing(); |
45 | 44 |
46 private: | 45 private: |
47 enum ColumnSetType { | 46 enum ColumnSetType { |
48 // | | (FILL, FILL) | | | 47 // | | (FILL, FILL) | | |
49 // Used for the bubble's header, the credentials list, and for simple | 48 // Used for the bubble's header, the credentials list, and for simple |
50 // messages like "No passwords". | 49 // messages like "No passwords". |
51 SINGLE_VIEW_COLUMN_SET = 0, | 50 SINGLE_VIEW_COLUMN_SET = 0, |
52 | 51 |
53 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | | | 52 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | | |
54 // Used for buttons at the bottom of the bubble which should nest at the | 53 // Used for buttons at the bottom of the bubble which should nest at the |
55 // bottom-right corner. | 54 // bottom-right corner. |
56 DOUBLE_BUTTON_COLUMN_SET = 1, | 55 DOUBLE_BUTTON_COLUMN_SET = 1, |
57 | 56 |
58 // | | (LEADING, CENTER) | | (TRAILING, CENTER) | | | 57 // | | (LEADING, CENTER) | | (TRAILING, CENTER) | | |
59 // Used for buttons at the bottom of the bubble which should occupy | 58 // Used for buttons at the bottom of the bubble which should occupy |
60 // the corners. | 59 // the corners. |
61 LINK_BUTTON_COLUMN_SET = 2, | 60 LINK_BUTTON_COLUMN_SET = 2, |
62 }; | 61 }; |
63 | 62 |
64 ManagePasswordsBubbleView(content::WebContents* web_contents, | 63 ManagePasswordsBubbleView(content::WebContents* web_contents, |
65 views::View* anchor_view, | 64 views::View* anchor_view, |
66 ManagePasswordsIconView* icon_view, | |
67 DisplayReason reason); | 65 DisplayReason reason); |
68 virtual ~ManagePasswordsBubbleView(); | 66 virtual ~ManagePasswordsBubbleView(); |
69 | 67 |
70 // Construct an appropriate ColumnSet for the given |type|, and add it | 68 // Construct an appropriate ColumnSet for the given |type|, and add it |
71 // to |layout|. | 69 // to |layout|. |
72 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type); | 70 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type); |
73 | 71 |
74 // If the bubble is not anchored to a view, places the bubble in the top | 72 // If the bubble is not anchored to a view, places the bubble in the top |
75 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s | 73 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s |
76 // browser window. Because the positioning is based on the size of the | 74 // browser window. Because the positioning is based on the size of the |
(...skipping 24 matching lines...) Expand all Loading... |
101 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 99 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
102 | 100 |
103 // Handles the event when the user changes an index of a combobox. | 101 // Handles the event when the user changes an index of a combobox. |
104 virtual void OnPerformAction(views::Combobox* source) OVERRIDE; | 102 virtual void OnPerformAction(views::Combobox* source) OVERRIDE; |
105 | 103 |
106 // Singleton instance of the Password bubble. The Password bubble can only be | 104 // Singleton instance of the Password bubble. The Password bubble can only be |
107 // shown on the active browser window, so there is no case in which it will be | 105 // shown on the active browser window, so there is no case in which it will be |
108 // shown twice at the same time. | 106 // shown twice at the same time. |
109 static ManagePasswordsBubbleView* manage_passwords_bubble_; | 107 static ManagePasswordsBubbleView* manage_passwords_bubble_; |
110 | 108 |
111 ManagePasswordsIconView* icon_view_; | |
112 | |
113 // The buttons that are shown in the bubble. | 109 // The buttons that are shown in the bubble. |
114 views::BlueButton* save_button_; | 110 views::BlueButton* save_button_; |
115 views::Combobox* refuse_combobox_; | 111 views::Combobox* refuse_combobox_; |
116 | 112 |
117 views::Link* manage_link_; | 113 views::Link* manage_link_; |
118 views::LabelButton* done_button_; | 114 views::LabelButton* done_button_; |
119 | 115 |
120 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); | 116 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
121 }; | 117 }; |
122 | 118 |
123 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ | 119 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ |
OLD | NEW |