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

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

Issue 1235173002: Revert of Chrome user menu shouldn't close if a tab steals focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 profile_bubble_->GetWidget()->Show(); 511 profile_bubble_->GetWidget()->Show();
512 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); 512 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
513 } 513 }
514 514
515 // static 515 // static
516 bool ProfileChooserView::IsShowing() { 516 bool ProfileChooserView::IsShowing() {
517 return profile_bubble_ != NULL; 517 return profile_bubble_ != NULL;
518 } 518 }
519 519
520 // static 520 // static
521 ProfileChooserView::ShowingType ProfileChooserView::IsShowingInBrowser(
522 const Browser* browser) {
523 if (profile_bubble_ == nullptr)
524 return IS_NOT_SHOWING;
525
526 if (profile_bubble_->browser_ == browser || browser == nullptr)
527 return IS_SHOWING;
528
529 return IS_SHOWING_IN_ANOTHER_BROWSER;
530 }
531
532 // static
533 void ProfileChooserView::Hide() { 521 void ProfileChooserView::Hide() {
534 if (IsShowing()) 522 if (IsShowing())
535 profile_bubble_->GetWidget()->Close(); 523 profile_bubble_->GetWidget()->Close();
536 } 524 }
537 525
538 ProfileChooserView::ProfileChooserView(views::View* anchor_view, 526 ProfileChooserView::ProfileChooserView(views::View* anchor_view,
539 views::BubbleBorder::Arrow arrow, 527 views::BubbleBorder::Arrow arrow,
540 Browser* browser, 528 Browser* browser,
541 profiles::BubbleViewMode view_mode, 529 profiles::BubbleViewMode view_mode,
542 profiles::TutorialMode tutorial_mode, 530 profiles::TutorialMode tutorial_mode,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW); 679 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW);
692 break; 680 break;
693 default: 681 default:
694 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); 682 layout = CreateSingleColumnLayout(this, kFixedMenuWidth);
695 sub_view = CreateProfileChooserView(avatar_menu); 683 sub_view = CreateProfileChooserView(avatar_menu);
696 } 684 }
697 // Clears tutorial mode for all non-profile-chooser views. 685 // Clears tutorial mode for all non-profile-chooser views.
698 if (view_mode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) 686 if (view_mode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER)
699 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; 687 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE;
700 688
701 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN ||
702 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT ||
703 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH ||
704 tutorial_mode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) {
705 profile_bubble_->set_close_on_deactivate(false);
706 } else {
707 profile_bubble_->set_close_on_deactivate(close_on_deactivate_for_testing_);
708 }
709
710 layout->StartRow(1, 0); 689 layout->StartRow(1, 0);
711 layout->AddView(sub_view); 690 layout->AddView(sub_view);
712 Layout(); 691 Layout();
713 if (GetBubbleFrameView()) 692 if (GetBubbleFrameView())
714 SizeToContents(); 693 SizeToContents();
715 } 694 }
716 695
717 void ProfileChooserView::WindowClosing() { 696 void ProfileChooserView::WindowClosing() {
718 DCHECK_EQ(profile_bubble_, this); 697 DCHECK_EQ(profile_bubble_, this);
719 profile_bubble_ = NULL; 698 profile_bubble_ = NULL;
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1704 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1726 IncognitoModePrefs::DISABLED; 1705 IncognitoModePrefs::DISABLED;
1727 return incognito_available && !browser_->profile()->IsGuestSession(); 1706 return incognito_available && !browser_->profile()->IsGuestSession();
1728 } 1707 }
1729 1708
1730 void ProfileChooserView::PostActionPerformed( 1709 void ProfileChooserView::PostActionPerformed(
1731 ProfileMetrics::ProfileDesktopMenu action_performed) { 1710 ProfileMetrics::ProfileDesktopMenu action_performed) {
1732 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1711 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1733 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1712 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1734 } 1713 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.h ('k') | chrome/browser/ui/webui/signin/inline_login_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698