| 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/profiles/avatar_menu_actions_desktop.h" | 5 #include "chrome/browser/profiles/avatar_menu_actions_desktop.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 bool AvatarMenuActionsDesktop::ShouldShowEditProfileLink() const { | 106 bool AvatarMenuActionsDesktop::ShouldShowEditProfileLink() const { |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 content::WebContents* AvatarMenuActionsDesktop::BeginSignOut() { | 110 content::WebContents* AvatarMenuActionsDesktop::BeginSignOut() { |
| 111 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 111 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 112 Profile* current_profile = browser_->profile(); | 112 Profile* current_profile = browser_->profile(); |
| 113 | 113 |
| 114 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 114 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
| 115 size_t index = cache.GetIndexOfProfileWithPath(current_profile->GetPath()); | 115 ProfileInfoEntry entry; |
| 116 cache.SetProfileSigninRequiredAtIndex(index, true); | 116 cache.GetInfoForProfile(current_profile->GetPath(), &entry); |
| 117 |
| 118 entry.set_is_signin_required(true); |
| 119 cache.SetInfoForProfile(entry); |
| 117 | 120 |
| 118 std::string landing_url = signin::GetLandingURL("close", 1).spec(); | 121 std::string landing_url = signin::GetLandingURL("close", 1).spec(); |
| 119 GURL logout_url(GaiaUrls::GetInstance()->service_logout_url()); | 122 GURL logout_url(GaiaUrls::GetInstance()->service_logout_url()); |
| 120 logout_url = net::AppendQueryParameter(logout_url, "continue", landing_url); | 123 logout_url = net::AppendQueryParameter(logout_url, "continue", landing_url); |
| 121 if (!logout_override_.empty()) { | 124 if (!logout_override_.empty()) { |
| 122 // We're testing... | 125 // We're testing... |
| 123 landing_url = logout_override_; | 126 landing_url = logout_override_; |
| 124 logout_url = GURL(logout_override_); | 127 logout_url = GURL(logout_override_); |
| 125 } | 128 } |
| 126 | 129 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 138 return contents; // returned for testing purposes | 141 return contents; // returned for testing purposes |
| 139 } | 142 } |
| 140 | 143 |
| 141 void AvatarMenuActionsDesktop::SetLogoutURL(const std::string& logout_url) { | 144 void AvatarMenuActionsDesktop::SetLogoutURL(const std::string& logout_url) { |
| 142 logout_override_ = logout_url; | 145 logout_override_ = logout_url; |
| 143 } | 146 } |
| 144 | 147 |
| 145 void AvatarMenuActionsDesktop::ActiveBrowserChanged(Browser* browser) { | 148 void AvatarMenuActionsDesktop::ActiveBrowserChanged(Browser* browser) { |
| 146 browser_ = browser; | 149 browser_ = browser; |
| 147 } | 150 } |
| OLD | NEW |