| 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..8f1998b1d8e2a8a0e3607f99d421b21eefcb88d4 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_);
|
| }
|
|
|
| @@ -465,8 +469,15 @@ class EditableProfileName : public views::View,
|
| return false;
|
| }
|
|
|
| + // The label button which shows the profile name, and can handle the event to
|
| + // make it editable. Can be NULL if the profile name isn't allowed to be
|
| + // edited.
|
| RightAlignedIconLabelButton* button_;
|
|
|
| + // The label which shows when the profile name cannot be edited (e.g. for
|
| + // supervised user). Can be NULL if the profile name is allowed to be edited.
|
| + views::Label* label_;
|
| +
|
| // 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_;
|
|
|