Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/signin/ios/browser/account_consistency_service.h" | 5 #include "components/signin/ios/browser/account_consistency_service.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #import "base/mac/foundation_util.h" | 11 #import "base/mac/foundation_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "components/google/core/browser/google_util.h" | 14 #include "components/google/core/browser/google_util.h" |
| 15 #include "components/pref_registry/pref_registry_syncable.h" | 15 #include "components/pref_registry/pref_registry_syncable.h" |
| 16 #include "components/prefs/scoped_user_pref_update.h" | 16 #include "components/prefs/scoped_user_pref_update.h" |
| 17 #include "components/signin/core/browser/account_reconcilor.h" | 17 #include "components/signin/core/browser/account_reconcilor.h" |
| 18 #include "components/signin/core/browser/chrome_connected_header_helper.h" | |
| 18 #include "components/signin/core/browser/signin_client.h" | 19 #include "components/signin/core/browser/signin_client.h" |
| 19 #include "components/signin/core/browser/signin_header_helper.h" | 20 #include "components/signin/core/browser/signin_header_helper.h" |
| 20 #include "ios/web/public/browser_state.h" | 21 #include "ios/web/public/browser_state.h" |
| 21 #include "ios/web/public/web_state/web_state_policy_decider.h" | 22 #include "ios/web/public/web_state/web_state_policy_decider.h" |
| 22 #include "ios/web/public/web_view_creation_util.h" | 23 #include "ios/web/public/web_view_creation_util.h" |
| 23 #include "net/base/mac/url_conversions.h" | 24 #include "net/base/mac/url_conversions.h" |
| 24 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 25 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 } | 325 } |
| 325 applying_cookie_requests_ = true; | 326 applying_cookie_requests_ = true; |
| 326 | 327 |
| 327 const GURL url("https://" + cookie_requests_.front().domain); | 328 const GURL url("https://" + cookie_requests_.front().domain); |
| 328 std::string cookie_value = ""; | 329 std::string cookie_value = ""; |
| 329 // Expiration date of the cookie in the JavaScript convention of time, a | 330 // Expiration date of the cookie in the JavaScript convention of time, a |
| 330 // number of milliseconds since the epoch. | 331 // number of milliseconds since the epoch. |
| 331 double expiration_date = 0; | 332 double expiration_date = 0; |
| 332 switch (cookie_requests_.front().request_type) { | 333 switch (cookie_requests_.front().request_type) { |
| 333 case ADD_CHROME_CONNECTED_COOKIE: | 334 case ADD_CHROME_CONNECTED_COOKIE: |
| 334 cookie_value = signin::BuildMirrorRequestCookieIfPossible( | 335 cookie_value = |
|
msarda
2017/06/08 23:43:05
Let's avoid this change as explained previously.
| |
| 335 url, signin_manager_->GetAuthenticatedAccountInfo().gaia, | 336 signin::ChromeConnectedHeaderHelper::BuildRequestCookieIfPossible( |
| 336 cookie_settings_.get(), signin::PROFILE_MODE_DEFAULT); | 337 url, signin_manager_->GetAuthenticatedAccountInfo().gaia, |
| 338 cookie_settings_.get(), signin::PROFILE_MODE_DEFAULT); | |
| 337 if (cookie_value.empty()) { | 339 if (cookie_value.empty()) { |
| 338 // Don't add the cookie. Tentatively correct |last_cookie_update_map_|. | 340 // Don't add the cookie. Tentatively correct |last_cookie_update_map_|. |
| 339 last_cookie_update_map_.erase(cookie_requests_.front().domain); | 341 last_cookie_update_map_.erase(cookie_requests_.front().domain); |
| 340 FinishedApplyingCookieRequest(false); | 342 FinishedApplyingCookieRequest(false); |
| 341 return; | 343 return; |
| 342 } | 344 } |
| 343 // Create expiration date of Now+2y to roughly follow the APISID cookie. | 345 // Create expiration date of Now+2y to roughly follow the APISID cookie. |
| 344 expiration_date = | 346 expiration_date = |
| 345 (base::Time::Now() + base::TimeDelta::FromDays(730)).ToJsTime(); | 347 (base::Time::Now() + base::TimeDelta::FromDays(730)).ToJsTime(); |
| 346 break; | 348 break; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 // |browser_state_| is now active. There might be some pending cookie requests | 475 // |browser_state_| is now active. There might be some pending cookie requests |
| 474 // to apply. | 476 // to apply. |
| 475 ApplyCookieRequests(); | 477 ApplyCookieRequests(); |
| 476 } | 478 } |
| 477 | 479 |
| 478 void AccountConsistencyService::OnInactive() { | 480 void AccountConsistencyService::OnInactive() { |
| 479 // |browser_state_| is now inactive. Stop using |web_view_| and don't create | 481 // |browser_state_| is now inactive. Stop using |web_view_| and don't create |
| 480 // a new one until it is active. | 482 // a new one until it is active. |
| 481 ResetWKWebView(); | 483 ResetWKWebView(); |
| 482 } | 484 } |
| OLD | NEW |