Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h

Issue 218993006: Extracting the remaining ManagePasswordsBubbleView::Init code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vabr feedback. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_model.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
10 #include "ui/views/bubble/bubble_delegate.h" 10 #include "ui/views/bubble/bubble_delegate.h"
11 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/link.h" 12 #include "ui/views/controls/link.h"
13 #include "ui/views/controls/link_listener.h" 13 #include "ui/views/controls/link_listener.h"
14 14
15 class ManagePasswordsIconView; 15 class ManagePasswordsIconView;
16 16
17 namespace content { 17 namespace content {
18 class WebContents; 18 class WebContents;
19 } 19 }
20 20
21 namespace views { 21 namespace views {
22 class BlueButton; 22 class BlueButton;
23 class LabelButton; 23 class LabelButton;
24 class GridLayout;
24 } 25 }
25 26
26 class ManagePasswordsBubbleView : public views::BubbleDelegateView, 27 class ManagePasswordsBubbleView : public views::BubbleDelegateView,
27 public views::ButtonListener, 28 public views::ButtonListener,
28 public views::LinkListener { 29 public views::LinkListener {
29 public: 30 public:
30 enum FieldType { USERNAME_FIELD, PASSWORD_FIELD }; 31 enum FieldType { USERNAME_FIELD, PASSWORD_FIELD };
31 32
32 // Shows the bubble. 33 // Shows the bubble.
33 static void ShowBubble(content::WebContents* web_contents, 34 static void ShowBubble(content::WebContents* web_contents,
34 ManagePasswordsIconView* icon_view); 35 ManagePasswordsIconView* icon_view);
35 36
36 // Closes any existing bubble. 37 // Closes any existing bubble.
37 static void CloseBubble(); 38 static void CloseBubble();
38 39
39 // Whether the bubble is currently showing. 40 // Whether the bubble is currently showing.
40 static bool IsShowing(); 41 static bool IsShowing();
41 42
42 private: 43 private:
44 enum ColumnSetType {
45 // | | (FILL, FILL) | |
46 // Used for the bubble's header, the credentials list, and for simple
47 // messages like "No passwords".
48 SINGLE_VIEW_COLUMN_SET = 0,
49
50 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | |
51 // Used for buttons and links at the bottom of the bubble.
52 DOUBLE_VIEW_COLUMN_SET = 1,
53 };
54
43 ManagePasswordsBubbleView(content::WebContents* web_contents, 55 ManagePasswordsBubbleView(content::WebContents* web_contents,
44 views::View* anchor_view, 56 views::View* anchor_view,
45 ManagePasswordsIconView* icon_view); 57 ManagePasswordsIconView* icon_view);
46 virtual ~ManagePasswordsBubbleView(); 58 virtual ~ManagePasswordsBubbleView();
47 59
60 // Construct an appropriate ColumnSet for the given |type|, and add it
61 // to |layout|.
62 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type);
63
48 // Returns the maximum width needed to display the longest value in the 64 // Returns the maximum width needed to display the longest value in the
49 // |type| field. 65 // |type| field.
50 int GetMaximumFieldWidth(FieldType type); 66 int GetMaximumFieldWidth(FieldType type);
51 67
52 // If the bubble is not anchored to a view, places the bubble in the top 68 // If the bubble is not anchored to a view, places the bubble in the top
53 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s 69 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s
54 // browser window. Because the positioning is based on the size of the 70 // browser window. Because the positioning is based on the size of the
55 // bubble, this must be called after the bubble is created. 71 // bubble, this must be called after the bubble is created.
56 void AdjustForFullscreen(const gfx::Rect& screen_bounds); 72 void AdjustForFullscreen(const gfx::Rect& screen_bounds);
57 73
(...skipping 21 matching lines...) Expand all
79 // The buttons that are shown in the bubble. 95 // The buttons that are shown in the bubble.
80 views::BlueButton* save_button_; 96 views::BlueButton* save_button_;
81 views::LabelButton* cancel_button_; 97 views::LabelButton* cancel_button_;
82 views::Link* manage_link_; 98 views::Link* manage_link_;
83 views::LabelButton* done_button_; 99 views::LabelButton* done_button_;
84 100
85 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); 101 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView);
86 }; 102 };
87 103
88 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ 104 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698