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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, | 1219 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, |
1220 const std::string& account, | 1220 const std::string& account, |
1221 bool is_primary_account, | 1221 bool is_primary_account, |
1222 bool reauth_required, | 1222 bool reauth_required, |
1223 int width) { | 1223 int width) { |
1224 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1224 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1225 const gfx::ImageSkia* delete_default_image = | 1225 const gfx::ImageSkia* delete_default_image = |
1226 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); | 1226 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); |
1227 const int kDeleteButtonWidth = delete_default_image->width(); | 1227 const int kDeleteButtonWidth = delete_default_image->width(); |
1228 const gfx::ImageSkia* warning_default_image = reauth_required ? | 1228 const gfx::ImageSkia* warning_default_image = reauth_required ? |
1229 rb->GetImageNamed(IDR_WARNING).ToImageSkia() : NULL; | 1229 rb->GetImageNamed(IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR).ToImageSkia() : |
| 1230 NULL; |
1230 const int kWarningButtonWidth = reauth_required ? | 1231 const int kWarningButtonWidth = reauth_required ? |
1231 warning_default_image->width() + views::kRelatedButtonHSpacing : 0; | 1232 warning_default_image->width() + views::kRelatedButtonHSpacing : 0; |
1232 int available_width = width - | 1233 int available_width = width - |
1233 kDeleteButtonWidth - kWarningButtonWidth - views::kButtonHEdgeMarginNew; | 1234 kDeleteButtonWidth - kWarningButtonWidth - views::kButtonHEdgeMarginNew; |
1234 | 1235 |
1235 views::LabelButton* email_button = new BackgroundColorHoverButton( | 1236 views::LabelButton* email_button = new BackgroundColorHoverButton( |
1236 NULL, | 1237 reauth_required ? this : NULL, |
1237 gfx::ElideEmail(base::UTF8ToUTF16(account), | 1238 gfx::ElideEmail(base::UTF8ToUTF16(account), |
1238 rb->GetFontList(ui::ResourceBundle::BaseFont), | 1239 rb->GetFontList(ui::ResourceBundle::BaseFont), |
1239 available_width), | 1240 available_width), |
1240 gfx::ImageSkia(), | 1241 gfx::ImageSkia(), |
1241 gfx::ImageSkia()); | 1242 gfx::ImageSkia()); |
1242 layout->StartRow(1, 0); | 1243 layout->StartRow(1, 0); |
1243 layout->AddView(email_button); | 1244 layout->AddView(email_button); |
1244 | 1245 |
1245 // Delete button. | 1246 // Delete button. |
1246 views::ImageButton* delete_button = new views::ImageButton(this); | 1247 views::ImageButton* delete_button = new views::ImageButton(this); |
(...skipping 10 matching lines...) Expand all Loading... |
1257 kDeleteButtonWidth, kButtonHeight); | 1258 kDeleteButtonWidth, kButtonHeight); |
1258 | 1259 |
1259 email_button->set_notify_enter_exit_on_child(true); | 1260 email_button->set_notify_enter_exit_on_child(true); |
1260 email_button->AddChildView(delete_button); | 1261 email_button->AddChildView(delete_button); |
1261 | 1262 |
1262 // Save the original email address, as the button text could be elided. | 1263 // Save the original email address, as the button text could be elided. |
1263 delete_account_button_map_[delete_button] = account; | 1264 delete_account_button_map_[delete_button] = account; |
1264 | 1265 |
1265 // Warning button. | 1266 // Warning button. |
1266 if (reauth_required) { | 1267 if (reauth_required) { |
1267 views::ImageButton* reauth_button = new views::ImageButton(this); | 1268 views::ImageView* reauth_icon = new views::ImageView(); |
1268 reauth_button->SetImageAlignment(views::ImageButton::ALIGN_LEFT, | 1269 reauth_icon->SetImage(warning_default_image); |
1269 views::ImageButton::ALIGN_MIDDLE); | 1270 reauth_icon->SetBounds( |
1270 reauth_button->SetImage(views::ImageButton::STATE_NORMAL, | |
1271 warning_default_image); | |
1272 reauth_button->SetBounds( | |
1273 available_width, 0, kWarningButtonWidth, kButtonHeight); | 1271 available_width, 0, kWarningButtonWidth, kButtonHeight); |
1274 | 1272 email_button->AddChildView(reauth_icon); |
1275 email_button->AddChildView(reauth_button); | 1273 reauth_account_button_map_[email_button] = account; |
1276 reauth_account_button_map_[reauth_button] = account; | |
1277 } | 1274 } |
1278 } | 1275 } |
1279 | 1276 |
1280 views::View* ProfileChooserView::CreateGaiaSigninView() { | 1277 views::View* ProfileChooserView::CreateGaiaSigninView() { |
1281 GURL url; | 1278 GURL url; |
1282 int message_id; | 1279 int message_id; |
1283 | 1280 |
1284 switch (view_mode_) { | 1281 switch (view_mode_) { |
1285 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: | 1282 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: |
1286 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_SIGN_IN, | 1283 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_SIGN_IN, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 layout->StartRowWithPadding( | 1417 layout->StartRowWithPadding( |
1421 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1418 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1422 layout->AddView(end_preview_and_relaunch_button_); | 1419 layout->AddView(end_preview_and_relaunch_button_); |
1423 | 1420 |
1424 TitleCard* title_card = new TitleCard( | 1421 TitleCard* title_card = new TitleCard( |
1425 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); | 1422 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); |
1426 return TitleCard::AddPaddedTitleCard( | 1423 return TitleCard::AddPaddedTitleCard( |
1427 view, title_card, kFixedAccountRemovalViewWidth); | 1424 view, title_card, kFixedAccountRemovalViewWidth); |
1428 } | 1425 } |
1429 | 1426 |
OLD | NEW |