Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 public: | 388 public: |
| 389 EditableProfileName(views::TextfieldController* controller, | 389 EditableProfileName(views::TextfieldController* controller, |
| 390 const base::string16& text, | 390 const base::string16& text, |
| 391 bool is_editing_allowed) | 391 bool is_editing_allowed) |
| 392 : button_(new RightAlignedIconLabelButton(this, text)), | 392 : button_(new RightAlignedIconLabelButton(this, text)), |
| 393 profile_name_textfield_(new views::Textfield()) { | 393 profile_name_textfield_(new views::Textfield()) { |
| 394 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 394 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 395 const gfx::FontList& medium_font_list = | 395 const gfx::FontList& medium_font_list = |
| 396 rb->GetFontList(ui::ResourceBundle::MediumFont); | 396 rb->GetFontList(ui::ResourceBundle::MediumFont); |
| 397 button_->SetFontList(medium_font_list); | 397 button_->SetFontList(medium_font_list); |
| 398 AddChildView(button_); | |
| 398 | 399 |
| 399 if (!is_editing_allowed) { | 400 if (!is_editing_allowed) { |
| 400 button_->SetBorder(views::Border::CreateEmptyBorder(2, 0, 2, 0)); | 401 button_->SetBorder(views::Border::CreateEmptyBorder(2, 0, 2, 0)); |
| 401 return; | 402 return; |
| 402 } | 403 } |
| 403 | 404 |
| 404 // Show an "edit" pencil icon when hovering over. In the default state, | 405 // Show an "edit" pencil icon when hovering over. In the default state, |
| 405 // we need to create an empty placeholder of the correct size, so that | 406 // we need to create an empty placeholder of the correct size, so that |
| 406 // the text doesn't jump around when the hovered icon appears. | 407 // the text doesn't jump around when the hovered icon appears. |
| 407 // TODO(estade): revisit colors and press effect. | 408 // TODO(estade): revisit colors and press effect. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 423 button_->SetBorder(views::Border::CreateEmptyBorder( | 424 button_->SetBorder(views::Border::CreateEmptyBorder( |
| 424 2, kIconSize + kIconTextLabelButtonSpacing, 2, 0)); | 425 2, kIconSize + kIconTextLabelButtonSpacing, 2, 0)); |
| 425 | 426 |
| 426 // Textfield that overlaps the button. | 427 // Textfield that overlaps the button. |
| 427 profile_name_textfield_->set_controller(controller); | 428 profile_name_textfield_->set_controller(controller); |
| 428 profile_name_textfield_->SetFontList(medium_font_list); | 429 profile_name_textfield_->SetFontList(medium_font_list); |
| 429 profile_name_textfield_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 430 profile_name_textfield_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 430 profile_name_textfield_->SetVisible(false); | 431 profile_name_textfield_->SetVisible(false); |
| 431 | 432 |
| 432 SetLayoutManager( | 433 SetLayoutManager( |
| 433 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 434 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
|
Peter Kasting
2016/03/25 04:34:45
We don't need this to be moved up as well, because
Shu Chen
2016/03/25 05:48:11
Yes, that is right.
Shu Chen
2016/03/27 08:08:06
Sorry, the issue still repro on the latest canary.
| |
| 434 AddChildView(button_); | |
| 435 AddChildView(profile_name_textfield_); | 435 AddChildView(profile_name_textfield_); |
| 436 } | 436 } |
| 437 | 437 |
| 438 views::Textfield* profile_name_textfield() { | 438 views::Textfield* profile_name_textfield() { |
| 439 return profile_name_textfield_; | 439 return profile_name_textfield_; |
| 440 } | 440 } |
| 441 | 441 |
| 442 // Hide the editable textfield to show the profile name button instead. | 442 // Hide the editable textfield to show the profile name button instead. |
| 443 void ShowReadOnlyView() { | 443 void ShowReadOnlyView() { |
| 444 button_->SetVisible(true); | 444 button_->SetVisible(true); |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1867 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1867 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1868 IncognitoModePrefs::DISABLED; | 1868 IncognitoModePrefs::DISABLED; |
| 1869 return incognito_available && !browser_->profile()->IsGuestSession(); | 1869 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1870 } | 1870 } |
| 1871 | 1871 |
| 1872 void ProfileChooserView::PostActionPerformed( | 1872 void ProfileChooserView::PostActionPerformed( |
| 1873 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1873 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1874 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1874 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1875 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1875 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1876 } | 1876 } |
| OLD | NEW |