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/about_flags.h" | 9 #include "chrome/browser/about_flags.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // A custom Image control that shows a "change" button when moused over. | 151 // A custom Image control that shows a "change" button when moused over. |
152 class EditableProfilePhoto : public views::ImageView { | 152 class EditableProfilePhoto : public views::ImageView { |
153 public: | 153 public: |
154 EditableProfilePhoto(views::ButtonListener* listener, | 154 EditableProfilePhoto(views::ButtonListener* listener, |
155 const gfx::Image& icon, | 155 const gfx::Image& icon, |
156 bool is_editing_allowed) | 156 bool is_editing_allowed) |
157 : views::ImageView(), | 157 : views::ImageView(), |
158 change_photo_button_(NULL) { | 158 change_photo_button_(NULL) { |
159 const int kLargeImageSide = 64; | 159 const int kLargeImageSide = 64; |
160 gfx::Image image = profiles::GetSizedAvatarIconWithBorder( | 160 gfx::Image image = profiles::GetSizedAvatarIcon( |
161 icon, true, | 161 icon, true, |
162 kLargeImageSide + profiles::kAvatarIconPadding, | 162 kLargeImageSide + profiles::kAvatarIconPadding, |
163 kLargeImageSide + profiles::kAvatarIconPadding); | 163 kLargeImageSide + profiles::kAvatarIconPadding); |
164 SetImage(image.ToImageSkia()); | 164 SetImage(image.ToImageSkia()); |
165 | 165 |
166 if (!is_editing_allowed) | 166 if (!is_editing_allowed) |
167 return; | 167 return; |
168 | 168 |
169 set_notify_enter_exit_on_child(true); | 169 set_notify_enter_exit_on_child(true); |
170 | 170 |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 views::GridLayout* layout = CreateSingleColumnLayout( | 919 views::GridLayout* layout = CreateSingleColumnLayout( |
920 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); | 920 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); |
921 layout->SetInsets(0, views::kButtonHEdgeMarginNew, | 921 layout->SetInsets(0, views::kButtonHEdgeMarginNew, |
922 views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew); | 922 views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew); |
923 int num_avatars_to_show = avatars_to_show.size(); | 923 int num_avatars_to_show = avatars_to_show.size(); |
924 for (int i = 0; i < num_avatars_to_show; ++i) { | 924 for (int i = 0; i < num_avatars_to_show; ++i) { |
925 const size_t index = avatars_to_show[i]; | 925 const size_t index = avatars_to_show[i]; |
926 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); | 926 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); |
927 const int kSmallImageSide = 32; | 927 const int kSmallImageSide = 32; |
928 | 928 |
929 gfx::Image image = profiles::GetSizedAvatarIconWithBorder( | 929 gfx::Image image = profiles::GetSizedAvatarIcon( |
930 item.icon, true, | 930 item.icon, true, |
931 kSmallImageSide + profiles::kAvatarIconPadding, | 931 kSmallImageSide + profiles::kAvatarIconPadding, |
932 kSmallImageSide + profiles::kAvatarIconPadding); | 932 kSmallImageSide + profiles::kAvatarIconPadding); |
933 | 933 |
934 views::LabelButton* button = new views::LabelButton(this, item.name); | 934 views::LabelButton* button = new views::LabelButton(this, item.name); |
935 open_other_profile_indexes_map_[button] = index; | 935 open_other_profile_indexes_map_[button] = index; |
936 button->SetImage(views::Button::STATE_NORMAL, *image.ToImageSkia()); | 936 button->SetImage(views::Button::STATE_NORMAL, *image.ToImageSkia()); |
937 button->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 937 button->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
938 ui::ResourceBundle::MediumFont)); | 938 ui::ResourceBundle::MediumFont)); |
939 button->SetBorder(views::Border::NullBorder()); | 939 button->SetBorder(views::Border::NullBorder()); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 g_browser_process->local_state()); | 1198 g_browser_process->local_state()); |
1199 about_flags::SetExperimentEnabled( | 1199 about_flags::SetExperimentEnabled( |
1200 &flags_storage, | 1200 &flags_storage, |
1201 kNewProfileManagementExperimentInternalName, | 1201 kNewProfileManagementExperimentInternalName, |
1202 true); | 1202 true); |
1203 | 1203 |
1204 CommandLine::ForCurrentProcess()->AppendSwitch( | 1204 CommandLine::ForCurrentProcess()->AppendSwitch( |
1205 switches::kNewProfileManagement); | 1205 switches::kNewProfileManagement); |
1206 chrome::ShowUserManager(base::FilePath()); | 1206 chrome::ShowUserManager(base::FilePath()); |
1207 } | 1207 } |
OLD | NEW |