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

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: Put error in 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 ButtonIndexes::const_iterator profile_match = 632 ButtonIndexes::const_iterator profile_match =
620 open_other_profile_indexes_map_.find(sender); 633 open_other_profile_indexes_map_.find(sender);
621 if (profile_match != open_other_profile_indexes_map_.end()) { 634 if (profile_match != open_other_profile_indexes_map_.end()) {
622 avatar_menu_->SwitchToProfile( 635 avatar_menu_->SwitchToProfile(
623 profile_match->second, 636 profile_match->second,
624 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, 637 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW,
625 ProfileMetrics::SWITCH_PROFILE_ICON); 638 ProfileMetrics::SWITCH_PROFILE_ICON);
626 } else { 639 } else {
627 // This was a profile accounts button. 640 // This was a profile accounts button.
628 AccountButtonIndexes::const_iterator account_match = 641 AccountButtonIndexes::const_iterator account_match =
629 current_profile_accounts_map_.find(sender); 642 delete_account_button_map_.find(sender);
630 DCHECK(account_match != current_profile_accounts_map_.end()); 643 if (account_match != delete_account_button_map_.end()) {
631 account_id_to_remove_ = account_match->second; 644 account_id_to_remove_ = account_match->second;
632 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get()); 645 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get());
646 } else {
647 account_match = reauth_account_button_map_.find(sender);
648 DCHECK(account_match != reauth_account_button_map_.end());
649 ShowView(BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get());
650 }
633 } 651 }
634 } 652 }
635 } 653 }
636 654
637 void ProfileChooserView::RemoveAccount() { 655 void ProfileChooserView::RemoveAccount() {
638 DCHECK(!account_id_to_remove_.empty()); 656 DCHECK(!account_id_to_remove_.empty());
639 MutableProfileOAuth2TokenService* oauth2_token_service = 657 MutableProfileOAuth2TokenService* oauth2_token_service =
640 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( 658 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile(
641 browser_->profile()); 659 browser_->profile());
642 if (oauth2_token_service) 660 if (oauth2_token_service)
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 profiles::kAvatarBubbleAccountsBackgroundColor)); 1125 profiles::kAvatarBubbleAccountsBackgroundColor));
1108 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1126 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth);
1109 1127
1110 Profile* profile = browser_->profile(); 1128 Profile* profile = browser_->profile();
1111 std::string primary_account = 1129 std::string primary_account =
1112 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername(); 1130 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername();
1113 DCHECK(!primary_account.empty()); 1131 DCHECK(!primary_account.empty());
1114 std::vector<std::string>accounts = 1132 std::vector<std::string>accounts =
1115 profiles::GetSecondaryAccountsForProfile(profile, primary_account); 1133 profiles::GetSecondaryAccountsForProfile(profile, primary_account);
1116 1134
1135 // Get state of authentication error, if any.
1136 std::string error_account_id;
1137 SigninErrorController* error =
1138 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->
1139 signin_error_controller();
1140 if (error->HasError())
1141 error_account_id = error->error_account_id();
1142
1117 // The primary account should always be listed first. 1143 // The primary account should always be listed first.
1118 // TODO(rogerta): we still need to further differentiate the primary account 1144 // TODO(rogerta): we still need to further differentiate the primary account
1119 // from the others in the UI, so more work is likely required here: 1145 // from the others in the UI, so more work is likely required here:
1120 // crbug.com/311124. 1146 // crbug.com/311124.
1121 CreateAccountButton(layout, primary_account, true, kFixedMenuWidth); 1147 CreateAccountButton(layout, primary_account, true,
1148 error_account_id == primary_account, kFixedMenuWidth);
1122 for (size_t i = 0; i < accounts.size(); ++i) 1149 for (size_t i = 0; i < accounts.size(); ++i)
1123 CreateAccountButton(layout, accounts[i], false, kFixedMenuWidth); 1150 CreateAccountButton(layout, accounts[i], false,
1151 error_account_id == accounts[i], kFixedMenuWidth);
1124 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1152 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
1125 1153
1126 add_account_link_ = CreateLink(l10n_util::GetStringFUTF16( 1154 add_account_link_ = CreateLink(l10n_util::GetStringFUTF16(
1127 IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, avatar_item.name), this); 1155 IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, avatar_item.name), this);
1128 add_account_link_->SetBorder(views::Border::CreateEmptyBorder( 1156 add_account_link_->SetBorder(views::Border::CreateEmptyBorder(
1129 0, views::kButtonVEdgeMarginNew, 1157 0, views::kButtonVEdgeMarginNew,
1130 views::kRelatedControlVerticalSpacing, 0)); 1158 views::kRelatedControlVerticalSpacing, 0));
1131 layout->StartRow(1, 0); 1159 layout->StartRow(1, 0);
1132 layout->AddView(add_account_link_); 1160 layout->AddView(add_account_link_);
1133 return view; 1161 return view;
1134 } 1162 }
1135 1163
1136 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, 1164 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout,
1137 const std::string& account, 1165 const std::string& account,
1138 bool is_primary_account, 1166 bool is_primary_account,
1167 bool reauth_required,
1139 int width) { 1168 int width) {
1140 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1169 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1141 const gfx::ImageSkia* default_image = 1170 const gfx::ImageSkia* delete_default_image =
1142 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); 1171 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia();
1143 int kDeleteButtonWidth = default_image->width(); 1172 const int kDeleteButtonWidth = delete_default_image->width();
1173 const gfx::ImageSkia* warning_default_image = reauth_required ?
1174 rb->GetImageNamed(IDR_WARNING).ToImageSkia() : NULL;
1175 const int kWarningButtonWidth = reauth_required ?
1176 warning_default_image->width() + views::kRelatedButtonHSpacing : 0;
1144 int available_width = width - 1177 int available_width = width -
1145 kDeleteButtonWidth - views::kButtonHEdgeMarginNew; 1178 kDeleteButtonWidth - kWarningButtonWidth - views::kButtonHEdgeMarginNew;
1146 1179
1147 views::LabelButton* email_button = new BackgroundColorHoverButton( 1180 views::LabelButton* email_button = new BackgroundColorHoverButton(
1148 NULL, 1181 NULL,
1149 gfx::ElideEmail(base::UTF8ToUTF16(account), 1182 gfx::ElideEmail(base::UTF8ToUTF16(account),
1150 rb->GetFontList(ui::ResourceBundle::BaseFont), 1183 rb->GetFontList(ui::ResourceBundle::BaseFont),
1151 available_width), 1184 available_width),
1152 gfx::ImageSkia(), 1185 gfx::ImageSkia(),
1153 gfx::ImageSkia()); 1186 gfx::ImageSkia());
1154 layout->StartRow(1, 0); 1187 layout->StartRow(1, 0);
1155 layout->AddView(email_button); 1188 layout->AddView(email_button);
1156 1189
1157 // Delete button. 1190 // Delete button.
1158 views::ImageButton* delete_button = new views::ImageButton(this); 1191 views::ImageButton* delete_button = new views::ImageButton(this);
1159 delete_button->SetImageAlignment(views::ImageButton::ALIGN_RIGHT, 1192 delete_button->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
1160 views::ImageButton::ALIGN_MIDDLE); 1193 views::ImageButton::ALIGN_MIDDLE);
1161 delete_button->SetImage(views::ImageButton::STATE_NORMAL, 1194 delete_button->SetImage(views::ImageButton::STATE_NORMAL,
1162 default_image); 1195 delete_default_image);
1163 delete_button->SetImage(views::ImageButton::STATE_HOVERED, 1196 delete_button->SetImage(views::ImageButton::STATE_HOVERED,
1164 rb->GetImageSkiaNamed(IDR_CLOSE_1_H)); 1197 rb->GetImageSkiaNamed(IDR_CLOSE_1_H));
1165 delete_button->SetImage(views::ImageButton::STATE_PRESSED, 1198 delete_button->SetImage(views::ImageButton::STATE_PRESSED,
1166 rb->GetImageSkiaNamed(IDR_CLOSE_1_P)); 1199 rb->GetImageSkiaNamed(IDR_CLOSE_1_P));
1167 delete_button->SetBounds( 1200 delete_button->SetBounds(
1168 available_width, 0, kDeleteButtonWidth, kButtonHeight); 1201 available_width + kWarningButtonWidth, 0,
1202 kDeleteButtonWidth, kButtonHeight);
1169 1203
1170 email_button->set_notify_enter_exit_on_child(true); 1204 email_button->set_notify_enter_exit_on_child(true);
1171 email_button->AddChildView(delete_button); 1205 email_button->AddChildView(delete_button);
1172 1206
1173 // Save the original email address, as the button text could be elided. 1207 // Save the original email address, as the button text could be elided.
1174 current_profile_accounts_map_[delete_button] = account; 1208 delete_account_button_map_[delete_button] = account;
1209
1210 // Warning button.
1211 if (reauth_required) {
1212 views::ImageButton* reauth_button = new views::ImageButton(this);
1213 reauth_button->SetImageAlignment(views::ImageButton::ALIGN_LEFT,
1214 views::ImageButton::ALIGN_MIDDLE);
1215 reauth_button->SetImage(views::ImageButton::STATE_NORMAL,
1216 warning_default_image);
1217 reauth_button->SetBounds(
1218 available_width, 0, kWarningButtonWidth, kButtonHeight);
1219
1220 email_button->AddChildView(reauth_button);
1221 reauth_account_button_map_[reauth_button] = account;
1222 }
1175 } 1223 }
1176 1224
1177 views::View* ProfileChooserView::CreateGaiaSigninView( 1225 views::View* ProfileChooserView::CreateGaiaSigninView() {
1178 bool add_secondary_account) { 1226 GURL url;
1227 int message_id;
1228
1229 switch (view_mode_) {
1230 case BUBBLE_VIEW_MODE_GAIA_SIGNIN:
1231 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_SIGN_IN,
1232 false /* auto_close */,
1233 true /* is_constrained */);
1234 message_id = IDS_PROFILES_GAIA_SIGNIN_TITLE;
1235 break;
1236 case BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT:
1237 url = signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT,
1238 false /* auto_close */,
1239 true /* is_constrained */);
1240 message_id = IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE;
1241 break;
1242 case BUBBLE_VIEW_MODE_GAIA_REAUTH: {
1243 SigninErrorController* error =
1244 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile())->
1245 signin_error_controller();
1246 DCHECK(error->HasError());
1247 url = signin::GetReauthURL(browser_->profile(), error->error_username());
1248 message_id = IDS_PROFILES_GAIA_REAUTH_TITLE;
1249 break;
1250 }
1251 }
1252
1179 // Adds Gaia signin webview 1253 // Adds Gaia signin webview
1180 Profile* profile = browser_->profile(); 1254 Profile* profile = browser_->profile();
1181 views::WebView* web_view = new views::WebView(profile); 1255 views::WebView* web_view = new views::WebView(profile);
1182 signin::Source source = add_secondary_account ?
1183 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT :
1184 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN;
1185 GURL url(signin::GetPromoURL(
1186 source, false /* auto_close */, true /* is_constrained */));
1187 web_view->LoadInitialURL(url); 1256 web_view->LoadInitialURL(url);
1188 web_view->SetPreferredSize( 1257 web_view->SetPreferredSize(
1189 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); 1258 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight));
1190 1259
1191 TitleCard* title_card = new TitleCard( 1260 TitleCard* title_card = new TitleCard(message_id, this,
1192 add_secondary_account ? IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE : 1261 &gaia_signin_cancel_button_);
1193 IDS_PROFILES_GAIA_SIGNIN_TITLE,
1194 this, &gaia_signin_cancel_button_);
1195 return TitleCard::AddPaddedTitleCard( 1262 return TitleCard::AddPaddedTitleCard(
1196 web_view, title_card, kFixedGaiaViewWidth); 1263 web_view, title_card, kFixedGaiaViewWidth);
1197 } 1264 }
1198 1265
1199 views::View* ProfileChooserView::CreateAccountRemovalView() { 1266 views::View* ProfileChooserView::CreateAccountRemovalView() {
1200 views::View* view = new views::View(); 1267 views::View* view = new views::View();
1201 views::GridLayout* layout = CreateSingleColumnLayout( 1268 views::GridLayout* layout = CreateSingleColumnLayout(
1202 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); 1269 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew);
1203 layout->SetInsets(0, 1270 layout->SetInsets(0,
1204 views::kButtonHEdgeMarginNew, 1271 views::kButtonHEdgeMarginNew,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 layout->StartRowWithPadding( 1364 layout->StartRowWithPadding(
1298 1, 0, 0, views::kUnrelatedControlVerticalSpacing); 1365 1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1299 layout->AddView(end_preview_and_relaunch_button_); 1366 layout->AddView(end_preview_and_relaunch_button_);
1300 1367
1301 TitleCard* title_card = new TitleCard( 1368 TitleCard* title_card = new TitleCard(
1302 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); 1369 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_);
1303 return TitleCard::AddPaddedTitleCard( 1370 return TitleCard::AddPaddedTitleCard(
1304 view, title_card, kFixedAccountRemovalViewWidth); 1371 view, title_card, kFixedAccountRemovalViewWidth);
1305 } 1372 }
1306 1373
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698