Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| index 4f5bbbca35eb4e8b5f24d1077e8dd5e4683d79de..2411fc11b4a8c356dd581606e0feb9cfe0cbefed 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| @@ -389,19 +389,24 @@ class EditableProfileName : public views::View, |
| EditableProfileName(views::TextfieldController* controller, |
| const base::string16& text, |
| bool is_editing_allowed) |
| - : button_(new RightAlignedIconLabelButton(this, text)), |
| - profile_name_textfield_(new views::Textfield()) { |
| + : button_(nullptr), label_(nullptr), profile_name_textfield_(nullptr) { |
| + SetLayoutManager( |
| + new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| + |
| ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| const gfx::FontList& medium_font_list = |
| rb->GetFontList(ui::ResourceBundle::MediumFont); |
| - button_->SetFontList(medium_font_list); |
| - AddChildView(button_); |
| if (!is_editing_allowed) { |
| - button_->SetBorder(views::Border::CreateEmptyBorder(2, 0, 2, 0)); |
| + label_ = new views::Label(text); |
| + label_->SetBorder(views::Border::CreateEmptyBorder(2, 0, 2, 0)); |
| + label_->SetFontList(medium_font_list); |
| + AddChildView(label_); |
| return; |
| } |
| + button_ = new RightAlignedIconLabelButton(this, text); |
| + button_->SetFontList(medium_font_list); |
| // Show an "edit" pencil icon when hovering over. In the default state, |
| // we need to create an empty placeholder of the correct size, so that |
| // the text doesn't jump around when the hovered icon appears. |
| @@ -423,15 +428,14 @@ class EditableProfileName : public views::View, |
| const int kIconTextLabelButtonSpacing = 5; |
| button_->SetBorder(views::Border::CreateEmptyBorder( |
| 2, kIconSize + kIconTextLabelButtonSpacing, 2, 0)); |
| + AddChildView(button_); |
| + profile_name_textfield_ = new views::Textfield(); |
| // Textfield that overlaps the button. |
| profile_name_textfield_->set_controller(controller); |
| profile_name_textfield_->SetFontList(medium_font_list); |
| profile_name_textfield_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| profile_name_textfield_->SetVisible(false); |
| - |
| - SetLayoutManager( |
| - new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| AddChildView(profile_name_textfield_); |
| } |
| @@ -467,6 +471,8 @@ class EditableProfileName : public views::View, |
| RightAlignedIconLabelButton* button_; |
| + views::Label* label_; |
|
Peter Kasting
2016/03/29 02:30:41
Nit: I suggest giving these members comments notin
Shu Chen
2016/03/29 04:39:56
Done.
|
| + |
| // Textfield that is shown when editing the profile name. Can be NULL if |
| // the profile name isn't allowed to be edited (e.g. for guest profiles). |
| views::Textfield* profile_name_textfield_; |