OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 back_button_->SetImage(views::ImageButton::STATE_HOVERED, | 302 back_button_->SetImage(views::ImageButton::STATE_HOVERED, |
303 rb->GetImageSkiaNamed(IDR_BACK_H)); | 303 rb->GetImageSkiaNamed(IDR_BACK_H)); |
304 back_button_->SetImage(views::ImageButton::STATE_PRESSED, | 304 back_button_->SetImage(views::ImageButton::STATE_PRESSED, |
305 rb->GetImageSkiaNamed(IDR_BACK_P)); | 305 rb->GetImageSkiaNamed(IDR_BACK_P)); |
306 back_button_->SetImage(views::ImageButton::STATE_DISABLED, | 306 back_button_->SetImage(views::ImageButton::STATE_DISABLED, |
307 rb->GetImageSkiaNamed(IDR_BACK_D)); | 307 rb->GetImageSkiaNamed(IDR_BACK_D)); |
308 *back_button = back_button_; | 308 *back_button = back_button_; |
309 | 309 |
310 title_label_ = new views::Label(l10n_util::GetStringUTF16(message_id)); | 310 title_label_ = new views::Label(l10n_util::GetStringUTF16(message_id)); |
311 title_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 311 title_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 312 const gfx::FontList& medium_font_list = |
| 313 rb->GetFontList(ui::ResourceBundle::MediumFont); |
| 314 title_label_->SetFontList(medium_font_list); |
312 | 315 |
313 AddChildView(back_button_); | 316 AddChildView(back_button_); |
314 AddChildView(title_label_); | 317 AddChildView(title_label_); |
315 } | 318 } |
316 | 319 |
317 private: | 320 private: |
318 virtual void Layout() OVERRIDE{ | 321 virtual void Layout() OVERRIDE{ |
319 back_button_->SetBoundsRect(GetContentsBounds()); | 322 back_button_->SetBoundsRect(GetContentsBounds()); |
320 title_label_->SetBoundsRect(GetContentsBounds()); | 323 title_label_->SetBoundsRect(GetContentsBounds()); |
321 } | 324 } |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 layout->StartRow(1, 0); | 1020 layout->StartRow(1, 0); |
1018 layout->AddView(email_button); | 1021 layout->AddView(email_button); |
1019 | 1022 |
1020 // Save the original email address, as the button text could be elided. | 1023 // Save the original email address, as the button text could be elided. |
1021 current_profile_accounts_map_[email_button] = account; | 1024 current_profile_accounts_map_[email_button] = account; |
1022 } | 1025 } |
1023 | 1026 |
1024 views::View* ProfileChooserView::CreateGaiaSigninView( | 1027 views::View* ProfileChooserView::CreateGaiaSigninView( |
1025 bool add_secondary_account) { | 1028 bool add_secondary_account) { |
1026 views::View* view = new views::View(); | 1029 views::View* view = new views::View(); |
1027 int available_width = kFixedGaiaViewWidth - 2 * views::kButtonHEdgeMarginNew; | 1030 views::GridLayout* layout = |
1028 views::GridLayout* layout = CreateSingleColumnLayout(view, available_width); | 1031 CreateSingleColumnLayout(view, kFixedGaiaViewWidth); |
1029 layout->SetInsets(views::kButtonVEdgeMarginNew, | |
1030 views::kButtonHEdgeMarginNew, | |
1031 views::kButtonVEdgeMarginNew, | |
1032 views::kButtonHEdgeMarginNew); | |
1033 | 1032 |
1034 // Adds title. | 1033 // Adds title. |
1035 layout->StartRow(1, 0); | 1034 views::View* padded_title = new views::View(); |
1036 layout->AddView(new TitleCard( | 1035 int available_width = kFixedGaiaViewWidth - 2 * views::kButtonHEdgeMarginNew; |
| 1036 views::GridLayout* padded_layout = CreateSingleColumnLayout( |
| 1037 padded_title, available_width); |
| 1038 padded_layout->SetInsets(views::kButtonVEdgeMarginNew, |
| 1039 views::kButtonHEdgeMarginNew, |
| 1040 views::kButtonVEdgeMarginNew, |
| 1041 views::kButtonHEdgeMarginNew); |
| 1042 padded_layout->StartRow(1, 0); |
| 1043 padded_layout->AddView(new TitleCard( |
1037 add_secondary_account ? IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE : | 1044 add_secondary_account ? IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE : |
1038 IDS_PROFILES_GAIA_SIGNIN_TITLE, | 1045 IDS_PROFILES_GAIA_SIGNIN_TITLE, |
1039 this, &gaia_signin_cancel_button_)); | 1046 this, &gaia_signin_cancel_button_)); |
1040 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); | 1047 |
| 1048 layout->StartRow(1, 0); |
| 1049 layout->AddView(padded_title); |
| 1050 layout->StartRow(1, 0); |
1041 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 1051 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
1042 | 1052 |
1043 // Adds Gaia signin webview | 1053 // Adds Gaia signin webview |
1044 Profile* profile = browser_->profile(); | 1054 Profile* profile = browser_->profile(); |
1045 views::WebView* web_view = new views::WebView(profile); | 1055 views::WebView* web_view = new views::WebView(profile); |
1046 signin::Source source = add_secondary_account ? | 1056 signin::Source source = add_secondary_account ? |
1047 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT : | 1057 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT : |
1048 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN; | 1058 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN; |
1049 GURL url(signin::GetPromoURL( | 1059 GURL url(signin::GetPromoURL( |
1050 source, false /* auto_close */, true /* is_constrained */)); | 1060 source, false /* auto_close */, true /* is_constrained */)); |
1051 web_view->LoadInitialURL(url); | 1061 web_view->LoadInitialURL(url); |
1052 web_view->SetPreferredSize(gfx::Size(available_width, kFixedGaiaViewHeight)); | 1062 web_view->SetPreferredSize( |
| 1063 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); |
1053 | 1064 |
1054 layout->StartRow(1, 0); | 1065 layout->StartRow(1, 0); |
1055 layout->AddView(web_view); | 1066 layout->AddView(web_view); |
1056 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); | 1067 |
1057 return view; | 1068 return view; |
1058 } | 1069 } |
1059 | 1070 |
1060 views::View* ProfileChooserView::CreateAccountRemovalView() { | 1071 views::View* ProfileChooserView::CreateAccountRemovalView() { |
1061 views::View* view = new views::View(); | 1072 views::View* view = new views::View(); |
1062 views::GridLayout* layout = CreateSingleColumnLayout( | 1073 views::GridLayout* layout = CreateSingleColumnLayout( |
1063 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); | 1074 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); |
1064 layout->SetInsets(views::kButtonVEdgeMarginNew, | 1075 layout->SetInsets(views::kButtonVEdgeMarginNew, |
1065 views::kButtonHEdgeMarginNew, | 1076 views::kButtonHEdgeMarginNew, |
1066 views::kButtonVEdgeMarginNew, | 1077 views::kButtonVEdgeMarginNew, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 layout->StartRowWithPadding( | 1112 layout->StartRowWithPadding( |
1102 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1113 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1103 layout->AddView(remove_account_and_relaunch_button_); | 1114 layout->AddView(remove_account_and_relaunch_button_); |
1104 } else { | 1115 } else { |
1105 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 1116 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
1106 } | 1117 } |
1107 | 1118 |
1108 return view; | 1119 return view; |
1109 } | 1120 } |
1110 | 1121 |
OLD | NEW |