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 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 7 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 // Render credentials in two columns: username and password. | 82 // Render credentials in two columns: username and password. |
83 class ManagePasswordItemView::PendingView : public views::View { | 83 class ManagePasswordItemView::PendingView : public views::View { |
84 public: | 84 public: |
85 explicit PendingView(ManagePasswordItemView* parent); | 85 explicit PendingView(ManagePasswordItemView* parent); |
86 | 86 |
87 private: | 87 private: |
88 virtual ~PendingView(); | 88 ~PendingView() override; |
89 }; | 89 }; |
90 | 90 |
91 ManagePasswordItemView::PendingView::PendingView( | 91 ManagePasswordItemView::PendingView::PendingView( |
92 ManagePasswordItemView* parent) { | 92 ManagePasswordItemView* parent) { |
93 views::GridLayout* layout = new views::GridLayout(this); | 93 views::GridLayout* layout = new views::GridLayout(this); |
94 SetLayoutManager(layout); | 94 SetLayoutManager(layout); |
95 | 95 |
96 BuildColumnSet(layout, TWO_COLUMN_SET); | 96 BuildColumnSet(layout, TWO_COLUMN_SET); |
97 layout->StartRowWithPadding( | 97 layout->StartRowWithPadding( |
98 0, TWO_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing); | 98 0, TWO_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing); |
99 layout->AddView(GenerateUsernameLabel(parent->password_form_)); | 99 layout->AddView(GenerateUsernameLabel(parent->password_form_)); |
100 layout->AddView(GeneratePasswordLabel(parent->password_form_)); | 100 layout->AddView(GeneratePasswordLabel(parent->password_form_)); |
101 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 101 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
102 } | 102 } |
103 | 103 |
104 ManagePasswordItemView::PendingView::~PendingView() { | 104 ManagePasswordItemView::PendingView::~PendingView() { |
105 } | 105 } |
106 | 106 |
107 // Render credentials in three columns: username, password, and delete. | 107 // Render credentials in three columns: username, password, and delete. |
108 class ManagePasswordItemView::ManageView : public views::View, | 108 class ManagePasswordItemView::ManageView : public views::View, |
109 public views::ButtonListener { | 109 public views::ButtonListener { |
110 public: | 110 public: |
111 explicit ManageView(ManagePasswordItemView* parent); | 111 explicit ManageView(ManagePasswordItemView* parent); |
112 | 112 |
113 private: | 113 private: |
114 virtual ~ManageView(); | 114 ~ManageView() override; |
115 | 115 |
116 // views::ButtonListener: | 116 // views::ButtonListener: |
117 virtual void ButtonPressed(views::Button* sender, | 117 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
118 const ui::Event& event) override; | |
119 | 118 |
120 views::ImageButton* delete_button_; | 119 views::ImageButton* delete_button_; |
121 ManagePasswordItemView* parent_; | 120 ManagePasswordItemView* parent_; |
122 }; | 121 }; |
123 | 122 |
124 ManagePasswordItemView::ManageView::ManageView(ManagePasswordItemView* parent) | 123 ManagePasswordItemView::ManageView::ManageView(ManagePasswordItemView* parent) |
125 : parent_(parent) { | 124 : parent_(parent) { |
126 views::GridLayout* layout = new views::GridLayout(this); | 125 views::GridLayout* layout = new views::GridLayout(this); |
127 SetLayoutManager(layout); | 126 SetLayoutManager(layout); |
128 | 127 |
(...skipping 25 matching lines...) Expand all Loading... |
154 } | 153 } |
155 | 154 |
156 // Render a notification to the user that a password has been removed, and | 155 // Render a notification to the user that a password has been removed, and |
157 // offer an undo link. | 156 // offer an undo link. |
158 class ManagePasswordItemView::UndoView : public views::View, | 157 class ManagePasswordItemView::UndoView : public views::View, |
159 public views::LinkListener { | 158 public views::LinkListener { |
160 public: | 159 public: |
161 explicit UndoView(ManagePasswordItemView* parent); | 160 explicit UndoView(ManagePasswordItemView* parent); |
162 | 161 |
163 private: | 162 private: |
164 virtual ~UndoView(); | 163 ~UndoView() override; |
165 | 164 |
166 // views::LinkListener: | 165 // views::LinkListener: |
167 virtual void LinkClicked(views::Link* source, int event_flags) override; | 166 void LinkClicked(views::Link* source, int event_flags) override; |
168 | 167 |
169 views::Link* undo_link_; | 168 views::Link* undo_link_; |
170 ManagePasswordItemView* parent_; | 169 ManagePasswordItemView* parent_; |
171 }; | 170 }; |
172 | 171 |
173 ManagePasswordItemView::UndoView::UndoView(ManagePasswordItemView* parent) | 172 ManagePasswordItemView::UndoView::UndoView(ManagePasswordItemView* parent) |
174 : parent_(parent) { | 173 : parent_(parent) { |
175 views::GridLayout* layout = new views::GridLayout(this); | 174 views::GridLayout* layout = new views::GridLayout(this); |
176 SetLayoutManager(layout); | 175 SetLayoutManager(layout); |
177 | 176 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 AddChildView(new ManageView(this)); | 258 AddChildView(new ManageView(this)); |
260 GetLayoutManager()->Layout(this); | 259 GetLayoutManager()->Layout(this); |
261 | 260 |
262 // After the view is consistent, notify the model that the password needs to | 261 // After the view is consistent, notify the model that the password needs to |
263 // be updated (either removed or put back into the store, as appropriate. | 262 // be updated (either removed or put back into the store, as appropriate. |
264 model_->OnPasswordAction(password_form_, | 263 model_->OnPasswordAction(password_form_, |
265 delete_password_ | 264 delete_password_ |
266 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD | 265 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD |
267 : ManagePasswordsBubbleModel::ADD_PASSWORD); | 266 : ManagePasswordsBubbleModel::ADD_PASSWORD); |
268 } | 267 } |
OLD | NEW |