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

Side by Side Diff: chrome/browser/drive/gdata_wapi_service.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId Created 7 years, 3 months 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
OLDNEW
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/drive/gdata_wapi_service.h" 5 #include "chrome/browser/drive/gdata_wapi_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 app_list = AppList::CreateFromAccountMetadata(*account_metadata); 124 app_list = AppList::CreateFromAccountMetadata(*account_metadata);
125 } 125 }
126 126
127 callback.Run(error, app_list.Pass()); 127 callback.Run(error, app_list.Pass());
128 } 128 }
129 129
130 } // namespace 130 } // namespace
131 131
132 GDataWapiService::GDataWapiService( 132 GDataWapiService::GDataWapiService(
133 OAuth2TokenService* oauth2_token_service, 133 OAuth2TokenService* oauth2_token_service,
134 const std::string& account_id,
134 net::URLRequestContextGetter* url_request_context_getter, 135 net::URLRequestContextGetter* url_request_context_getter,
135 base::TaskRunner* blocking_task_runner, 136 base::TaskRunner* blocking_task_runner,
136 const GURL& base_url, 137 const GURL& base_url,
137 const GURL& base_download_url, 138 const GURL& base_download_url,
138 const std::string& custom_user_agent) 139 const std::string& custom_user_agent)
139 : oauth2_token_service_(oauth2_token_service), 140 : oauth2_token_service_(oauth2_token_service),
141 account_id_(account_id),
140 url_request_context_getter_(url_request_context_getter), 142 url_request_context_getter_(url_request_context_getter),
141 blocking_task_runner_(blocking_task_runner), 143 blocking_task_runner_(blocking_task_runner),
142 url_generator_(base_url, base_download_url), 144 url_generator_(base_url, base_download_url),
143 custom_user_agent_(custom_user_agent) { 145 custom_user_agent_(custom_user_agent) {
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
145 } 147 }
146 148
147 GDataWapiService::~GDataWapiService() { 149 GDataWapiService::~GDataWapiService() {
148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
149 if (sender_.get()) 151 if (sender_.get())
150 sender_->auth_service()->RemoveObserver(this); 152 sender_->auth_service()->RemoveObserver(this);
151 } 153 }
152 154
153 void GDataWapiService::Initialize() { 155 void GDataWapiService::Initialize() {
154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
155 157
156 std::vector<std::string> scopes; 158 std::vector<std::string> scopes;
157 scopes.push_back(util::kDocsListScope); 159 scopes.push_back(util::kDocsListScope);
158 scopes.push_back(kSpreadsheetsScope); 160 scopes.push_back(kSpreadsheetsScope);
159 scopes.push_back(kUserContentScope); 161 scopes.push_back(kUserContentScope);
160 // Drive App scope is required for even WAPI v3 apps access. 162 // Drive App scope is required for even WAPI v3 apps access.
161 scopes.push_back(util::kDriveAppsScope); 163 scopes.push_back(util::kDriveAppsScope);
162 sender_.reset(new RequestSender( 164 sender_.reset(new RequestSender(
163 new AuthService( 165 new AuthService(oauth2_token_service_,
164 oauth2_token_service_, url_request_context_getter_, scopes), 166 account_id_,
167 url_request_context_getter_,
168 scopes),
165 url_request_context_getter_, 169 url_request_context_getter_,
166 blocking_task_runner_.get(), 170 blocking_task_runner_.get(),
167 custom_user_agent_)); 171 custom_user_agent_));
168 172
169 sender_->auth_service()->AddObserver(this); 173 sender_->auth_service()->AddObserver(this);
170 } 174 }
171 175
172 void GDataWapiService::AddObserver(DriveServiceObserver* observer) { 176 void GDataWapiService::AddObserver(DriveServiceObserver* observer) {
173 observers_.AddObserver(observer); 177 observers_.AddObserver(observer);
174 } 178 }
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 if (CanSendRequest()) { 670 if (CanSendRequest()) {
667 FOR_EACH_OBSERVER( 671 FOR_EACH_OBSERVER(
668 DriveServiceObserver, observers_, OnReadyToSendRequests()); 672 DriveServiceObserver, observers_, OnReadyToSendRequests());
669 } else if (!HasRefreshToken()) { 673 } else if (!HasRefreshToken()) {
670 FOR_EACH_OBSERVER( 674 FOR_EACH_OBSERVER(
671 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); 675 DriveServiceObserver, observers_, OnRefreshTokenInvalid());
672 } 676 }
673 } 677 }
674 678
675 } // namespace drive 679 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698