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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1257 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, | 1257 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, |
1258 const std::string& account, | 1258 const std::string& account, |
1259 bool is_primary_account, | 1259 bool is_primary_account, |
1260 bool reauth_required, | 1260 bool reauth_required, |
1261 int width) { | 1261 int width) { |
1262 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1262 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1263 const gfx::ImageSkia* delete_default_image = | 1263 const gfx::ImageSkia* delete_default_image = |
1264 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); | 1264 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); |
1265 const int kDeleteButtonWidth = delete_default_image->width(); | 1265 const int kDeleteButtonWidth = delete_default_image->width(); |
1266 const gfx::ImageSkia* warning_default_image = reauth_required ? | 1266 const gfx::ImageSkia* warning_default_image = reauth_required ? |
1267 rb->GetImageNamed(IDR_WARNING).ToImageSkia() : NULL; | 1267 rb->GetImageNamed(IDR_ICON_PROFILES_ACCOUNT_AUTH_ERROR).ToImageSkia() : |
msw
2014/05/30 18:24:13
nit: Are you doing this to have consistent iconogr
noms (inactive)
2014/06/09 20:34:19
I haven't added a before screenshot, but I've upda
| |
1268 NULL; | |
1268 const int kWarningButtonWidth = reauth_required ? | 1269 const int kWarningButtonWidth = reauth_required ? |
1269 warning_default_image->width() + views::kRelatedButtonHSpacing : 0; | 1270 warning_default_image->width() + views::kRelatedButtonHSpacing : 0; |
1270 int available_width = width - | 1271 int available_width = width - |
1271 kDeleteButtonWidth - kWarningButtonWidth - views::kButtonHEdgeMarginNew; | 1272 kDeleteButtonWidth - kWarningButtonWidth - views::kButtonHEdgeMarginNew; |
1272 | 1273 |
1273 views::LabelButton* email_button = new BackgroundColorHoverButton( | 1274 views::LabelButton* email_button = new BackgroundColorHoverButton( |
1274 NULL, | 1275 reauth_required ? this : NULL, |
1275 gfx::ElideEmail(base::UTF8ToUTF16(account), | 1276 gfx::ElideEmail(base::UTF8ToUTF16(account), |
1276 rb->GetFontList(ui::ResourceBundle::BaseFont), | 1277 rb->GetFontList(ui::ResourceBundle::BaseFont), |
1277 available_width), | 1278 available_width), |
1278 gfx::ImageSkia(), | 1279 gfx::ImageSkia(), |
1279 gfx::ImageSkia()); | 1280 gfx::ImageSkia()); |
1280 layout->StartRow(1, 0); | 1281 layout->StartRow(1, 0); |
1281 layout->AddView(email_button); | 1282 layout->AddView(email_button); |
1282 | 1283 |
1283 // Delete button. | 1284 // Delete button. |
1284 views::ImageButton* delete_button = new views::ImageButton(this); | 1285 views::ImageButton* delete_button = new views::ImageButton(this); |
(...skipping 10 matching lines...) Expand all Loading... | |
1295 kDeleteButtonWidth, kButtonHeight); | 1296 kDeleteButtonWidth, kButtonHeight); |
1296 | 1297 |
1297 email_button->set_notify_enter_exit_on_child(true); | 1298 email_button->set_notify_enter_exit_on_child(true); |
1298 email_button->AddChildView(delete_button); | 1299 email_button->AddChildView(delete_button); |
1299 | 1300 |
1300 // Save the original email address, as the button text could be elided. | 1301 // Save the original email address, as the button text could be elided. |
1301 delete_account_button_map_[delete_button] = account; | 1302 delete_account_button_map_[delete_button] = account; |
1302 | 1303 |
1303 // Warning button. | 1304 // Warning button. |
1304 if (reauth_required) { | 1305 if (reauth_required) { |
1305 views::ImageButton* reauth_button = new views::ImageButton(this); | 1306 views::ImageView* reauth_icon = new views::ImageView(); |
msw
2014/05/30 18:24:13
So you're changing the email_button to handle clic
noms (inactive)
2014/06/09 20:34:19
Added, but the tl; dr was : the change was done as
| |
1306 reauth_button->SetImageAlignment(views::ImageButton::ALIGN_LEFT, | 1307 reauth_icon->SetImage(warning_default_image); |
1307 views::ImageButton::ALIGN_MIDDLE); | 1308 reauth_icon->SetBounds( |
1308 reauth_button->SetImage(views::ImageButton::STATE_NORMAL, | |
1309 warning_default_image); | |
1310 reauth_button->SetBounds( | |
1311 available_width, 0, kWarningButtonWidth, kButtonHeight); | 1309 available_width, 0, kWarningButtonWidth, kButtonHeight); |
1312 | 1310 email_button->AddChildView(reauth_icon); |
1313 email_button->AddChildView(reauth_button); | 1311 reauth_account_button_map_[email_button] = account; |
1314 reauth_account_button_map_[reauth_button] = account; | |
1315 } | 1312 } |
1316 } | 1313 } |
1317 | 1314 |
1318 views::View* ProfileChooserView::CreateGaiaSigninView() { | 1315 views::View* ProfileChooserView::CreateGaiaSigninView() { |
1319 GURL url; | 1316 GURL url; |
1320 int message_id; | 1317 int message_id; |
1321 | 1318 |
1322 switch (view_mode_) { | 1319 switch (view_mode_) { |
1323 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: | 1320 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: |
1324 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_SIGN_IN, | 1321 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_SIGN_IN, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1458 layout->StartRowWithPadding( | 1455 layout->StartRowWithPadding( |
1459 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1456 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1460 layout->AddView(end_preview_and_relaunch_button_); | 1457 layout->AddView(end_preview_and_relaunch_button_); |
1461 | 1458 |
1462 TitleCard* title_card = new TitleCard( | 1459 TitleCard* title_card = new TitleCard( |
1463 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); | 1460 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); |
1464 return TitleCard::AddPaddedTitleCard( | 1461 return TitleCard::AddPaddedTitleCard( |
1465 view, title_card, kFixedAccountRemovalViewWidth); | 1462 view, title_card, kFixedAccountRemovalViewWidth); |
1466 } | 1463 } |
1467 | 1464 |
OLD | NEW |