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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 namespace { | 66 namespace { |
67 | 67 |
68 // Helpers -------------------------------------------------------------------- | 68 // Helpers -------------------------------------------------------------------- |
69 | 69 |
70 const int kFixedMenuWidth = 250; | 70 const int kFixedMenuWidth = 250; |
71 const int kButtonHeight = 32; | 71 const int kButtonHeight = 32; |
72 const int kFixedGaiaViewHeight = 440; | 72 const int kFixedGaiaViewHeight = 440; |
73 const int kFixedGaiaViewWidth = 360; | 73 const int kFixedGaiaViewWidth = 360; |
74 const int kFixedAccountRemovalViewWidth = 280; | 74 const int kFixedAccountRemovalViewWidth = 280; |
75 const int kFixedSwitchUserViewWidth = 280; | 75 const int kFixedSwitchUserViewWidth = 320; |
76 const int kLargeImageSide = 88; | 76 const int kLargeImageSide = 88; |
77 | 77 |
| 78 const int kVerticalSpacing = 16; |
| 79 |
78 // Creates a GridLayout with a single column. This ensures that all the child | 80 // Creates a GridLayout with a single column. This ensures that all the child |
79 // views added get auto-expanded to fill the full width of the bubble. | 81 // views added get auto-expanded to fill the full width of the bubble. |
80 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { | 82 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { |
81 views::GridLayout* layout = new views::GridLayout(view); | 83 views::GridLayout* layout = new views::GridLayout(view); |
82 view->SetLayoutManager(layout); | 84 view->SetLayoutManager(layout); |
83 | 85 |
84 views::ColumnSet* columns = layout->AddColumnSet(0); | 86 views::ColumnSet* columns = layout->AddColumnSet(0); |
85 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, | 87 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
86 views::GridLayout::FIXED, width, width); | 88 views::GridLayout::FIXED, width, width); |
87 return layout; | 89 return layout; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 title_label_ = new views::Label(message); | 417 title_label_ = new views::Label(message); |
416 title_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 418 title_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
417 const gfx::FontList& medium_font_list = | 419 const gfx::FontList& medium_font_list = |
418 rb->GetFontList(ui::ResourceBundle::MediumFont); | 420 rb->GetFontList(ui::ResourceBundle::MediumFont); |
419 title_label_->SetFontList(medium_font_list); | 421 title_label_->SetFontList(medium_font_list); |
420 | 422 |
421 AddChildView(back_button_); | 423 AddChildView(back_button_); |
422 AddChildView(title_label_); | 424 AddChildView(title_label_); |
423 } | 425 } |
424 | 426 |
425 // Creates a new view that has the |title_card| with padding at the top, an | 427 // Creates a new view that has the |title_card| with horizontal padding at the |
426 // edge-to-edge separator below, and the specified |view| at the bottom. | 428 // top, an edge-to-edge separator below, and the specified |view| at the |
| 429 // bottom. |
427 static views::View* AddPaddedTitleCard(views::View* view, | 430 static views::View* AddPaddedTitleCard(views::View* view, |
428 TitleCard* title_card, | 431 TitleCard* title_card, |
429 int width) { | 432 int width) { |
430 views::View* titled_view = new views::View(); | 433 views::View* titled_view = new views::View(); |
431 views::GridLayout* layout = new views::GridLayout(titled_view); | 434 views::GridLayout* layout = new views::GridLayout(titled_view); |
432 titled_view->SetLayoutManager(layout); | 435 titled_view->SetLayoutManager(layout); |
433 | 436 |
434 // Column set 0 is a single column layout with horizontal padding at left | 437 // Column set 0 is a single column layout with horizontal padding at left |
435 // and right, and column set 1 is a single column layout with no padding. | 438 // and right, and column set 1 is a single column layout with no padding. |
436 views::ColumnSet* columns = layout->AddColumnSet(0); | 439 views::ColumnSet* columns = layout->AddColumnSet(0); |
437 columns->AddPaddingColumn(1, views::kButtonHEdgeMarginNew); | 440 columns->AddPaddingColumn(1, views::kButtonHEdgeMarginNew); |
438 int available_width = width - 2 * views::kButtonHEdgeMarginNew; | 441 int available_width = width - 2 * views::kButtonHEdgeMarginNew; |
439 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, | 442 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
440 views::GridLayout::FIXED, available_width, available_width); | 443 views::GridLayout::FIXED, available_width, available_width); |
441 columns->AddPaddingColumn(1, views::kButtonHEdgeMarginNew); | 444 columns->AddPaddingColumn(1, views::kButtonHEdgeMarginNew); |
442 layout->AddColumnSet(1)->AddColumn(views::GridLayout::FILL, | 445 layout->AddColumnSet(1)->AddColumn(views::GridLayout::FILL, |
443 views::GridLayout::FILL, 0,views::GridLayout::FIXED, width, width); | 446 views::GridLayout::FILL, 0,views::GridLayout::FIXED, width, width); |
444 | 447 |
445 layout->StartRowWithPadding(1, 0, 0, views::kButtonVEdgeMarginNew); | 448 layout->StartRowWithPadding(1, 0, 0, kVerticalSpacing); |
446 layout->AddView(title_card); | 449 layout->AddView(title_card); |
447 layout->StartRowWithPadding(1, 1, 0, views::kRelatedControlVerticalSpacing); | 450 layout->StartRowWithPadding(1, 1, 0, kVerticalSpacing); |
448 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 451 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
449 | 452 |
450 layout->StartRow(1, 1); | 453 layout->StartRow(1, 1); |
451 layout->AddView(view); | 454 layout->AddView(view); |
452 | 455 |
453 return titled_view; | 456 return titled_view; |
454 } | 457 } |
455 | 458 |
456 private: | 459 private: |
457 virtual void Layout() OVERRIDE { | 460 virtual void Layout() OVERRIDE { |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1647 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1645 IncognitoModePrefs::DISABLED; | 1648 IncognitoModePrefs::DISABLED; |
1646 return incognito_available && !browser_->profile()->IsGuestSession(); | 1649 return incognito_available && !browser_->profile()->IsGuestSession(); |
1647 } | 1650 } |
1648 | 1651 |
1649 void ProfileChooserView::PostActionPerformed( | 1652 void ProfileChooserView::PostActionPerformed( |
1650 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1653 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1651 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1654 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1652 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1655 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1653 } | 1656 } |
OLD | NEW |