Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 2675983003: views::Separator cleanup. (Closed)
Patch Set: revert test change Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 int available_width = width - 2 * views::kButtonHEdgeMarginNew; 694 int available_width = width - 2 * views::kButtonHEdgeMarginNew;
695 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, 695 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0,
696 views::GridLayout::FIXED, available_width, available_width); 696 views::GridLayout::FIXED, available_width, available_width);
697 columns->AddPaddingColumn(1, views::kButtonHEdgeMarginNew); 697 columns->AddPaddingColumn(1, views::kButtonHEdgeMarginNew);
698 layout->AddColumnSet(1)->AddColumn(views::GridLayout::FILL, 698 layout->AddColumnSet(1)->AddColumn(views::GridLayout::FILL,
699 views::GridLayout::FILL, 0,views::GridLayout::FIXED, width, width); 699 views::GridLayout::FILL, 0,views::GridLayout::FIXED, width, width);
700 700
701 layout->StartRowWithPadding(1, 0, 0, kVerticalSpacing); 701 layout->StartRowWithPadding(1, 0, 0, kVerticalSpacing);
702 layout->AddView(title_card); 702 layout->AddView(title_card);
703 layout->StartRowWithPadding(1, 1, 0, kVerticalSpacing); 703 layout->StartRowWithPadding(1, 1, 0, kVerticalSpacing);
704 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 704 layout->AddView(new views::Separator());
705 705
706 layout->StartRow(1, 1); 706 layout->StartRow(1, 1);
707 layout->AddView(view); 707 layout->AddView(view);
708 708
709 return titled_view; 709 return titled_view;
710 } 710 }
711 711
712 private: 712 private:
713 void Layout() override { 713 void Layout() override {
714 int back_button_width = back_button_->GetPreferredSize().width(); 714 int back_button_width = back_button_->GetPreferredSize().width();
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 layout->StartRow(1, 0); 1287 layout->StartRow(1, 0);
1288 layout->AddView(tutorial_view); 1288 layout->AddView(tutorial_view);
1289 } else { 1289 } else {
1290 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; 1290 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE;
1291 } 1291 }
1292 1292
1293 if (sync_error_view) { 1293 if (sync_error_view) {
1294 layout->StartRow(1, 0); 1294 layout->StartRow(1, 0);
1295 layout->AddView(sync_error_view); 1295 layout->AddView(sync_error_view);
1296 layout->StartRow(0, 0); 1296 layout->StartRow(0, 0);
1297 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1297 layout->AddView(new views::Separator());
1298 } 1298 }
1299 1299
1300 if (!current_profile_view) { 1300 if (!current_profile_view) {
1301 // Guest windows don't have an active profile. 1301 // Guest windows don't have an active profile.
1302 current_profile_view = CreateGuestProfileView(); 1302 current_profile_view = CreateGuestProfileView();
1303 option_buttons_view = CreateOptionsView(false, avatar_menu); 1303 option_buttons_view = CreateOptionsView(false, avatar_menu);
1304 } 1304 }
1305 1305
1306 layout->StartRow(1, 0); 1306 layout->StartRow(1, 0);
1307 layout->AddView(current_profile_view); 1307 layout->AddView(current_profile_view);
1308 1308
1309 if (!IsProfileChooser(view_mode_)) { 1309 if (!IsProfileChooser(view_mode_)) {
1310 DCHECK(current_profile_accounts); 1310 DCHECK(current_profile_accounts);
1311 layout->StartRow(0, 0); 1311 layout->StartRow(0, 0);
1312 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1312 layout->AddView(new views::Separator());
1313 layout->StartRow(1, 0); 1313 layout->StartRow(1, 0);
1314 layout->AddView(current_profile_accounts); 1314 layout->AddView(current_profile_accounts);
1315 } 1315 }
1316 1316
1317 if (browser_->profile()->IsSupervised()) { 1317 if (browser_->profile()->IsSupervised()) {
1318 if (!switches::IsMaterialDesignUserMenu()) { 1318 if (!switches::IsMaterialDesignUserMenu()) {
1319 layout->StartRow(0, 0); 1319 layout->StartRow(0, 0);
1320 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1320 layout->AddView(new views::Separator());
1321 } 1321 }
1322 layout->StartRow(1, 0); 1322 layout->StartRow(1, 0);
1323 layout->AddView(CreateSupervisedUserDisclaimerView()); 1323 layout->AddView(CreateSupervisedUserDisclaimerView());
1324 } 1324 }
1325 1325
1326 layout->StartRow(0, 0); 1326 layout->StartRow(0, 0);
1327 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1327 layout->AddView(new views::Separator());
1328 1328
1329 if (option_buttons_view) { 1329 if (option_buttons_view) {
1330 layout->StartRow(0, 0); 1330 layout->StartRow(0, 0);
1331 layout->AddView(option_buttons_view); 1331 layout->AddView(option_buttons_view);
1332 } 1332 }
1333 } 1333 }
1334 1334
1335 void ProfileChooserView::PopulateMinimalProfileChooserView( 1335 void ProfileChooserView::PopulateMinimalProfileChooserView(
1336 views::GridLayout* layout, 1336 views::GridLayout* layout,
1337 AvatarMenu* avatar_menu) { 1337 AvatarMenu* avatar_menu) {
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 gfx::Image image = profiles::GetSizedAvatarIcon( 1879 gfx::Image image = profiles::GetSizedAvatarIcon(
1880 item_icon, true, kSmallImageSide, kSmallImageSide); 1880 item_icon, true, kSmallImageSide, kSmallImageSide);
1881 1881
1882 views::LabelButton* button = new BackgroundColorHoverButton( 1882 views::LabelButton* button = new BackgroundColorHoverButton(
1883 this, 1883 this,
1884 profiles::GetProfileSwitcherTextForItem(item), 1884 profiles::GetProfileSwitcherTextForItem(item),
1885 *image.ToImageSkia()); 1885 *image.ToImageSkia());
1886 open_other_profile_indexes_map_[button] = index; 1886 open_other_profile_indexes_map_[button] = index;
1887 1887
1888 layout->StartRow(1, 0); 1888 layout->StartRow(1, 0);
1889 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1889 layout->AddView(new views::Separator());
1890 layout->StartRow(1, 0); 1890 layout->StartRow(1, 0);
1891 layout->AddView(button); 1891 layout->AddView(button);
1892 } 1892 }
1893 1893
1894 return view; 1894 return view;
1895 } 1895 }
1896 1896
1897 views::View* ProfileChooserView::CreateOptionsView(bool display_lock, 1897 views::View* ProfileChooserView::CreateOptionsView(bool display_lock,
1898 AvatarMenu* avatar_menu) { 1898 AvatarMenu* avatar_menu) {
1899 views::View* view = new views::View(); 1899 views::View* view = new views::View();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 } 1954 }
1955 users_button_ = new BackgroundColorHoverButton( 1955 users_button_ = new BackgroundColorHoverButton(
1956 this, text, gfx::CreateVectorIcon(settings_icon, kIconSize, 1956 this, text, gfx::CreateVectorIcon(settings_icon, kIconSize,
1957 gfx::kChromeIconGrey)); 1957 gfx::kChromeIconGrey));
1958 1958
1959 layout->StartRow(1, 0); 1959 layout->StartRow(1, 0);
1960 layout->AddView(users_button_); 1960 layout->AddView(users_button_);
1961 1961
1962 if (!switches::IsMaterialDesignUserMenu() && ShouldShowGoIncognito()) { 1962 if (!switches::IsMaterialDesignUserMenu() && ShouldShowGoIncognito()) {
1963 layout->StartRow(1, 0); 1963 layout->StartRow(1, 0);
1964 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1964 layout->AddView(new views::Separator());
1965 1965
1966 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1966 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1967 go_incognito_button_ = new BackgroundColorHoverButton( 1967 go_incognito_button_ = new BackgroundColorHoverButton(
1968 this, 1968 this,
1969 l10n_util::GetStringUTF16(IDS_PROFILES_GO_INCOGNITO_BUTTON), 1969 l10n_util::GetStringUTF16(IDS_PROFILES_GO_INCOGNITO_BUTTON),
1970 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_INCOGNITO)); 1970 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_INCOGNITO));
1971 layout->StartRow(1, 0); 1971 layout->StartRow(1, 0);
1972 layout->AddView(go_incognito_button_); 1972 layout->AddView(go_incognito_button_);
1973 } 1973 }
1974 1974
1975 if (display_lock) { 1975 if (display_lock) {
1976 if (!switches::IsMaterialDesignUserMenu()) { 1976 if (!switches::IsMaterialDesignUserMenu()) {
1977 layout->StartRow(1, 0); 1977 layout->StartRow(1, 0);
1978 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1978 layout->AddView(new views::Separator());
1979 } 1979 }
1980 1980
1981 lock_button_ = new BackgroundColorHoverButton( 1981 lock_button_ = new BackgroundColorHoverButton(
1982 this, l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON), 1982 this, l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON),
1983 gfx::CreateVectorIcon(gfx::VectorIconId::LOCK, kIconSize, 1983 gfx::CreateVectorIcon(gfx::VectorIconId::LOCK, kIconSize,
1984 gfx::kChromeIconGrey)); 1984 gfx::kChromeIconGrey));
1985 layout->StartRow(1, 0); 1985 layout->StartRow(1, 0);
1986 layout->AddView(lock_button_); 1986 layout->AddView(lock_button_);
1987 } else if (switches::IsMaterialDesignUserMenu() && !is_guest) { 1987 } else if (switches::IsMaterialDesignUserMenu() && !is_guest) {
1988 int num_browsers = 0; 1988 int num_browsers = 0;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 views::Label* content_label = new views::Label( 2325 views::Label* content_label = new views::Label(
2326 l10n_util::GetStringFUTF16( 2326 l10n_util::GetStringFUTF16(
2327 IDS_PROFILES_NOT_YOU_CONTENT_TEXT, avatar_item.name)); 2327 IDS_PROFILES_NOT_YOU_CONTENT_TEXT, avatar_item.name));
2328 content_label->SetMultiLine(true); 2328 content_label->SetMultiLine(true);
2329 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 2329 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
2330 content_label->SetFontList(small_font_list); 2330 content_label->SetFontList(small_font_list);
2331 layout->AddView(content_label); 2331 layout->AddView(content_label);
2332 2332
2333 // Adds "Add person" button. 2333 // Adds "Add person" button.
2334 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); 2334 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing);
2335 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 2335 layout->AddView(new views::Separator());
2336 2336
2337 const int kIconSize = 24; 2337 const int kIconSize = 24;
2338 add_person_button_ = new BackgroundColorHoverButton( 2338 add_person_button_ = new BackgroundColorHoverButton(
2339 this, l10n_util::GetStringUTF16(IDS_PROFILES_ADD_PERSON_BUTTON), 2339 this, l10n_util::GetStringUTF16(IDS_PROFILES_ADD_PERSON_BUTTON),
2340 gfx::CreateVectorIcon(gfx::VectorIconId::ACCOUNT_BOX, kIconSize, 2340 gfx::CreateVectorIcon(gfx::VectorIconId::ACCOUNT_BOX, kIconSize,
2341 gfx::kChromeIconGrey)); 2341 gfx::kChromeIconGrey));
2342 layout->StartRow(1, 0); 2342 layout->StartRow(1, 0);
2343 layout->AddView(add_person_button_); 2343 layout->AddView(add_person_button_);
2344 2344
2345 // Adds "Disconnect your Google Account" button. 2345 // Adds "Disconnect your Google Account" button.
2346 layout->StartRow(1, 0); 2346 layout->StartRow(1, 0);
2347 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 2347 layout->AddView(new views::Separator());
2348 2348
2349 disconnect_button_ = new BackgroundColorHoverButton( 2349 disconnect_button_ = new BackgroundColorHoverButton(
2350 this, l10n_util::GetStringUTF16(IDS_PROFILES_DISCONNECT_BUTTON), 2350 this, l10n_util::GetStringUTF16(IDS_PROFILES_DISCONNECT_BUTTON),
2351 gfx::CreateVectorIcon(gfx::VectorIconId::REMOVE_BOX, kIconSize, 2351 gfx::CreateVectorIcon(gfx::VectorIconId::REMOVE_BOX, kIconSize,
2352 gfx::kChromeIconGrey)); 2352 gfx::kChromeIconGrey));
2353 layout->StartRow(1, 0); 2353 layout->StartRow(1, 0);
2354 layout->AddView(disconnect_button_); 2354 layout->AddView(disconnect_button_);
2355 2355
2356 TitleCard* title_card = new TitleCard( 2356 TitleCard* title_card = new TitleCard(
2357 l10n_util::GetStringFUTF16(IDS_PROFILES_NOT_YOU, avatar_item.name), 2357 l10n_util::GetStringFUTF16(IDS_PROFILES_NOT_YOU, avatar_item.name),
2358 this, &switch_user_cancel_button_); 2358 this, &switch_user_cancel_button_);
2359 return TitleCard::AddPaddedTitleCard(view, title_card, 2359 return TitleCard::AddPaddedTitleCard(view, title_card,
2360 kFixedSwitchUserViewWidth); 2360 kFixedSwitchUserViewWidth);
2361 } 2361 }
2362 2362
2363 bool ProfileChooserView::ShouldShowGoIncognito() const { 2363 bool ProfileChooserView::ShouldShowGoIncognito() const {
2364 bool incognito_available = 2364 bool incognito_available =
2365 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2365 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2366 IncognitoModePrefs::DISABLED; 2366 IncognitoModePrefs::DISABLED;
2367 return incognito_available && !browser_->profile()->IsGuestSession(); 2367 return incognito_available && !browser_->profile()->IsGuestSession();
2368 } 2368 }
2369 2369
2370 void ProfileChooserView::PostActionPerformed( 2370 void ProfileChooserView::PostActionPerformed(
2371 ProfileMetrics::ProfileDesktopMenu action_performed) { 2371 ProfileMetrics::ProfileDesktopMenu action_performed) {
2372 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 2372 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
2373 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 2373 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
2374 } 2374 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | chrome/browser/ui/views/website_settings/website_settings_popup_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698