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

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

Issue 255903006: Password bubble: Create subviews for ManagePasswordsBubbleView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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.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"
11 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/combobox/combobox.h" 12 #include "ui/views/controls/combobox/combobox.h"
13 #include "ui/views/controls/combobox/combobox_listener.h" 13 #include "ui/views/controls/combobox/combobox_listener.h"
14 #include "ui/views/controls/link.h" 14 #include "ui/views/controls/link.h"
15 #include "ui/views/controls/link_listener.h" 15 #include "ui/views/controls/link_listener.h"
16 16
17 class ManagePasswordsIconView; 17 class ManagePasswordsIconView;
18 18
19 namespace content { 19 namespace content {
20 class WebContents; 20 class WebContents;
21 } 21 }
22 22
23 namespace views { 23 namespace views {
24 class BlueButton; 24 class BlueButton;
25 class LabelButton; 25 class LabelButton;
26 class GridLayout; 26 class GridLayout;
27 } 27 }
28 28
29 // The ManagePasswordsBubbleView controls the contents of the bubble which
30 // pops up when Chrome offers to save a user's password, or when the user
31 // interacts with the Omnibox icon. It has two distinct states:
32 //
33 // 1. PendingView: Offers the user the possibility of saving credentials.
34 // 2. ManageView: Displays the current page's saved credentials.
35 //
36 // TODO(mkwst): Add a third state: "Informing the user that the current page
37 // is blacklisted."
29 class ManagePasswordsBubbleView : public ManagePasswordsBubble, 38 class ManagePasswordsBubbleView : public ManagePasswordsBubble,
30 public views::BubbleDelegateView, 39 public views::BubbleDelegateView {
31 public views::ButtonListener,
32 public views::ComboboxListener,
33 public views::LinkListener {
34 public: 40 public:
41 // A view offering the user the ability to save credentials. Contains a
42 // single ManagePasswordItemView, along with a "Save Passwords" button
43 // and a rejection combobox.
44 class PendingView : public views::View,
45 public views::ButtonListener,
46 public views::ComboboxListener {
47 public:
48 explicit PendingView(ManagePasswordsBubbleView* parent);
49 virtual ~PendingView();
50
51 private:
52 // views::ButtonListener:
53 virtual void ButtonPressed(views::Button* sender,
54 const ui::Event& event) OVERRIDE;
55
56 // Handles the event when the user changes an index of a combobox.
57 virtual void OnPerformAction(views::Combobox* source) OVERRIDE;
58
59 ManagePasswordsBubbleView* parent_;
60
61 views::BlueButton* save_button_;
62 views::Combobox* refuse_combobox_;
63 };
64
65 // A view offering the user a list of her currently saved credentials
66 // for the current page, along with a "Manage passwords" link and a
67 // "Done" button.
68 class ManageView : public views::View,
69 public views::ButtonListener,
70 public views::LinkListener {
71 public:
72 explicit ManageView(ManagePasswordsBubbleView* parent);
73 virtual ~ManageView();
74
75 private:
76 // views::ButtonListener:
77 virtual void ButtonPressed(views::Button* sender,
78 const ui::Event& event) OVERRIDE;
79
80 // views::LinkListener:
81 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
82
83 ManagePasswordsBubbleView* parent_;
84
85 views::Link* manage_link_;
86 views::LabelButton* done_button_;
87 };
88
35 // Shows the bubble. 89 // Shows the bubble.
36 static void ShowBubble(content::WebContents* web_contents, 90 static void ShowBubble(content::WebContents* web_contents,
37 DisplayReason reason); 91 DisplayReason reason);
38 92
39 // Closes any existing bubble. 93 // Closes any existing bubble.
40 static void CloseBubble(); 94 static void CloseBubble();
41 95
42 // Whether the bubble is currently showing. 96 // Whether the bubble is currently showing.
43 static bool IsShowing(); 97 static bool IsShowing();
44 98
(...skipping 17 matching lines...) Expand all
62 116
63 ManagePasswordsBubbleView(content::WebContents* web_contents, 117 ManagePasswordsBubbleView(content::WebContents* web_contents,
64 views::View* anchor_view, 118 views::View* anchor_view,
65 DisplayReason reason); 119 DisplayReason reason);
66 virtual ~ManagePasswordsBubbleView(); 120 virtual ~ManagePasswordsBubbleView();
67 121
68 // Construct an appropriate ColumnSet for the given |type|, and add it 122 // Construct an appropriate ColumnSet for the given |type|, and add it
69 // to |layout|. 123 // to |layout|.
70 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type); 124 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type);
71 125
126 // Given a layout, add an appropriate title using a SINGLE_VIEW_COLUMN_SET,
127 // followed by a spacer row.
128 void AddTitleRow(views::GridLayout* layout) const;
129
72 // If the bubble is not anchored to a view, places the bubble in the top 130 // If the bubble is not anchored to a view, places the bubble in the top
73 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s 131 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s
74 // browser window. Because the positioning is based on the size of the 132 // browser window. Because the positioning is based on the size of the
75 // bubble, this must be called after the bubble is created. 133 // bubble, this must be called after the bubble is created.
76 void AdjustForFullscreen(const gfx::Rect& screen_bounds); 134 void AdjustForFullscreen(const gfx::Rect& screen_bounds);
77 135
78 // Close the bubble. 136 // Close the bubble.
79 void Close(); 137 void Close();
80 138
81 // Close the bubble without triggering UMA logging. We need this for the 139 // Close the bubble without triggering UMA logging. We need this for the
82 // moment, as the current implementation can close the bubble without user 140 // moment, as the current implementation can close the bubble without user
83 // interaction; we want to ensure that doesn't show up as a user action in 141 // interaction; we want to ensure that doesn't show up as a user action in
84 // our counts. 142 // our counts.
85 // 143 //
86 // TODO(mkwst): Throw this away once the icon is no longer responsible for 144 // TODO(mkwst): Throw this away once the icon is no longer responsible for
87 // creating the bubble. 145 // creating the bubble.
88 void CloseWithoutLogging(); 146 void CloseWithoutLogging();
89 147
90 // views::BubbleDelegateView: 148 // views::BubbleDelegateView:
91 virtual void Init() OVERRIDE; 149 virtual void Init() OVERRIDE;
92 virtual void WindowClosing() OVERRIDE; 150 virtual void WindowClosing() OVERRIDE;
93 151
94 // views::ButtonListener:
95 virtual void ButtonPressed(views::Button* sender,
96 const ui::Event& event) OVERRIDE;
97
98 // views::LinkListener:
99 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
100
101 // Handles the event when the user changes an index of a combobox.
102 virtual void OnPerformAction(views::Combobox* source) OVERRIDE;
103
104 // Singleton instance of the Password bubble. The Password bubble can only be 152 // Singleton instance of the Password bubble. The Password bubble can only be
105 // shown on the active browser window, so there is no case in which it will be 153 // shown on the active browser window, so there is no case in which it will be
106 // shown twice at the same time. 154 // shown twice at the same time.
107 static ManagePasswordsBubbleView* manage_passwords_bubble_; 155 static ManagePasswordsBubbleView* manage_passwords_bubble_;
108 156
109 // The buttons that are shown in the bubble.
110 views::BlueButton* save_button_;
111 views::Combobox* refuse_combobox_;
112
113 views::Link* manage_link_;
114 views::LabelButton* done_button_;
115
116 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); 157 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView);
117 }; 158 };
118 159
119 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ 160 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698