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/core/browser/child_account_info_fetcher_impl.h" | 5 #include "components/signin/core/browser/child_account_info_fetcher_impl.h" |
6 | 6 |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "components/invalidation/public/invalidation_service.h" | 10 #include "components/invalidation/public/invalidation_service.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 UnregisterInvalidationHandler(); | 77 UnregisterInvalidationHandler(); |
78 } | 78 } |
79 | 79 |
80 void ChildAccountInfoFetcherImpl::FetchIfNotInProgress() { | 80 void ChildAccountInfoFetcherImpl::FetchIfNotInProgress() { |
81 DCHECK(thread_checker_.CalledOnValidThread()); | 81 DCHECK(thread_checker_.CalledOnValidThread()); |
82 if (fetch_in_progress_) | 82 if (fetch_in_progress_) |
83 return; | 83 return; |
84 fetch_in_progress_ = true; | 84 fetch_in_progress_ = true; |
85 OAuth2TokenService::ScopeSet scopes; | 85 OAuth2TokenService::ScopeSet scopes; |
86 scopes.insert(GaiaConstants::kOAuth1LoginScope); | 86 scopes.insert(GaiaConstants::kOAuth1LoginScope); |
87 login_token_request_.reset( | 87 login_token_request_ = |
88 token_service_->StartRequest(account_id_, scopes, this).release()); | 88 token_service_->StartRequest(account_id_, scopes, this); |
89 } | 89 } |
90 | 90 |
91 void ChildAccountInfoFetcherImpl::OnGetTokenSuccess( | 91 void ChildAccountInfoFetcherImpl::OnGetTokenSuccess( |
92 const OAuth2TokenService::Request* request, | 92 const OAuth2TokenService::Request* request, |
93 const std::string& access_token, | 93 const std::string& access_token, |
94 const base::Time& expiration_time) { | 94 const base::Time& expiration_time) { |
95 TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", kFetcherId, this, | 95 TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", kFetcherId, this, |
96 "OnGetTokenSuccess"); | 96 "OnGetTokenSuccess"); |
97 DCHECK_EQ(request, login_token_request_.get()); | 97 DCHECK_EQ(request, login_token_request_.get()); |
98 | 98 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 void ChildAccountInfoFetcherImpl::OnIncomingInvalidation( | 172 void ChildAccountInfoFetcherImpl::OnIncomingInvalidation( |
173 const syncer::ObjectIdInvalidationMap& invalidation_map) { | 173 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
174 FetchIfNotInProgress(); | 174 FetchIfNotInProgress(); |
175 invalidation_map.AcknowledgeAll(); | 175 invalidation_map.AcknowledgeAll(); |
176 } | 176 } |
177 | 177 |
178 std::string ChildAccountInfoFetcherImpl::GetOwnerName() const { | 178 std::string ChildAccountInfoFetcherImpl::GetOwnerName() const { |
179 return std::string(kFetcherId); | 179 return std::string(kFetcherId); |
180 } | 180 } |
OLD | NEW |