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..27e484dc981e2f774037de56361eb69377ca70fc 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| @@ -390,7 +390,10 @@ class EditableProfileName : public views::View, |
| const base::string16& text, |
| bool is_editing_allowed) |
| : button_(new RightAlignedIconLabelButton(this, text)), |
| - profile_name_textfield_(new views::Textfield()) { |
| + profile_name_textfield_(new views::Textfield()), |
| + is_editing_allowed_(is_editing_allowed) { |
| + SetLayoutManager( |
| + new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
|
Peter Kasting
2016/03/28 04:17:13
Nit: Add blank line below
Shu Chen
2016/03/28 07:33:30
Done.
|
| ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| const gfx::FontList& medium_font_list = |
| rb->GetFontList(ui::ResourceBundle::MediumFont); |
| @@ -430,8 +433,6 @@ class EditableProfileName : public views::View, |
| profile_name_textfield_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| profile_name_textfield_->SetVisible(false); |
|
Peter Kasting
2016/03/28 04:17:14
Nit: Remove this line
Shu Chen
2016/03/28 07:33:30
Done.
|
| - SetLayoutManager( |
| - new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| AddChildView(profile_name_textfield_); |
| } |
| @@ -448,6 +449,8 @@ class EditableProfileName : public views::View, |
| private: |
| // views::ButtonListener: |
| void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
| + if (!is_editing_allowed_) |
| + return; |
| button_->SetVisible(false); |
| profile_name_textfield_->SetVisible(true); |
| profile_name_textfield_->SetText(button_->GetText()); |
| @@ -471,6 +474,8 @@ class EditableProfileName : public views::View, |
| // the profile name isn't allowed to be edited (e.g. for guest profiles). |
| views::Textfield* profile_name_textfield_; |
| + bool is_editing_allowed_; |
|
Peter Kasting
2016/03/28 04:17:13
Hmm. Maybe instead of adding this, we should use
Shu Chen
2016/03/28 07:33:30
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(EditableProfileName); |
| }; |