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/app/vector_icons/vector_icons.h" | 10 #include "chrome/app/vector_icons/vector_icons.h" |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 view->SetLayoutManager( | 1297 view->SetLayoutManager( |
1298 new views::BoxLayout(views::BoxLayout::kVertical, 0, | 1298 new views::BoxLayout(views::BoxLayout::kVertical, 0, |
1299 views::kRelatedControlVerticalSpacing, 0)); | 1299 views::kRelatedControlVerticalSpacing, 0)); |
1300 | 1300 |
1301 // Container for the profile photo and avatar/user name. | 1301 // Container for the profile photo and avatar/user name. |
1302 BackgroundColorHoverButton* current_profile_card = | 1302 BackgroundColorHoverButton* current_profile_card = |
1303 new BackgroundColorHoverButton(this, base::string16()); | 1303 new BackgroundColorHoverButton(this, base::string16()); |
1304 views::GridLayout* grid_layout = new views::GridLayout(current_profile_card); | 1304 views::GridLayout* grid_layout = new views::GridLayout(current_profile_card); |
1305 current_profile_card->SetLayoutManager(grid_layout); | 1305 current_profile_card->SetLayoutManager(grid_layout); |
1306 views::ColumnSet* columns = grid_layout->AddColumnSet(0); | 1306 views::ColumnSet* columns = grid_layout->AddColumnSet(0); |
1307 columns->AddPaddingColumn(0, kMenuEdgeMargin); | 1307 // BackgroundColorHoverButton has already accounted for the left and right |
| 1308 // margins. |
1308 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, | 1309 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
1309 views::GridLayout::USE_PREF, 0, 0); | 1310 views::GridLayout::USE_PREF, 0, 0); |
1310 columns->AddPaddingColumn(0, kMenuEdgeMargin - kBadgeSpacing); | 1311 columns->AddPaddingColumn(0, kMenuEdgeMargin - kBadgeSpacing); |
1311 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 1312 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
1312 views::GridLayout::USE_PREF, 0, 0); | 1313 views::GridLayout::USE_PREF, 0, 0); |
1313 columns->AddPaddingColumn(0, kMenuEdgeMargin); | |
1314 grid_layout->AddPaddingRow(0, 0); | 1314 grid_layout->AddPaddingRow(0, 0); |
1315 const int num_labels = | 1315 const int num_labels = |
1316 (avatar_item.signed_in && !switches::IsEnableAccountConsistency()) ? 2 | 1316 (avatar_item.signed_in && !switches::IsEnableAccountConsistency()) ? 2 |
1317 : 1; | 1317 : 1; |
1318 int profile_card_height = | 1318 int profile_card_height = |
1319 kImageSide + | 1319 kImageSide + |
1320 2 * (kBadgeSpacing + views::kRelatedControlSmallVerticalSpacing); | 1320 2 * (kBadgeSpacing + views::kRelatedControlSmallVerticalSpacing); |
1321 const int line_height = profile_card_height / num_labels; | 1321 const int line_height = profile_card_height / num_labels; |
1322 grid_layout->StartRow(0, 0, line_height); | 1322 grid_layout->StartRow(0, 0, line_height); |
1323 current_profile_card_ = current_profile_card; | 1323 current_profile_card_ = current_profile_card; |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1854 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1855 IncognitoModePrefs::DISABLED; | 1855 IncognitoModePrefs::DISABLED; |
1856 return incognito_available && !browser_->profile()->IsGuestSession(); | 1856 return incognito_available && !browser_->profile()->IsGuestSession(); |
1857 } | 1857 } |
1858 | 1858 |
1859 void ProfileChooserView::PostActionPerformed( | 1859 void ProfileChooserView::PostActionPerformed( |
1860 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1860 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1861 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1861 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1862 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1862 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1863 } | 1863 } |
OLD | NEW |