Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 240453006: Fix sign-in error strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extract separate CLs, fix new avatar button Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 11 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
12 #include "chrome/browser/profiles/profile_info_cache.h" 12 #include "chrome/browser/profiles/profile_info_cache.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/profiles/profile_metrics.h" 14 #include "chrome/browser/profiles/profile_metrics.h"
15 #include "chrome/browser/profiles/profile_window.h" 15 #include "chrome/browser/profiles/profile_window.h"
16 #include "chrome/browser/profiles/profiles_state.h" 16 #include "chrome/browser/profiles/profiles_state.h"
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
18 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "chrome/browser/signin/signin_promo.h" 19 #include "chrome/browser/signin/signin_promo.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_commands.h" 21 #include "chrome/browser/ui/browser_commands.h"
22 #include "chrome/browser/ui/browser_dialogs.h" 22 #include "chrome/browser/ui/browser_dialogs.h"
23 #include "chrome/browser/ui/chrome_pages.h" 23 #include "chrome/browser/ui/chrome_pages.h"
24 #include "chrome/browser/ui/singleton_tabs.h" 24 #include "chrome/browser/ui/singleton_tabs.h"
25 #include "chrome/browser/ui/views/profiles/user_manager_view.h" 25 #include "chrome/browser/ui/views/profiles/user_manager_view.h"
26 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" 28 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h"
29 #include "components/signin/core/browser/profile_oauth2_token_service.h" 29 #include "components/signin/core/browser/profile_oauth2_token_service.h"
30 #include "components/signin/core/browser/signin_error_controller.h"
30 #include "components/signin/core/browser/signin_manager.h" 31 #include "components/signin/core/browser/signin_manager.h"
31 #include "components/signin/core/common/profile_management_switches.h" 32 #include "components/signin/core/common/profile_management_switches.h"
32 #include "grit/chromium_strings.h" 33 #include "grit/chromium_strings.h"
33 #include "grit/generated_resources.h" 34 #include "grit/generated_resources.h"
34 #include "grit/theme_resources.h" 35 #include "grit/theme_resources.h"
35 #include "third_party/skia/include/core/SkColor.h" 36 #include "third_party/skia/include/core/SkColor.h"
36 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/resource/resource_bundle.h" 38 #include "ui/base/resource/resource_bundle.h"
38 #include "ui/gfx/canvas.h" 39 #include "ui/gfx/canvas.h"
39 #include "ui/gfx/image/image.h" 40 #include "ui/gfx/image/image.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 tutorial_learn_more_link_ = NULL; 458 tutorial_learn_more_link_ = NULL;
458 tutorial_enable_new_profile_management_button_ = NULL; 459 tutorial_enable_new_profile_management_button_ = NULL;
459 tutorial_end_preview_link_ = NULL; 460 tutorial_end_preview_link_ = NULL;
460 tutorial_send_feedback_button_ = NULL; 461 tutorial_send_feedback_button_ = NULL;
461 end_preview_and_relaunch_button_ = NULL; 462 end_preview_and_relaunch_button_ = NULL;
462 end_preview_cancel_button_ = NULL; 463 end_preview_cancel_button_ = NULL;
463 remove_account_button_ = NULL; 464 remove_account_button_ = NULL;
464 account_removal_cancel_button_ = NULL; 465 account_removal_cancel_button_ = NULL;
465 gaia_signin_cancel_button_ = NULL; 466 gaia_signin_cancel_button_ = NULL;
466 open_other_profile_indexes_map_.clear(); 467 open_other_profile_indexes_map_.clear();
467 current_profile_accounts_map_.clear(); 468 delete_account_button_map_.clear();
469 reauth_account_button_map_.clear();
468 tutorial_mode_ = TUTORIAL_MODE_NONE; 470 tutorial_mode_ = TUTORIAL_MODE_NONE;
469 } 471 }
470 472
471 void ProfileChooserView::Init() { 473 void ProfileChooserView::Init() {
474 // If view mode is PROFILE_CHOOSER but there is an auth error, force
475 // ACCOUNT_MANAGEMENT mode.
476 if (view_mode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER) {
477 SigninErrorController* error =
478 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile())->
479 signin_error_controller();
480 if (error->HasError())
481 view_mode_ = BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
482 }
483
472 ShowView(view_mode_, avatar_menu_.get()); 484 ShowView(view_mode_, avatar_menu_.get());
473 } 485 }
474 486
475 void ProfileChooserView::OnAvatarMenuChanged( 487 void ProfileChooserView::OnAvatarMenuChanged(
476 AvatarMenu* avatar_menu) { 488 AvatarMenu* avatar_menu) {
477 // Refresh the view with the new menu. We can't just update the local copy 489 // Refresh the view with the new menu. We can't just update the local copy
478 // as this may have been triggered by a sign out action, in which case 490 // as this may have been triggered by a sign out action, in which case
479 // the view is being destroyed. 491 // the view is being destroyed.
480 ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu); 492 ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu);
481 } 493 }
482 494
483 void ProfileChooserView::OnRefreshTokenAvailable( 495 void ProfileChooserView::OnRefreshTokenAvailable(
484 const std::string& account_id) { 496 const std::string& account_id) {
485 // Refresh the account management view when a new account is added to the 497 // Refresh the account management view when a new account is added to the
486 // profile. 498 // profile.
487 if (view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || 499 if (view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ||
488 view_mode_ == BUBBLE_VIEW_MODE_GAIA_SIGNIN || 500 view_mode_ == BUBBLE_VIEW_MODE_GAIA_SIGNIN ||
489 view_mode_ == BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT) { 501 view_mode_ == BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT ||
502 view_mode_ == BUBBLE_VIEW_MODE_GAIA_REAUTH) {
490 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); 503 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get());
491 } 504 }
492 } 505 }
493 506
494 void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) { 507 void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) {
495 // Refresh the account management view when an account is removed from the 508 // Refresh the account management view when an account is removed from the
496 // profile. 509 // profile.
497 if (view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) 510 if (view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT)
498 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); 511 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get());
499 } 512 }
(...skipping 12 matching lines...) Expand all
512 TutorialMode last_tutorial_mode = tutorial_mode_; 525 TutorialMode last_tutorial_mode = tutorial_mode_;
513 ResetView(); 526 ResetView();
514 RemoveAllChildViews(true); 527 RemoveAllChildViews(true);
515 view_mode_ = view_to_display; 528 view_mode_ = view_to_display;
516 529
517 views::GridLayout* layout; 530 views::GridLayout* layout;
518 views::View* sub_view; 531 views::View* sub_view;
519 switch (view_mode_) { 532 switch (view_mode_) {
520 case BUBBLE_VIEW_MODE_GAIA_SIGNIN: 533 case BUBBLE_VIEW_MODE_GAIA_SIGNIN:
521 case BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: 534 case BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT:
535 case BUBBLE_VIEW_MODE_GAIA_REAUTH:
522 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth); 536 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth);
523 sub_view = CreateGaiaSigninView( 537 sub_view = CreateGaiaSigninView();
524 view_mode_ == BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT);
525 break; 538 break;
526 case BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: 539 case BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL:
527 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth); 540 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth);
528 sub_view = CreateAccountRemovalView(); 541 sub_view = CreateAccountRemovalView();
529 break; 542 break;
530 case BUBBLE_VIEW_MODE_END_PREVIEW: 543 case BUBBLE_VIEW_MODE_END_PREVIEW:
531 layout = CreateSingleColumnLayout(this, kFixedEndPreviewViewWidth); 544 layout = CreateSingleColumnLayout(this, kFixedEndPreviewViewWidth);
532 sub_view = CreateEndPreviewView(); 545 sub_view = CreateEndPreviewView();
533 break; 546 break;
534 default: 547 default:
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 ButtonIndexes::const_iterator profile_match = 634 ButtonIndexes::const_iterator profile_match =
622 open_other_profile_indexes_map_.find(sender); 635 open_other_profile_indexes_map_.find(sender);
623 if (profile_match != open_other_profile_indexes_map_.end()) { 636 if (profile_match != open_other_profile_indexes_map_.end()) {
624 avatar_menu_->SwitchToProfile( 637 avatar_menu_->SwitchToProfile(
625 profile_match->second, 638 profile_match->second,
626 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, 639 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW,
627 ProfileMetrics::SWITCH_PROFILE_ICON); 640 ProfileMetrics::SWITCH_PROFILE_ICON);
628 } else { 641 } else {
629 // This was a profile accounts button. 642 // This was a profile accounts button.
630 AccountButtonIndexes::const_iterator account_match = 643 AccountButtonIndexes::const_iterator account_match =
631 current_profile_accounts_map_.find(sender); 644 delete_account_button_map_.find(sender);
632 DCHECK(account_match != current_profile_accounts_map_.end()); 645 if (account_match != delete_account_button_map_.end()) {
633 account_id_to_remove_ = account_match->second; 646 account_id_to_remove_ = account_match->second;
634 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get()); 647 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get());
648 } else {
649 account_match = reauth_account_button_map_.find(sender);
650 DCHECK(account_match != reauth_account_button_map_.end());
651 ShowView(BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get());
652 }
635 } 653 }
636 } 654 }
637 } 655 }
638 656
639 void ProfileChooserView::RemoveAccount() { 657 void ProfileChooserView::RemoveAccount() {
640 DCHECK(!account_id_to_remove_.empty()); 658 DCHECK(!account_id_to_remove_.empty());
641 MutableProfileOAuth2TokenService* oauth2_token_service = 659 MutableProfileOAuth2TokenService* oauth2_token_service =
642 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( 660 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile(
643 browser_->profile()); 661 browser_->profile());
644 if (oauth2_token_service) 662 if (oauth2_token_service)
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 profiles::kAvatarBubbleAccountsBackgroundColor)); 1127 profiles::kAvatarBubbleAccountsBackgroundColor));
1110 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1128 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth);
1111 1129
1112 Profile* profile = browser_->profile(); 1130 Profile* profile = browser_->profile();
1113 std::string primary_account = 1131 std::string primary_account =
1114 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername(); 1132 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername();
1115 DCHECK(!primary_account.empty()); 1133 DCHECK(!primary_account.empty());
1116 std::vector<std::string>accounts = 1134 std::vector<std::string>accounts =
1117 profiles::GetSecondaryAccountsForProfile(profile, primary_account); 1135 profiles::GetSecondaryAccountsForProfile(profile, primary_account);
1118 1136
1137 // Get state of authentication error, if any.
1138 std::string error_account_id;
1139 SigninErrorController* error =
noms (inactive) 2014/05/16 13:37:04 I think it would be nicer if you had a helper func
Roger Tawa OOO till Jul 10th 2014/05/16 19:43:49 Done.
1140 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->
1141 signin_error_controller();
1142 if (error->HasError())
1143 error_account_id = error->error_account_id();
1144
1119 // The primary account should always be listed first. 1145 // The primary account should always be listed first.
1120 // TODO(rogerta): we still need to further differentiate the primary account 1146 // TODO(rogerta): we still need to further differentiate the primary account
1121 // from the others in the UI, so more work is likely required here: 1147 // from the others in the UI, so more work is likely required here:
1122 // crbug.com/311124. 1148 // crbug.com/311124.
1123 CreateAccountButton(layout, primary_account, true, kFixedMenuWidth); 1149 CreateAccountButton(layout, primary_account, true,
1150 error_account_id == primary_account, kFixedMenuWidth);
1124 for (size_t i = 0; i < accounts.size(); ++i) 1151 for (size_t i = 0; i < accounts.size(); ++i)
1125 CreateAccountButton(layout, accounts[i], false, kFixedMenuWidth); 1152 CreateAccountButton(layout, accounts[i], false,
1153 error_account_id == accounts[i], kFixedMenuWidth);
1126 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1154 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
1127 1155
1128 add_account_link_ = CreateLink(l10n_util::GetStringFUTF16( 1156 add_account_link_ = CreateLink(l10n_util::GetStringFUTF16(
1129 IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, avatar_item.name), this); 1157 IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, avatar_item.name), this);
1130 add_account_link_->SetBorder(views::Border::CreateEmptyBorder( 1158 add_account_link_->SetBorder(views::Border::CreateEmptyBorder(
1131 0, views::kButtonVEdgeMarginNew, 1159 0, views::kButtonVEdgeMarginNew,
1132 views::kRelatedControlVerticalSpacing, 0)); 1160 views::kRelatedControlVerticalSpacing, 0));
1133 layout->StartRow(1, 0); 1161 layout->StartRow(1, 0);
1134 layout->AddView(add_account_link_); 1162 layout->AddView(add_account_link_);
1135 return view; 1163 return view;
1136 } 1164 }
1137 1165
1138 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, 1166 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout,
1139 const std::string& account, 1167 const std::string& account,
1140 bool is_primary_account, 1168 bool is_primary_account,
1169 bool reauth_required,
1141 int width) { 1170 int width) {
1142 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1171 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1143 const gfx::ImageSkia* default_image = 1172 const gfx::ImageSkia* delete_default_image =
1144 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); 1173 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia();
1145 int kDeleteButtonWidth = default_image->width(); 1174 const int kDeleteButtonWidth = delete_default_image->width();
1175 const gfx::ImageSkia* warning_default_image = reauth_required ?
1176 rb->GetImageNamed(IDR_WARNING).ToImageSkia() : NULL;
1177 const int kWarningButtonWidth = reauth_required ?
1178 warning_default_image->width() + views::kRelatedButtonHSpacing : 0;
1146 int available_width = width - 1179 int available_width = width -
1147 kDeleteButtonWidth - views::kButtonHEdgeMarginNew; 1180 kDeleteButtonWidth - kWarningButtonWidth - views::kButtonHEdgeMarginNew;
1148 1181
1149 views::LabelButton* email_button = new BackgroundColorHoverButton( 1182 views::LabelButton* email_button = new BackgroundColorHoverButton(
1150 NULL, 1183 NULL,
1151 gfx::ElideEmail(base::UTF8ToUTF16(account), 1184 gfx::ElideEmail(base::UTF8ToUTF16(account),
1152 rb->GetFontList(ui::ResourceBundle::BaseFont), 1185 rb->GetFontList(ui::ResourceBundle::BaseFont),
1153 available_width), 1186 available_width),
1154 gfx::ImageSkia(), 1187 gfx::ImageSkia(),
1155 gfx::ImageSkia()); 1188 gfx::ImageSkia());
1156 layout->StartRow(1, 0); 1189 layout->StartRow(1, 0);
1157 layout->AddView(email_button); 1190 layout->AddView(email_button);
1158 1191
1159 // Delete button. 1192 // Delete button.
1160 views::ImageButton* delete_button = new views::ImageButton(this); 1193 views::ImageButton* delete_button = new views::ImageButton(this);
1161 delete_button->SetImageAlignment(views::ImageButton::ALIGN_RIGHT, 1194 delete_button->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
1162 views::ImageButton::ALIGN_MIDDLE); 1195 views::ImageButton::ALIGN_MIDDLE);
1163 delete_button->SetImage(views::ImageButton::STATE_NORMAL, 1196 delete_button->SetImage(views::ImageButton::STATE_NORMAL,
1164 default_image); 1197 delete_default_image);
1165 delete_button->SetImage(views::ImageButton::STATE_HOVERED, 1198 delete_button->SetImage(views::ImageButton::STATE_HOVERED,
1166 rb->GetImageSkiaNamed(IDR_CLOSE_1_H)); 1199 rb->GetImageSkiaNamed(IDR_CLOSE_1_H));
1167 delete_button->SetImage(views::ImageButton::STATE_PRESSED, 1200 delete_button->SetImage(views::ImageButton::STATE_PRESSED,
1168 rb->GetImageSkiaNamed(IDR_CLOSE_1_P)); 1201 rb->GetImageSkiaNamed(IDR_CLOSE_1_P));
1169 delete_button->SetBounds( 1202 delete_button->SetBounds(
1170 available_width, 0, kDeleteButtonWidth, kButtonHeight); 1203 available_width + kWarningButtonWidth, 0,
1204 kDeleteButtonWidth, kButtonHeight);
1171 1205
1172 email_button->set_notify_enter_exit_on_child(true); 1206 email_button->set_notify_enter_exit_on_child(true);
1173 email_button->AddChildView(delete_button); 1207 email_button->AddChildView(delete_button);
1174 1208
1175 // Save the original email address, as the button text could be elided. 1209 // Save the original email address, as the button text could be elided.
1176 current_profile_accounts_map_[delete_button] = account; 1210 delete_account_button_map_[delete_button] = account;
1211
1212 // Warning button.
1213 if (reauth_required) {
1214 views::ImageButton* reauth_button = new views::ImageButton(this);
1215 reauth_button->SetImageAlignment(views::ImageButton::ALIGN_LEFT,
1216 views::ImageButton::ALIGN_MIDDLE);
1217 reauth_button->SetImage(views::ImageButton::STATE_NORMAL,
1218 warning_default_image);
1219 reauth_button->SetBounds(
1220 available_width, 0, kWarningButtonWidth, kButtonHeight);
1221
1222 email_button->AddChildView(reauth_button);
1223 reauth_account_button_map_[reauth_button] = account;
1224 }
1177 } 1225 }
1178 1226
1179 views::View* ProfileChooserView::CreateGaiaSigninView( 1227 views::View* ProfileChooserView::CreateGaiaSigninView() {
1180 bool add_secondary_account) { 1228 GURL url;
1229 int message_id;
1230
1231 switch (view_mode_) {
noms (inactive) 2014/05/16 13:37:04 Nice! <3
Roger Tawa OOO till Jul 10th 2014/05/16 19:43:49 Done.
1232 case BUBBLE_VIEW_MODE_GAIA_SIGNIN:
1233 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_SIGN_IN,
1234 false /* auto_close */,
1235 true /* is_constrained */);
1236 message_id = IDS_PROFILES_GAIA_SIGNIN_TITLE;
1237 break;
1238 case BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT:
1239 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT,
1240 false /* auto_close */,
1241 true /* is_constrained */);
1242 message_id = IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE;
1243 break;
1244 case BUBBLE_VIEW_MODE_GAIA_REAUTH: {
1245 SigninErrorController* error =
1246 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile())->
1247 signin_error_controller();
1248 DCHECK(error->HasError());
1249 url = signin::GetReauthURL(browser_->profile(), error->error_username());
1250 message_id = IDS_PROFILES_GAIA_REAUTH_TITLE;
1251 break;
1252 }
1253 }
1254
1181 // Adds Gaia signin webview 1255 // Adds Gaia signin webview
1182 Profile* profile = browser_->profile(); 1256 Profile* profile = browser_->profile();
1183 views::WebView* web_view = new views::WebView(profile); 1257 views::WebView* web_view = new views::WebView(profile);
1184 signin::Source source = add_secondary_account ?
1185 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT :
1186 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN;
1187 GURL url(signin::GetPromoURL(
1188 source, false /* auto_close */, true /* is_constrained */));
1189 web_view->LoadInitialURL(url); 1258 web_view->LoadInitialURL(url);
1190 web_view->SetPreferredSize( 1259 web_view->SetPreferredSize(
1191 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); 1260 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight));
1192 1261
1193 TitleCard* title_card = new TitleCard( 1262 TitleCard* title_card = new TitleCard(message_id, this,
1194 add_secondary_account ? IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE : 1263 &gaia_signin_cancel_button_);
1195 IDS_PROFILES_GAIA_SIGNIN_TITLE,
1196 this, &gaia_signin_cancel_button_);
1197 return TitleCard::AddPaddedTitleCard( 1264 return TitleCard::AddPaddedTitleCard(
1198 web_view, title_card, kFixedGaiaViewWidth); 1265 web_view, title_card, kFixedGaiaViewWidth);
1199 } 1266 }
1200 1267
1201 views::View* ProfileChooserView::CreateAccountRemovalView() { 1268 views::View* ProfileChooserView::CreateAccountRemovalView() {
1202 views::View* view = new views::View(); 1269 views::View* view = new views::View();
1203 views::GridLayout* layout = CreateSingleColumnLayout( 1270 views::GridLayout* layout = CreateSingleColumnLayout(
1204 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); 1271 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew);
1205 layout->SetInsets(0, 1272 layout->SetInsets(0,
1206 views::kButtonHEdgeMarginNew, 1273 views::kButtonHEdgeMarginNew,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 layout->StartRowWithPadding( 1366 layout->StartRowWithPadding(
1300 1, 0, 0, views::kUnrelatedControlVerticalSpacing); 1367 1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1301 layout->AddView(end_preview_and_relaunch_button_); 1368 layout->AddView(end_preview_and_relaunch_button_);
1302 1369
1303 TitleCard* title_card = new TitleCard( 1370 TitleCard* title_card = new TitleCard(
1304 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); 1371 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_);
1305 return TitleCard::AddPaddedTitleCard( 1372 return TitleCard::AddPaddedTitleCard(
1306 view, title_card, kFixedAccountRemovalViewWidth); 1373 view, title_card, kFixedAccountRemovalViewWidth);
1307 } 1374 }
1308 1375
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698