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

Side by Side Diff: components/sync_driver/profile_sync_auth_provider.cc

Issue 1440593004: Make operators on scoped_ptr match the ones defined for std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrequals: followupfix-after-rebase Created 5 years, 1 month 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 | « components/search_engines/util.cc ('k') | content/browser/appcache/appcache_update_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sync_driver/profile_sync_auth_provider.h" 5 #include "components/sync_driver/profile_sync_auth_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 request_token_callback_ = callback; 94 request_token_callback_ = callback;
95 callback_task_runner_ = task_runner; 95 callback_task_runner_ = task_runner;
96 access_token_request_ = 96 access_token_request_ =
97 token_service_->StartRequest(account_id_, oauth2_scope_, this); 97 token_service_->StartRequest(account_id_, oauth2_scope_, this);
98 } 98 }
99 99
100 void ProfileSyncAuthProvider::OnGetTokenSuccess( 100 void ProfileSyncAuthProvider::OnGetTokenSuccess(
101 const OAuth2TokenService::Request* request, 101 const OAuth2TokenService::Request* request,
102 const std::string& access_token, 102 const std::string& access_token,
103 const base::Time& expiration_time) { 103 const base::Time& expiration_time) {
104 DCHECK_EQ(access_token_request_, request); 104 DCHECK_EQ(access_token_request_.get(), request);
105 RespondToTokenRequest(GoogleServiceAuthError::AuthErrorNone(), access_token); 105 RespondToTokenRequest(GoogleServiceAuthError::AuthErrorNone(), access_token);
106 } 106 }
107 107
108 void ProfileSyncAuthProvider::OnGetTokenFailure( 108 void ProfileSyncAuthProvider::OnGetTokenFailure(
109 const OAuth2TokenService::Request* request, 109 const OAuth2TokenService::Request* request,
110 const GoogleServiceAuthError& error) { 110 const GoogleServiceAuthError& error) {
111 DCHECK_EQ(access_token_request_, request); 111 DCHECK_EQ(access_token_request_.get(), request);
112 RespondToTokenRequest(error, std::string()); 112 RespondToTokenRequest(error, std::string());
113 } 113 }
114 114
115 void ProfileSyncAuthProvider::RespondToTokenRequest( 115 void ProfileSyncAuthProvider::RespondToTokenRequest(
116 const GoogleServiceAuthError& error, 116 const GoogleServiceAuthError& error,
117 const std::string& token) { 117 const std::string& token) {
118 DCHECK(CalledOnValidThread()); 118 DCHECK(CalledOnValidThread());
119 callback_task_runner_->PostTask( 119 callback_task_runner_->PostTask(
120 FROM_HERE, base::Bind(request_token_callback_, error, token)); 120 FROM_HERE, base::Bind(request_token_callback_, error, token));
121 access_token_request_.reset(); 121 access_token_request_.reset();
122 request_token_callback_.Reset(); 122 request_token_callback_.Reset();
123 callback_task_runner_ = NULL; 123 callback_task_runner_ = NULL;
124 } 124 }
125 125
126 void ProfileSyncAuthProvider::InvalidateAccessToken(const std::string& token) { 126 void ProfileSyncAuthProvider::InvalidateAccessToken(const std::string& token) {
127 DCHECK(CalledOnValidThread()); 127 DCHECK(CalledOnValidThread());
128 token_service_->InvalidateAccessToken(account_id_, oauth2_scope_, token); 128 token_service_->InvalidateAccessToken(account_id_, oauth2_scope_, token);
129 } 129 }
130 130
131 scoped_ptr<syncer::SyncAuthProvider> 131 scoped_ptr<syncer::SyncAuthProvider>
132 ProfileSyncAuthProvider::CreateProviderForSyncThread() { 132 ProfileSyncAuthProvider::CreateProviderForSyncThread() {
133 DCHECK(CalledOnValidThread()); 133 DCHECK(CalledOnValidThread());
134 scoped_ptr<syncer::SyncAuthProvider> auth_provider(new SyncThreadProxy( 134 scoped_ptr<syncer::SyncAuthProvider> auth_provider(new SyncThreadProxy(
135 weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get())); 135 weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get()));
136 return auth_provider.Pass(); 136 return auth_provider.Pass();
137 } 137 }
OLDNEW
« no previous file with comments | « components/search_engines/util.cc ('k') | content/browser/appcache/appcache_update_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698