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

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

Issue 19511002: Change google_api::RequestSender to take an AuthService instead of a Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/drive/gdata_wapi_service.h ('k') | chrome/browser/google_apis/DEPS » ('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 (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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 custom_user_agent_(custom_user_agent) { 141 custom_user_agent_(custom_user_agent) {
142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
143 } 143 }
144 144
145 GDataWapiService::~GDataWapiService() { 145 GDataWapiService::~GDataWapiService() {
146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
147 if (sender_.get()) 147 if (sender_.get())
148 sender_->auth_service()->RemoveObserver(this); 148 sender_->auth_service()->RemoveObserver(this);
149 } 149 }
150 150
151 AuthService* GDataWapiService::auth_service_for_testing() {
152 return sender_->auth_service();
153 }
154
155 void GDataWapiService::Initialize(Profile* profile) { 151 void GDataWapiService::Initialize(Profile* profile) {
156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
157 153
158 std::vector<std::string> scopes; 154 std::vector<std::string> scopes;
159 scopes.push_back(kDocsListScope); 155 scopes.push_back(kDocsListScope);
160 scopes.push_back(kSpreadsheetsScope); 156 scopes.push_back(kSpreadsheetsScope);
161 scopes.push_back(kUserContentScope); 157 scopes.push_back(kUserContentScope);
162 // Drive App scope is required for even WAPI v3 apps access. 158 // Drive App scope is required for even WAPI v3 apps access.
163 scopes.push_back(kDriveAppsScope); 159 scopes.push_back(kDriveAppsScope);
164 sender_.reset(new RequestSender(profile, 160 sender_.reset(new RequestSender(
165 url_request_context_getter_, 161 new AuthService(profile, url_request_context_getter_, scopes),
166 blocking_task_runner_.get(), 162 url_request_context_getter_,
167 scopes, 163 blocking_task_runner_.get(),
168 custom_user_agent_)); 164 custom_user_agent_));
169 sender_->Initialize();
170 165
171 sender_->auth_service()->AddObserver(this); 166 sender_->auth_service()->AddObserver(this);
172 } 167 }
173 168
174 void GDataWapiService::AddObserver(DriveServiceObserver* observer) { 169 void GDataWapiService::AddObserver(DriveServiceObserver* observer) {
175 observers_.AddObserver(observer); 170 observers_.AddObserver(observer);
176 } 171 }
177 172
178 void GDataWapiService::RemoveObserver(DriveServiceObserver* observer) { 173 void GDataWapiService::RemoveObserver(DriveServiceObserver* observer) {
179 observers_.RemoveObserver(observer); 174 observers_.RemoveObserver(observer);
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 if (CanSendRequest()) { 609 if (CanSendRequest()) {
615 FOR_EACH_OBSERVER( 610 FOR_EACH_OBSERVER(
616 DriveServiceObserver, observers_, OnReadyToSendRequests()); 611 DriveServiceObserver, observers_, OnReadyToSendRequests());
617 } else if (!HasRefreshToken()) { 612 } else if (!HasRefreshToken()) {
618 FOR_EACH_OBSERVER( 613 FOR_EACH_OBSERVER(
619 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); 614 DriveServiceObserver, observers_, OnRefreshTokenInvalid());
620 } 615 }
621 } 616 }
622 617
623 } // namespace drive 618 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/drive/gdata_wapi_service.h ('k') | chrome/browser/google_apis/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698