Chromium Code Reviews| 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" |
| 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 13 #include "chrome/browser/profiles/profile_info_cache.h" | 13 #include "chrome/browser/profiles/profile_info_cache.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/profiles/profile_metrics.h" | 15 #include "chrome/browser/profiles/profile_metrics.h" |
| 16 #include "chrome/browser/profiles/profile_window.h" | 16 #include "chrome/browser/profiles/profile_window.h" |
| 17 #include "chrome/browser/profiles/profiles_state.h" | 17 #include "chrome/browser/profiles/profiles_state.h" |
| 18 #include "chrome/browser/signin/chrome_signin_helper.h" | 18 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 20 #include "chrome/browser/signin/signin_error_controller_factory.h" | 20 #include "chrome/browser/signin/signin_error_controller_factory.h" |
| 21 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
| 22 #include "chrome/browser/signin/signin_promo.h" | 22 #include "chrome/browser/signin/signin_promo.h" |
| 23 #include "chrome/browser/signin/signin_ui_util.h" | 23 #include "chrome/browser/signin/signin_ui_util.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_commands.h" | 25 #include "chrome/browser/ui/browser_commands.h" |
| 26 #include "chrome/browser/ui/browser_dialogs.h" | 26 #include "chrome/browser/ui/browser_dialogs.h" |
| 27 #include "chrome/browser/ui/browser_list.h" | |
| 27 #include "chrome/browser/ui/chrome_pages.h" | 28 #include "chrome/browser/ui/chrome_pages.h" |
| 28 #include "chrome/browser/ui/singleton_tabs.h" | 29 #include "chrome/browser/ui/singleton_tabs.h" |
| 29 #include "chrome/browser/ui/user_manager.h" | 30 #include "chrome/browser/ui/user_manager.h" |
| 31 #include "chrome/browser/ui/views/frame/browser_view.h" | |
| 30 #include "chrome/browser/ui/views/profiles/user_manager_view.h" | 32 #include "chrome/browser/ui/views/profiles/user_manager_view.h" |
| 31 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 33 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 34 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 33 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| 35 #include "chrome/grit/chromium_strings.h" | 37 #include "chrome/grit/chromium_strings.h" |
| 36 #include "chrome/grit/generated_resources.h" | 38 #include "chrome/grit/generated_resources.h" |
| 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 39 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 38 #include "components/signin/core/browser/signin_error_controller.h" | 40 #include "components/signin/core/browser/signin_error_controller.h" |
| 39 #include "components/signin/core/browser/signin_header_helper.h" | 41 #include "components/signin/core/browser/signin_header_helper.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 if (IsShowing()) { | 558 if (IsShowing()) { |
| 557 if (tutorial_mode != profiles::TUTORIAL_MODE_NONE) { | 559 if (tutorial_mode != profiles::TUTORIAL_MODE_NONE) { |
| 558 profile_bubble_->tutorial_mode_ = tutorial_mode; | 560 profile_bubble_->tutorial_mode_ = tutorial_mode; |
| 559 profile_bubble_->ShowView(view_mode, profile_bubble_->avatar_menu_.get()); | 561 profile_bubble_->ShowView(view_mode, profile_bubble_->avatar_menu_.get()); |
| 560 } | 562 } |
| 561 return; | 563 return; |
| 562 } | 564 } |
| 563 | 565 |
| 564 profile_bubble_ = new ProfileChooserView(anchor_view, arrow, browser, | 566 profile_bubble_ = new ProfileChooserView(anchor_view, arrow, browser, |
| 565 view_mode, tutorial_mode, manage_accounts_params.service_type); | 567 view_mode, tutorial_mode, manage_accounts_params.service_type); |
| 568 BrowserView* browser_view = static_cast<BrowserView*>(browser->window()); | |
|
msw
2015/09/10 23:42:00
nit: use BrowserView::GetBrowserViewForBrowser
| |
| 569 profile_bubble_->set_parent_window( | |
| 570 browser_view->GetActiveWebContents()->GetNativeView()); | |
|
msw
2015/09/10 23:42:00
Setting the parent of the profile bubble to the ac
| |
| 566 views::BubbleDelegateView::CreateBubble(profile_bubble_); | 571 views::BubbleDelegateView::CreateBubble(profile_bubble_); |
| 567 profile_bubble_->set_close_on_deactivate(close_on_deactivate_for_testing_); | 572 profile_bubble_->set_close_on_deactivate(close_on_deactivate_for_testing_); |
| 568 profile_bubble_->SetAlignment(border_alignment); | 573 profile_bubble_->SetAlignment(border_alignment); |
| 569 profile_bubble_->GetWidget()->Show(); | 574 profile_bubble_->GetWidget()->Show(); |
| 570 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | 575 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
| 571 } | 576 } |
| 572 | 577 |
| 573 // static | 578 // static |
| 574 bool ProfileChooserView::IsShowing() { | 579 bool ProfileChooserView::IsShowing() { |
| 575 return profile_bubble_ != NULL; | 580 return profile_bubble_ != NULL; |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1803 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1808 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1804 IncognitoModePrefs::DISABLED; | 1809 IncognitoModePrefs::DISABLED; |
| 1805 return incognito_available && !browser_->profile()->IsGuestSession(); | 1810 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1806 } | 1811 } |
| 1807 | 1812 |
| 1808 void ProfileChooserView::PostActionPerformed( | 1813 void ProfileChooserView::PostActionPerformed( |
| 1809 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1814 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1810 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1815 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1811 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1816 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1812 } | 1817 } |
| OLD | NEW |