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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile_info_util.h" | 9 #include "chrome/browser/profiles/profile_info_util.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (view_to_display == ACCOUNT_MANAGEMENT_VIEW) { | 424 if (view_to_display == ACCOUNT_MANAGEMENT_VIEW) { |
425 const AvatarMenu::Item& active_item = avatar_menu->GetItemAt( | 425 const AvatarMenu::Item& active_item = avatar_menu->GetItemAt( |
426 avatar_menu->GetActiveProfileIndex()); | 426 avatar_menu->GetActiveProfileIndex()); |
427 DCHECK(active_item.signed_in); | 427 DCHECK(active_item.signed_in); |
428 } | 428 } |
429 | 429 |
430 ResetView(); | 430 ResetView(); |
431 RemoveAllChildViews(true); | 431 RemoveAllChildViews(true); |
432 view_mode_ = view_to_display; | 432 view_mode_ = view_to_display; |
433 | 433 |
434 views::GridLayout* layout = CreateSingleColumnLayout(this, kFixedMenuWidth); | |
435 | |
436 if (view_to_display == GAIA_SIGNIN_VIEW || | 434 if (view_to_display == GAIA_SIGNIN_VIEW || |
437 view_to_display == GAIA_ADD_ACCOUNT_VIEW) { | 435 view_to_display == GAIA_ADD_ACCOUNT_VIEW) { |
438 // Minimum size for embedded sign in pages as defined in Gaia. | 436 // Minimum size for embedded sign in pages as defined in Gaia. |
439 const int kMinGaiaViewWidth = 320; | 437 const int kMinGaiaViewWidth = 320; |
440 const int kMinGaiaViewHeight = 440; | 438 const int kMinGaiaViewHeight = 440; |
441 Profile* profile = browser_->profile(); | 439 Profile* profile = browser_->profile(); |
442 views::WebView* web_view = new views::WebView(profile); | 440 views::WebView* web_view = new views::WebView(profile); |
443 signin::Source source = (view_to_display == GAIA_SIGNIN_VIEW) ? | 441 signin::Source source = (view_to_display == GAIA_SIGNIN_VIEW) ? |
444 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN : | 442 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN : |
445 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT; | 443 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT; |
446 GURL url(signin::GetPromoURL( | 444 GURL url(signin::GetPromoURL( |
447 source, false /* auto_close */, true /* is_constrained */)); | 445 source, false /* auto_close */, true /* is_constrained */)); |
448 web_view->LoadInitialURL(url); | 446 web_view->LoadInitialURL(url); |
| 447 views::GridLayout* layout = |
| 448 CreateSingleColumnLayout(this, kMinGaiaViewWidth); |
449 layout->StartRow(1, 0); | 449 layout->StartRow(1, 0); |
450 layout->AddView(web_view); | 450 layout->AddView(web_view); |
451 layout->set_minimum_size( | 451 layout->set_minimum_size( |
452 gfx::Size(kMinGaiaViewWidth, kMinGaiaViewHeight)); | 452 gfx::Size(kMinGaiaViewWidth, kMinGaiaViewHeight)); |
453 Layout(); | 453 Layout(); |
454 if (GetBubbleFrameView()) | 454 if (GetBubbleFrameView()) |
455 SizeToContents(); | 455 SizeToContents(); |
456 return; | 456 return; |
457 } | 457 } |
458 | 458 |
| 459 views::GridLayout* layout = CreateSingleColumnLayout(this, kFixedMenuWidth); |
459 // Separate items into active and alternatives. | 460 // Separate items into active and alternatives. |
460 Indexes other_profiles; | 461 Indexes other_profiles; |
461 bool is_guest_view = true; | 462 bool is_guest_view = true; |
462 views::View* current_profile_view = NULL; | 463 views::View* current_profile_view = NULL; |
463 views::View* current_profile_accounts = NULL; | 464 views::View* current_profile_accounts = NULL; |
464 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { | 465 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { |
465 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); | 466 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); |
466 if (item.active) { | 467 if (item.active) { |
467 if (view_to_display == PROFILE_CHOOSER_VIEW) { | 468 if (view_to_display == PROFILE_CHOOSER_VIEW) { |
468 current_profile_view = CreateCurrentProfileView(item, false); | 469 current_profile_view = CreateCurrentProfileView(item, false); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 if (!is_primary_account) { | 841 if (!is_primary_account) { |
841 email_button->set_menu_marker(menu_marker); | 842 email_button->set_menu_marker(menu_marker); |
842 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 843 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
843 } | 844 } |
844 layout->StartRow(1, 0); | 845 layout->StartRow(1, 0); |
845 layout->AddView(email_button); | 846 layout->AddView(email_button); |
846 | 847 |
847 // Save the original email address, as the button text could be elided. | 848 // Save the original email address, as the button text could be elided. |
848 current_profile_accounts_map_[email_button] = account; | 849 current_profile_accounts_map_[email_button] = account; |
849 } | 850 } |
OLD | NEW |