| OLD | NEW |
| 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/profile_auth_data.h" | 5 #include "chrome/browser/chromeos/login/profile_auth_data.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 namespace chromeos { | 33 namespace chromeos { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 const char kSAMLStartCookie[] = "google-accounts-saml-start"; | 37 const char kSAMLStartCookie[] = "google-accounts-saml-start"; |
| 38 const char kSAMLEndCookie[] = "google-accounts-saml-end"; | 38 const char kSAMLEndCookie[] = "google-accounts-saml-end"; |
| 39 | 39 |
| 40 class ProfileAuthDataTransferer { | 40 class ProfileAuthDataTransferer { |
| 41 public: | 41 public: |
| 42 ProfileAuthDataTransferer( | 42 ProfileAuthDataTransferer( |
| 43 content::BrowserContext* from_context, | 43 net::URLRequestContextGetter* from_context, |
| 44 content::BrowserContext* to_context, | 44 net::URLRequestContextGetter* to_context, |
| 45 bool transfer_auth_cookies_and_channel_ids_on_first_login, | 45 bool transfer_auth_cookies_and_channel_ids_on_first_login, |
| 46 bool transfer_saml_auth_cookies_on_subsequent_login, | 46 bool transfer_saml_auth_cookies_on_subsequent_login, |
| 47 const base::Closure& completion_callback); | 47 const base::Closure& completion_callback); |
| 48 | 48 |
| 49 void BeginTransfer(); | 49 void BeginTransfer(); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 void BeginTransferOnIOThread(); | 52 void BeginTransferOnIOThread(); |
| 53 | 53 |
| 54 // Transfer the proxy auth cache from |from_context_| to |to_context_|. If | 54 // Transfer the proxy auth cache from |from_context_| to |to_context_|. If |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 base::Time saml_start_time_; | 112 base::Time saml_start_time_; |
| 113 // The time at which a redirect from a SAML IdP back to GAIA occurred. | 113 // The time at which a redirect from a SAML IdP back to GAIA occurred. |
| 114 base::Time saml_end_time_; | 114 base::Time saml_end_time_; |
| 115 | 115 |
| 116 bool first_login_; | 116 bool first_login_; |
| 117 bool waiting_for_auth_cookies_; | 117 bool waiting_for_auth_cookies_; |
| 118 bool waiting_for_channel_ids_; | 118 bool waiting_for_channel_ids_; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 ProfileAuthDataTransferer::ProfileAuthDataTransferer( | 121 ProfileAuthDataTransferer::ProfileAuthDataTransferer( |
| 122 content::BrowserContext* from_context, | 122 net::URLRequestContextGetter* from_context, |
| 123 content::BrowserContext* to_context, | 123 net::URLRequestContextGetter* to_context, |
| 124 bool transfer_auth_cookies_and_channel_ids_on_first_login, | 124 bool transfer_auth_cookies_and_channel_ids_on_first_login, |
| 125 bool transfer_saml_auth_cookies_on_subsequent_login, | 125 bool transfer_saml_auth_cookies_on_subsequent_login, |
| 126 const base::Closure& completion_callback) | 126 const base::Closure& completion_callback) |
| 127 : from_context_(from_context->GetRequestContext()), | 127 : from_context_(from_context), |
| 128 to_context_(to_context->GetRequestContext()), | 128 to_context_(to_context), |
| 129 transfer_auth_cookies_and_channel_ids_on_first_login_( | 129 transfer_auth_cookies_and_channel_ids_on_first_login_( |
| 130 transfer_auth_cookies_and_channel_ids_on_first_login), | 130 transfer_auth_cookies_and_channel_ids_on_first_login), |
| 131 transfer_saml_auth_cookies_on_subsequent_login_( | 131 transfer_saml_auth_cookies_on_subsequent_login_( |
| 132 transfer_saml_auth_cookies_on_subsequent_login), | 132 transfer_saml_auth_cookies_on_subsequent_login), |
| 133 completion_callback_(completion_callback), | 133 completion_callback_(completion_callback), |
| 134 first_login_(false), | 134 first_login_(false), |
| 135 waiting_for_auth_cookies_(false), | 135 waiting_for_auth_cookies_(false), |
| 136 waiting_for_channel_ids_(false) { | 136 waiting_for_channel_ids_(false) { |
| 137 } | 137 } |
| 138 | 138 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 void ProfileAuthDataTransferer::Finish() { | 307 void ProfileAuthDataTransferer::Finish() { |
| 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 309 if (!completion_callback_.is_null()) | 309 if (!completion_callback_.is_null()) |
| 310 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, completion_callback_); | 310 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, completion_callback_); |
| 311 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 311 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace | 314 } // namespace |
| 315 | 315 |
| 316 void ProfileAuthData::Transfer( | 316 void ProfileAuthData::Transfer( |
| 317 content::BrowserContext* from_context, | 317 net::URLRequestContextGetter* from_context, |
| 318 content::BrowserContext* to_context, | 318 net::URLRequestContextGetter* to_context, |
| 319 bool transfer_auth_cookies_and_channel_ids_on_first_login, | 319 bool transfer_auth_cookies_and_channel_ids_on_first_login, |
| 320 bool transfer_saml_auth_cookies_on_subsequent_login, | 320 bool transfer_saml_auth_cookies_on_subsequent_login, |
| 321 const base::Closure& completion_callback) { | 321 const base::Closure& completion_callback) { |
| 322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 323 (new ProfileAuthDataTransferer( | 323 (new ProfileAuthDataTransferer( |
| 324 from_context, | 324 from_context, |
| 325 to_context, | 325 to_context, |
| 326 transfer_auth_cookies_and_channel_ids_on_first_login, | 326 transfer_auth_cookies_and_channel_ids_on_first_login, |
| 327 transfer_saml_auth_cookies_on_subsequent_login, | 327 transfer_saml_auth_cookies_on_subsequent_login, |
| 328 completion_callback))->BeginTransfer(); | 328 completion_callback))->BeginTransfer(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace chromeos | 331 } // namespace chromeos |
| OLD | NEW |