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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 2647793004: [Merge to branch 2924]propagate proxy auth info into the browser context. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "components/signin/core/account_id/account_id.h" 66 #include "components/signin/core/account_id/account_id.h"
67 #include "components/signin/core/browser/signin_client.h" 67 #include "components/signin/core/browser/signin_client.h"
68 #include "components/user_manager/known_user.h" 68 #include "components/user_manager/known_user.h"
69 #include "components/user_manager/user_manager.h" 69 #include "components/user_manager/user_manager.h"
70 #include "components/user_manager/user_names.h" 70 #include "components/user_manager/user_names.h"
71 #include "components/user_manager/user_type.h" 71 #include "components/user_manager/user_type.h"
72 #include "components/version_info/version_info.h" 72 #include "components/version_info/version_info.h"
73 #include "content/public/browser/browser_thread.h" 73 #include "content/public/browser/browser_thread.h"
74 #include "content/public/browser/notification_service.h" 74 #include "content/public/browser/notification_service.h"
75 #include "content/public/browser/notification_types.h" 75 #include "content/public/browser/notification_types.h"
76 #include "content/public/browser/storage_partition.h"
76 #include "content/public/browser/user_metrics.h" 77 #include "content/public/browser/user_metrics.h"
77 #include "google_apis/gaia/gaia_auth_util.h" 78 #include "google_apis/gaia/gaia_auth_util.h"
78 #include "google_apis/gaia/google_service_auth_error.h" 79 #include "google_apis/gaia/google_service_auth_error.h"
79 #include "net/http/http_auth_cache.h" 80 #include "net/http/http_auth_cache.h"
80 #include "net/http/http_network_session.h" 81 #include "net/http/http_network_session.h"
81 #include "net/http/http_transaction_factory.h" 82 #include "net/http/http_transaction_factory.h"
82 #include "net/url_request/url_request_context.h" 83 #include "net/url_request/url_request_context.h"
83 #include "net/url_request/url_request_context_getter.h" 84 #include "net/url_request/url_request_context_getter.h"
84 #include "ui/accessibility/ax_enums.h" 85 #include "ui/accessibility/ax_enums.h"
85 #include "ui/base/l10n/l10n_util.h" 86 #include "ui/base/l10n/l10n_util.h"
(...skipping 22 matching lines...) Expand all
108 // Delay for restarting the ui if safe-mode login has failed. 109 // Delay for restarting the ui if safe-mode login has failed.
109 const long int kSafeModeRestartUiDelayMs = 30000; 110 const long int kSafeModeRestartUiDelayMs = 30000;
110 111
111 // Makes a call to the policy subsystem to reload the policy when we detect 112 // Makes a call to the policy subsystem to reload the policy when we detect
112 // authentication change. 113 // authentication change.
113 void RefreshPoliciesOnUIThread() { 114 void RefreshPoliciesOnUIThread() {
114 if (g_browser_process->policy_service()) 115 if (g_browser_process->policy_service())
115 g_browser_process->policy_service()->RefreshPolicies(base::Closure()); 116 g_browser_process->policy_service()->RefreshPolicies(base::Closure());
116 } 117 }
117 118
118 // Copies any authentication details that were entered in the login profile in 119 // Copies any authentication details that were entered in the login profile to
119 // the mail profile to make sure all subsystems of Chrome can access the network 120 // the main profile to make sure all subsystems of Chrome can access the network
120 // with the provided authentication which are possibly for a proxy server. 121 // with the provided authentication which are possibly for a proxy server.
121 void TransferContextAuthenticationsOnIOThread( 122 void TransferContextAuthenticationsOnIOThread(
122 net::URLRequestContextGetter* default_profile_context_getter, 123 net::URLRequestContextGetter* default_profile_context_getter,
124 net::URLRequestContextGetter* webview_context_getter,
123 net::URLRequestContextGetter* browser_process_context_getter) { 125 net::URLRequestContextGetter* browser_process_context_getter) {
124 net::HttpAuthCache* new_cache = 126 net::HttpAuthCache* new_cache =
125 browser_process_context_getter->GetURLRequestContext()-> 127 browser_process_context_getter->GetURLRequestContext()->
126 http_transaction_factory()->GetSession()->http_auth_cache(); 128 http_transaction_factory()->GetSession()->http_auth_cache();
127 net::HttpAuthCache* old_cache = 129 net::HttpAuthCache* old_cache =
128 default_profile_context_getter->GetURLRequestContext()-> 130 default_profile_context_getter->GetURLRequestContext()->
129 http_transaction_factory()->GetSession()->http_auth_cache(); 131 http_transaction_factory()->GetSession()->http_auth_cache();
130 new_cache->UpdateAllFrom(*old_cache); 132 new_cache->UpdateAllFrom(*old_cache);
133
134 // Copy the auth cache from webview's context since the proxy authentication
135 // information is saved in webview's context.
136 if (webview_context_getter) {
137 net::HttpAuthCache* webview_cache =
138 webview_context_getter->GetURLRequestContext()
139 ->http_transaction_factory()
140 ->GetSession()
141 ->http_auth_cache();
142 new_cache->UpdateAllFrom(*webview_cache);
143 }
144
131 VLOG(1) << "Main request context populated with authentication data."; 145 VLOG(1) << "Main request context populated with authentication data.";
132 // Last but not least tell the policy subsystem to refresh now as it might 146 // Last but not least tell the policy subsystem to refresh now as it might
133 // have been stuck until now too. 147 // have been stuck until now too.
134 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 148 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
135 base::Bind(&RefreshPoliciesOnUIThread)); 149 base::Bind(&RefreshPoliciesOnUIThread));
136 } 150 }
137 151
138 // Record UMA for password login of regular user when Easy sign-in is enabled. 152 // Record UMA for password login of regular user when Easy sign-in is enabled.
139 void RecordPasswordLoginEvent(const UserContext& user_context) { 153 void RecordPasswordLoginEvent(const UserContext& user_context) {
140 EasyUnlockService* easy_unlock_service = 154 EasyUnlockService* easy_unlock_service =
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // in the profile. Therefore we have to give it some time to make sure it 319 // in the profile. Therefore we have to give it some time to make sure it
306 // has been updated before we copy it. 320 // has been updated before we copy it.
307 VLOG(1) << "Authentication was entered manually, possibly for proxyauth."; 321 VLOG(1) << "Authentication was entered manually, possibly for proxyauth.";
308 scoped_refptr<net::URLRequestContextGetter> browser_process_context_getter = 322 scoped_refptr<net::URLRequestContextGetter> browser_process_context_getter =
309 g_browser_process->system_request_context(); 323 g_browser_process->system_request_context();
310 Profile* signin_profile = ProfileHelper::GetSigninProfile(); 324 Profile* signin_profile = ProfileHelper::GetSigninProfile();
311 scoped_refptr<net::URLRequestContextGetter> signin_profile_context_getter = 325 scoped_refptr<net::URLRequestContextGetter> signin_profile_context_getter =
312 signin_profile->GetRequestContext(); 326 signin_profile->GetRequestContext();
313 DCHECK(browser_process_context_getter.get()); 327 DCHECK(browser_process_context_getter.get());
314 DCHECK(signin_profile_context_getter.get()); 328 DCHECK(signin_profile_context_getter.get());
329
330 content::StoragePartition* signin_partition = login::GetSigninPartition();
331 scoped_refptr<net::URLRequestContextGetter> webview_context_getter;
332 if (signin_partition) {
333 webview_context_getter = signin_partition->GetURLRequestContext();
334 DCHECK(webview_context_getter.get());
335 }
336
315 content::BrowserThread::PostDelayedTask( 337 content::BrowserThread::PostDelayedTask(
316 content::BrowserThread::IO, FROM_HERE, 338 content::BrowserThread::IO, FROM_HERE,
317 base::Bind(&TransferContextAuthenticationsOnIOThread, 339 base::Bind(&TransferContextAuthenticationsOnIOThread,
318 base::RetainedRef(signin_profile_context_getter), 340 base::RetainedRef(signin_profile_context_getter),
341 base::RetainedRef(webview_context_getter),
319 base::RetainedRef(browser_process_context_getter)), 342 base::RetainedRef(browser_process_context_getter)),
320 base::TimeDelta::FromMilliseconds(kAuthCacheTransferDelayMs)); 343 base::TimeDelta::FromMilliseconds(kAuthCacheTransferDelayMs));
321 } 344 }
322 } 345 }
323 346
324 //////////////////////////////////////////////////////////////////////////////// 347 ////////////////////////////////////////////////////////////////////////////////
325 // ExistingUserController, ArcKioskAppManager::ArcKioskAppManagerObserver 348 // ExistingUserController, ArcKioskAppManager::ArcKioskAppManagerObserver
326 // implementation: 349 // implementation:
327 // 350 //
328 351
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 } 1343 }
1321 1344
1322 // Otherwise, show the unrecoverable cryptohome error UI and ask user's 1345 // Otherwise, show the unrecoverable cryptohome error UI and ask user's
1323 // permission to collect a feedback. 1346 // permission to collect a feedback.
1324 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); 1347 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE);
1325 VLOG(1) << "Show unrecoverable cryptohome error dialog."; 1348 VLOG(1) << "Show unrecoverable cryptohome error dialog.";
1326 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); 1349 login_display_->ShowUnrecoverableCrypthomeErrorDialog();
1327 } 1350 }
1328 1351
1329 } // namespace chromeos 1352 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698