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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 views::kRelatedControlVerticalSpacing, 0)); | 1077 views::kRelatedControlVerticalSpacing, 0)); |
1078 layout->StartRow(1, 0); | 1078 layout->StartRow(1, 0); |
1079 layout->AddView(add_account_link_); | 1079 layout->AddView(add_account_link_); |
1080 return view; | 1080 return view; |
1081 } | 1081 } |
1082 | 1082 |
1083 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, | 1083 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, |
1084 const std::string& account, | 1084 const std::string& account, |
1085 bool is_primary_account, | 1085 bool is_primary_account, |
1086 int width) { | 1086 int width) { |
| 1087 const int kDeleteButtonWidth = 18; |
| 1088 int available_width = width - |
| 1089 kDeleteButtonWidth - views::kButtonHEdgeMarginNew; |
| 1090 |
1087 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1091 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1088 const gfx::ImageSkia* menu_marker = | |
1089 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); | |
1090 | |
1091 views::LabelButton* email_button = new BackgroundColorHoverButton( | 1092 views::LabelButton* email_button = new BackgroundColorHoverButton( |
1092 this, | 1093 NULL, |
1093 gfx::ElideEmail(base::UTF8ToUTF16(account), | 1094 gfx::ElideEmail(base::UTF8ToUTF16(account), |
1094 rb->GetFontList(ui::ResourceBundle::BaseFont), | 1095 rb->GetFontList(ui::ResourceBundle::BaseFont), |
1095 width - menu_marker->width()), | 1096 available_width), |
1096 gfx::ImageSkia(), | 1097 gfx::ImageSkia(), |
1097 gfx::ImageSkia()); | 1098 gfx::ImageSkia()); |
1098 layout->StartRow(1, 0); | 1099 layout->StartRow(1, 0); |
1099 layout->AddView(email_button); | 1100 layout->AddView(email_button); |
1100 | 1101 |
| 1102 // Delete button. |
| 1103 views::ImageButton* delete_button = new views::ImageButton(this); |
| 1104 delete_button->SetImageAlignment(views::ImageButton::ALIGN_RIGHT, |
| 1105 views::ImageButton::ALIGN_MIDDLE); |
| 1106 delete_button->SetImage(views::ImageButton::STATE_NORMAL, |
| 1107 rb->GetImageSkiaNamed(IDR_CLOSE_1)); |
| 1108 delete_button->SetImage(views::ImageButton::STATE_HOVERED, |
| 1109 rb->GetImageSkiaNamed(IDR_CLOSE_1_H)); |
| 1110 delete_button->SetImage(views::ImageButton::STATE_PRESSED, |
| 1111 rb->GetImageSkiaNamed(IDR_CLOSE_1_P)); |
| 1112 delete_button->SetBounds( |
| 1113 available_width, 0, kDeleteButtonWidth, kButtonHeight); |
| 1114 |
| 1115 email_button->set_notify_enter_exit_on_child(true); |
| 1116 email_button->AddChildView(delete_button); |
| 1117 |
1101 // Save the original email address, as the button text could be elided. | 1118 // Save the original email address, as the button text could be elided. |
1102 current_profile_accounts_map_[email_button] = account; | 1119 current_profile_accounts_map_[delete_button] = account; |
1103 } | 1120 } |
1104 | 1121 |
1105 views::View* ProfileChooserView::CreateGaiaSigninView( | 1122 views::View* ProfileChooserView::CreateGaiaSigninView( |
1106 bool add_secondary_account) { | 1123 bool add_secondary_account) { |
1107 views::View* view = new views::View(); | 1124 views::View* view = new views::View(); |
1108 views::GridLayout* layout = | 1125 views::GridLayout* layout = |
1109 CreateSingleColumnLayout(view, kFixedGaiaViewWidth); | 1126 CreateSingleColumnLayout(view, kFixedGaiaViewWidth); |
1110 | 1127 |
1111 // Adds title. | 1128 // Adds title. |
1112 views::View* padded_title = new views::View(); | 1129 views::View* padded_title = new views::View(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 this, l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW_AND_RELAUNCH)); | 1272 this, l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW_AND_RELAUNCH)); |
1256 end_preview_and_relaunch_button_->SetHorizontalAlignment( | 1273 end_preview_and_relaunch_button_->SetHorizontalAlignment( |
1257 gfx::ALIGN_CENTER); | 1274 gfx::ALIGN_CENTER); |
1258 layout->StartRowWithPadding( | 1275 layout->StartRowWithPadding( |
1259 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1276 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1260 layout->AddView(end_preview_and_relaunch_button_); | 1277 layout->AddView(end_preview_and_relaunch_button_); |
1261 | 1278 |
1262 return view; | 1279 return view; |
1263 } | 1280 } |
1264 | 1281 |
OLD | NEW |