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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 }; | 142 }; |
143 | 143 |
144 BackgroundColorHoverButton::BackgroundColorHoverButton( | 144 BackgroundColorHoverButton::BackgroundColorHoverButton( |
145 views::ButtonListener* listener, | 145 views::ButtonListener* listener, |
146 const base::string16& text, | 146 const base::string16& text, |
147 const gfx::ImageSkia& normal_icon, | 147 const gfx::ImageSkia& normal_icon, |
148 const gfx::ImageSkia& hover_icon) | 148 const gfx::ImageSkia& hover_icon) |
149 : views::LabelButton(listener, text) { | 149 : views::LabelButton(listener, text) { |
150 SetBorder(views::Border::CreateEmptyBorder(0, views::kButtonHEdgeMarginNew, | 150 SetBorder(views::Border::CreateEmptyBorder(0, views::kButtonHEdgeMarginNew, |
151 0, views::kButtonHEdgeMarginNew)); | 151 0, views::kButtonHEdgeMarginNew)); |
152 set_min_size(gfx::Size(0, kButtonHeight)); | 152 SetMinSize(gfx::Size(0, kButtonHeight)); |
153 SetImage(STATE_NORMAL, normal_icon); | 153 SetImage(STATE_NORMAL, normal_icon); |
154 SetImage(STATE_HOVERED, hover_icon); | 154 SetImage(STATE_HOVERED, hover_icon); |
155 SetImage(STATE_PRESSED, hover_icon); | 155 SetImage(STATE_PRESSED, hover_icon); |
156 } | 156 } |
157 | 157 |
158 BackgroundColorHoverButton::~BackgroundColorHoverButton() {} | 158 BackgroundColorHoverButton::~BackgroundColorHoverButton() {} |
159 | 159 |
160 void BackgroundColorHoverButton::OnPaint(gfx::Canvas* canvas) { | 160 void BackgroundColorHoverButton::OnPaint(gfx::Canvas* canvas) { |
161 if ((state() == STATE_PRESSED) || (state() == STATE_HOVERED) || HasFocus()) { | 161 if ((state() == STATE_PRESSED) || (state() == STATE_HOVERED) || HasFocus()) { |
162 canvas->DrawColor(GetNativeTheme()->GetSystemColor( | 162 canvas->DrawColor(GetNativeTheme()->GetSystemColor( |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 const int kSmallImageSide = 32; | 1160 const int kSmallImageSide = 32; |
1161 | 1161 |
1162 gfx::Image image = profiles::GetSizedAvatarIcon( | 1162 gfx::Image image = profiles::GetSizedAvatarIcon( |
1163 item.icon, true, kSmallImageSide, kSmallImageSide); | 1163 item.icon, true, kSmallImageSide, kSmallImageSide); |
1164 | 1164 |
1165 views::LabelButton* button = new BackgroundColorHoverButton( | 1165 views::LabelButton* button = new BackgroundColorHoverButton( |
1166 this, | 1166 this, |
1167 item.name, | 1167 item.name, |
1168 *image.ToImageSkia(), | 1168 *image.ToImageSkia(), |
1169 *image.ToImageSkia()); | 1169 *image.ToImageSkia()); |
1170 button->set_min_size(gfx::Size( | 1170 button->SetMinSize(gfx::Size( |
1171 0, kButtonHeight + views::kRelatedControlVerticalSpacing)); | 1171 0, kButtonHeight + views::kRelatedControlVerticalSpacing)); |
1172 | 1172 |
1173 open_other_profile_indexes_map_[button] = index; | 1173 open_other_profile_indexes_map_[button] = index; |
1174 | 1174 |
1175 layout->StartRow(1, 0); | 1175 layout->StartRow(1, 0); |
1176 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 1176 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
1177 layout->StartRow(1, 0); | 1177 layout->StartRow(1, 0); |
1178 layout->AddView(button); | 1178 layout->AddView(button); |
1179 } | 1179 } |
1180 | 1180 |
(...skipping 29 matching lines...) Expand all Loading... |
1210 l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) : | 1210 l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) : |
1211 l10n_util::GetStringFUTF16(IDS_PROFILES_NOT_YOU_BUTTON, | 1211 l10n_util::GetStringFUTF16(IDS_PROFILES_NOT_YOU_BUTTON, |
1212 profiles::GetAvatarNameForProfile( | 1212 profiles::GetAvatarNameForProfile( |
1213 browser_->profile()->GetPath())); | 1213 browser_->profile()->GetPath())); |
1214 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1214 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1215 users_button_ = new BackgroundColorHoverButton( | 1215 users_button_ = new BackgroundColorHoverButton( |
1216 this, | 1216 this, |
1217 text, | 1217 text, |
1218 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_AVATAR), | 1218 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_AVATAR), |
1219 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_AVATAR)); | 1219 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_AVATAR)); |
1220 users_button_->set_min_size(gfx::Size( | 1220 users_button_->SetMinSize(gfx::Size( |
1221 0, kButtonHeight + views::kRelatedControlVerticalSpacing)); | 1221 0, kButtonHeight + views::kRelatedControlVerticalSpacing)); |
1222 | 1222 |
1223 layout->StartRow(1, 0); | 1223 layout->StartRow(1, 0); |
1224 layout->AddView(users_button_); | 1224 layout->AddView(users_button_); |
1225 | 1225 |
1226 if (enable_lock) { | 1226 if (enable_lock) { |
1227 lock_button_ = new BackgroundColorHoverButton( | 1227 lock_button_ = new BackgroundColorHoverButton( |
1228 this, | 1228 this, |
1229 base::string16(), | 1229 base::string16(), |
1230 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_LOCK), | 1230 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_LOCK), |
1231 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_LOCK)); | 1231 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_LOCK)); |
1232 lock_button_->set_min_size(gfx::Size( | 1232 lock_button_->SetMinSize(gfx::Size( |
1233 0, kButtonHeight + views::kRelatedControlVerticalSpacing)); | 1233 0, kButtonHeight + views::kRelatedControlVerticalSpacing)); |
1234 layout->AddView(lock_button_); | 1234 layout->AddView(lock_button_); |
1235 } | 1235 } |
1236 return view; | 1236 return view; |
1237 } | 1237 } |
1238 | 1238 |
1239 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { | 1239 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { |
1240 views::View* view = new views::View(); | 1240 views::View* view = new views::View(); |
1241 views::GridLayout* layout = CreateSingleColumnLayout( | 1241 views::GridLayout* layout = CreateSingleColumnLayout( |
1242 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); | 1242 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 layout->StartRowWithPadding( | 1493 layout->StartRowWithPadding( |
1494 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1494 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1495 layout->AddView(end_preview_and_relaunch_button_); | 1495 layout->AddView(end_preview_and_relaunch_button_); |
1496 | 1496 |
1497 TitleCard* title_card = new TitleCard( | 1497 TitleCard* title_card = new TitleCard( |
1498 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); | 1498 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); |
1499 return TitleCard::AddPaddedTitleCard( | 1499 return TitleCard::AddPaddedTitleCard( |
1500 view, title_card, kFixedAccountRemovalViewWidth); | 1500 view, title_card, kFixedAccountRemovalViewWidth); |
1501 } | 1501 } |
1502 | 1502 |
OLD | NEW |