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

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

Issue 232753002: Password bubble: Deplatformify ManagePasswordsBubbleView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chromium-style error. 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.h"
10 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
11 #include "ui/views/bubble/bubble_delegate.h" 10 #include "ui/views/bubble/bubble_delegate.h"
12 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
13 #include "ui/views/controls/combobox/combobox.h" 12 #include "ui/views/controls/combobox/combobox.h"
14 #include "ui/views/controls/combobox/combobox_listener.h" 13 #include "ui/views/controls/combobox/combobox_listener.h"
15 #include "ui/views/controls/link.h" 14 #include "ui/views/controls/link.h"
16 #include "ui/views/controls/link_listener.h" 15 #include "ui/views/controls/link_listener.h"
17 16
18 class ManagePasswordsIconView; 17 class ManagePasswordsIconView;
19 18
20 namespace content { 19 namespace content {
21 class WebContents; 20 class WebContents;
22 } 21 }
23 22
24 namespace views { 23 namespace views {
25 class BlueButton; 24 class BlueButton;
26 class LabelButton; 25 class LabelButton;
27 class GridLayout; 26 class GridLayout;
28 } 27 }
29 28
30 class ManagePasswordsBubbleView : public views::BubbleDelegateView, 29 class ManagePasswordsBubbleView : public ManagePasswordsBubble,
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 enum FieldType { USERNAME_FIELD, PASSWORD_FIELD };
36
37 enum BubbleDisplayReason { AUTOMATIC = 0, USER_ACTION, NUM_DISPLAY_REASONS };
38
39 // Shows the bubble. 35 // Shows the bubble.
40 static void ShowBubble(content::WebContents* web_contents, 36 static void ShowBubble(content::WebContents* web_contents,
41 ManagePasswordsIconView* icon_view, 37 ManagePasswordsIconView* icon_view,
42 BubbleDisplayReason reason); 38 DisplayReason reason);
43 39
44 // Closes any existing bubble. 40 // Closes any existing bubble.
45 static void CloseBubble( 41 static void CloseBubble();
46 password_manager::metrics_util::UIDismissalReason reason);
47 42
48 // Whether the bubble is currently showing. 43 // Whether the bubble is currently showing.
49 static bool IsShowing(); 44 static bool IsShowing();
50 45
51 private: 46 private:
52 enum ColumnSetType { 47 enum ColumnSetType {
53 // | | (FILL, FILL) | | 48 // | | (FILL, FILL) | |
54 // Used for the bubble's header, the credentials list, and for simple 49 // Used for the bubble's header, the credentials list, and for simple
55 // messages like "No passwords". 50 // messages like "No passwords".
56 SINGLE_VIEW_COLUMN_SET = 0, 51 SINGLE_VIEW_COLUMN_SET = 0,
57 52
58 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | | 53 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | |
59 // Used for buttons at the bottom of the bubble which should nest at the 54 // Used for buttons at the bottom of the bubble which should nest at the
60 // bottom-right corner. 55 // bottom-right corner.
61 DOUBLE_BUTTON_COLUMN_SET = 1, 56 DOUBLE_BUTTON_COLUMN_SET = 1,
62 57
63 // | | (LEADING, CENTER) | | (TRAILING, CENTER) | | 58 // | | (LEADING, CENTER) | | (TRAILING, CENTER) | |
64 // Used for buttons at the bottom of the bubble which should occupy 59 // Used for buttons at the bottom of the bubble which should occupy
65 // the corners. 60 // the corners.
66 LINK_BUTTON_COLUMN_SET = 2, 61 LINK_BUTTON_COLUMN_SET = 2,
67 }; 62 };
68 63
69 ManagePasswordsBubbleView(content::WebContents* web_contents, 64 ManagePasswordsBubbleView(content::WebContents* web_contents,
70 views::View* anchor_view, 65 views::View* anchor_view,
71 ManagePasswordsIconView* icon_view, 66 ManagePasswordsIconView* icon_view,
72 BubbleDisplayReason reason); 67 DisplayReason reason);
73 virtual ~ManagePasswordsBubbleView(); 68 virtual ~ManagePasswordsBubbleView();
74 69
75 // Construct an appropriate ColumnSet for the given |type|, and add it 70 // Construct an appropriate ColumnSet for the given |type|, and add it
76 // to |layout|. 71 // to |layout|.
77 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type); 72 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type);
78 73
79 // If the bubble is not anchored to a view, places the bubble in the top 74 // If the bubble is not anchored to a view, places the bubble in the top
80 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s 75 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s
81 // browser window. Because the positioning is based on the size of the 76 // browser window. Because the positioning is based on the size of the
82 // bubble, this must be called after the bubble is created. 77 // bubble, this must be called after the bubble is created.
83 void AdjustForFullscreen(const gfx::Rect& screen_bounds); 78 void AdjustForFullscreen(const gfx::Rect& screen_bounds);
84 79
85 void Close(password_manager::metrics_util::UIDismissalReason reason); 80 void Close();
81
82 void CloseWithoutLogging();
markusheintz_ 2014/04/22 11:00:54 Why is this needed?
Mike West 2014/04/22 11:57:39 Done.
86 83
87 // views::BubbleDelegateView: 84 // views::BubbleDelegateView:
88 virtual void Init() OVERRIDE; 85 virtual void Init() OVERRIDE;
89 virtual void WindowClosing() OVERRIDE; 86 virtual void WindowClosing() OVERRIDE;
90 87
91 // views::ButtonListener: 88 // views::ButtonListener:
92 virtual void ButtonPressed(views::Button* sender, 89 virtual void ButtonPressed(views::Button* sender,
93 const ui::Event& event) OVERRIDE; 90 const ui::Event& event) OVERRIDE;
94 91
95 // views::LinkListener: 92 // views::LinkListener:
96 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 93 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
97 94
98 // Handles the event when the user changes an index of a combobox. 95 // Handles the event when the user changes an index of a combobox.
99 virtual void OnPerformAction(views::Combobox* source) OVERRIDE; 96 virtual void OnPerformAction(views::Combobox* source) OVERRIDE;
100 97
101 // Singleton instance of the Password bubble. The Password bubble can only be 98 // Singleton instance of the Password bubble. The Password bubble can only be
102 // shown on the active browser window, so there is no case in which it will be 99 // shown on the active browser window, so there is no case in which it will be
103 // shown twice at the same time. 100 // shown twice at the same time.
104 static ManagePasswordsBubbleView* manage_passwords_bubble_; 101 static ManagePasswordsBubbleView* manage_passwords_bubble_;
105 102
106 ManagePasswordsBubbleModel* manage_passwords_bubble_model_;
107 ManagePasswordsIconView* icon_view_; 103 ManagePasswordsIconView* icon_view_;
108 104
109 // The buttons that are shown in the bubble. 105 // The buttons that are shown in the bubble.
110 views::BlueButton* save_button_; 106 views::BlueButton* save_button_;
111 views::Combobox* refuse_combobox_; 107 views::Combobox* refuse_combobox_;
112 108
113 views::Link* manage_link_; 109 views::Link* manage_link_;
114 views::LabelButton* done_button_; 110 views::LabelButton* done_button_;
115 111
116 // We track the dismissal reason so we can log it correctly in the destructor.
117 password_manager::metrics_util::UIDismissalReason dismissal_reason_;
118
119 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); 112 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView);
120 }; 113 };
121 114
122 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_ 115 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698