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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/ui/chrome_pages.h" | 27 #include "chrome/browser/ui/chrome_pages.h" |
28 #include "chrome/browser/ui/singleton_tabs.h" | 28 #include "chrome/browser/ui/singleton_tabs.h" |
29 #include "chrome/browser/ui/user_manager.h" | 29 #include "chrome/browser/ui/user_manager.h" |
30 #include "chrome/browser/ui/views/profiles/user_manager_view.h" | 30 #include "chrome/browser/ui/views/profiles/user_manager_view.h" |
31 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 31 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
35 #include "chrome/grit/chromium_strings.h" | 35 #include "chrome/grit/chromium_strings.h" |
36 #include "chrome/grit/generated_resources.h" | 36 #include "chrome/grit/generated_resources.h" |
37 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" | |
38 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
39 #include "components/signin/core/browser/signin_error_controller.h" | 38 #include "components/signin/core/browser/signin_error_controller.h" |
40 #include "components/signin/core/browser/signin_manager.h" | 39 #include "components/signin/core/browser/signin_manager.h" |
41 #include "components/signin/core/common/profile_management_switches.h" | 40 #include "components/signin/core/common/profile_management_switches.h" |
42 #include "content/public/browser/render_widget_host_view.h" | 41 #include "content/public/browser/render_widget_host_view.h" |
43 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
44 #include "third_party/skia/include/core/SkColor.h" | 43 #include "third_party/skia/include/core/SkColor.h" |
45 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
46 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
47 #include "ui/compositor/clip_transform_recorder.h" | 46 #include "ui/compositor/clip_transform_recorder.h" |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 account_match = reauth_account_button_map_.find(sender); | 833 account_match = reauth_account_button_map_.find(sender); |
835 DCHECK(account_match != reauth_account_button_map_.end()); | 834 DCHECK(account_match != reauth_account_button_map_.end()); |
836 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); | 835 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); |
837 } | 836 } |
838 } | 837 } |
839 } | 838 } |
840 } | 839 } |
841 | 840 |
842 void ProfileChooserView::RemoveAccount() { | 841 void ProfileChooserView::RemoveAccount() { |
843 DCHECK(!account_id_to_remove_.empty()); | 842 DCHECK(!account_id_to_remove_.empty()); |
844 MutableProfileOAuth2TokenService* oauth2_token_service = | 843 ProfileOAuth2TokenService* oauth2_token_service = |
845 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( | 844 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); |
846 browser_->profile()); | |
847 if (oauth2_token_service) { | 845 if (oauth2_token_service) { |
848 oauth2_token_service->RevokeCredentials(account_id_to_remove_); | 846 oauth2_token_service->RevokeCredentials(account_id_to_remove_); |
849 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT); | 847 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT); |
850 } | 848 } |
851 account_id_to_remove_.clear(); | 849 account_id_to_remove_.clear(); |
852 | 850 |
853 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); | 851 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
854 } | 852 } |
855 | 853 |
856 void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { | 854 void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1741 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1744 IncognitoModePrefs::DISABLED; | 1742 IncognitoModePrefs::DISABLED; |
1745 return incognito_available && !browser_->profile()->IsGuestSession(); | 1743 return incognito_available && !browser_->profile()->IsGuestSession(); |
1746 } | 1744 } |
1747 | 1745 |
1748 void ProfileChooserView::PostActionPerformed( | 1746 void ProfileChooserView::PostActionPerformed( |
1749 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1747 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1750 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1748 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1751 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1749 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1752 } | 1750 } |
OLD | NEW |