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 "components/signin/core/browser/gaia_cookie_manager_service.h" | 5 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "base/values.h" | 19 #include "base/values.h" |
19 #include "components/data_use_measurement/core/data_use_user_data.h" | 20 #include "components/data_use_measurement/core/data_use_user_data.h" |
20 #include "components/signin/core/browser/account_tracker_service.h" | 21 #include "components/signin/core/browser/account_tracker_service.h" |
21 #include "components/signin/core/browser/signin_metrics.h" | 22 #include "components/signin/core/browser/signin_metrics.h" |
22 #include "google_apis/gaia/gaia_auth_fetcher.h" | 23 #include "google_apis/gaia/gaia_auth_fetcher.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } else if (std::find_if(requests_.begin(), requests_.end(), | 396 } else if (std::find_if(requests_.begin(), requests_.end(), |
396 [](const GaiaCookieRequest& request) { | 397 [](const GaiaCookieRequest& request) { |
397 return request.request_type() == LIST_ACCOUNTS; | 398 return request.request_type() == LIST_ACCOUNTS; |
398 }) == requests_.end()) { | 399 }) == requests_.end()) { |
399 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest(source)); | 400 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest(source)); |
400 } | 401 } |
401 } | 402 } |
402 | 403 |
403 void GaiaCookieManagerService::ForceOnCookieChangedProcessing() { | 404 void GaiaCookieManagerService::ForceOnCookieChangedProcessing() { |
404 GURL google_url = GaiaUrls::GetInstance()->google_url(); | 405 GURL google_url = GaiaUrls::GetInstance()->google_url(); |
405 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( | 406 std::unique_ptr<net::CanonicalCookie> cookie( |
406 kGaiaCookieName, std::string(), "." + google_url.host(), "/", | 407 base::MakeUnique<net::CanonicalCookie>( |
407 base::Time(), base::Time(), base::Time(), false, false, | 408 kGaiaCookieName, std::string(), "." + google_url.host(), "/", |
408 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT)); | 409 base::Time(), base::Time(), base::Time(), false, false, |
| 410 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT)); |
409 OnCookieChanged(*cookie, net::CookieStore::ChangeCause::UNKNOWN_DELETION); | 411 OnCookieChanged(*cookie, net::CookieStore::ChangeCause::UNKNOWN_DELETION); |
410 } | 412 } |
411 | 413 |
412 void GaiaCookieManagerService::LogOutAllAccounts(const std::string& source) { | 414 void GaiaCookieManagerService::LogOutAllAccounts(const std::string& source) { |
413 VLOG(1) << "GaiaCookieManagerService::LogOutAllAccounts"; | 415 VLOG(1) << "GaiaCookieManagerService::LogOutAllAccounts"; |
414 | 416 |
415 bool log_out_queued = false; | 417 bool log_out_queued = false; |
416 if (!requests_.empty()) { | 418 if (!requests_.empty()) { |
417 // Track requests to keep; all other unstarted requests will be removed. | 419 // Track requests to keep; all other unstarted requests will be removed. |
418 std::vector<GaiaCookieRequest> requests_to_keep; | 420 std::vector<GaiaCookieRequest> requests_to_keep; |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 break; | 818 break; |
817 case GaiaCookieRequestType::LIST_ACCOUNTS: | 819 case GaiaCookieRequestType::LIST_ACCOUNTS: |
818 uber_token_fetcher_.reset(); | 820 uber_token_fetcher_.reset(); |
819 signin_client_->DelayNetworkCall( | 821 signin_client_->DelayNetworkCall( |
820 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, | 822 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, |
821 base::Unretained(this))); | 823 base::Unretained(this))); |
822 break; | 824 break; |
823 } | 825 } |
824 } | 826 } |
825 } | 827 } |
OLD | NEW |