OLD | NEW |
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/drive_api_service.h" | 5 #include "chrome/browser/drive/drive_api_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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 sender_->auth_service()->RemoveObserver(this); | 280 sender_->auth_service()->RemoveObserver(this); |
281 } | 281 } |
282 | 282 |
283 void DriveAPIService::Initialize(Profile* profile) { | 283 void DriveAPIService::Initialize(Profile* profile) { |
284 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 284 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
285 profile_ = profile; | 285 profile_ = profile; |
286 | 286 |
287 std::vector<std::string> scopes; | 287 std::vector<std::string> scopes; |
288 scopes.push_back(kDriveScope); | 288 scopes.push_back(kDriveScope); |
289 scopes.push_back(kDriveAppsReadonlyScope); | 289 scopes.push_back(kDriveAppsReadonlyScope); |
290 sender_.reset(new RequestSender(profile, | 290 sender_.reset(new RequestSender( |
291 url_request_context_getter_, | 291 new google_apis::AuthService( |
292 blocking_task_runner_.get(), | 292 profile, url_request_context_getter_, scopes), |
293 scopes, | 293 url_request_context_getter_, |
294 custom_user_agent_)); | 294 blocking_task_runner_.get(), |
295 sender_->Initialize(); | 295 custom_user_agent_)); |
296 | |
297 sender_->auth_service()->AddObserver(this); | 296 sender_->auth_service()->AddObserver(this); |
298 } | 297 } |
299 | 298 |
300 void DriveAPIService::AddObserver(DriveServiceObserver* observer) { | 299 void DriveAPIService::AddObserver(DriveServiceObserver* observer) { |
301 observers_.AddObserver(observer); | 300 observers_.AddObserver(observer); |
302 } | 301 } |
303 | 302 |
304 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { | 303 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { |
305 observers_.RemoveObserver(observer); | 304 observers_.RemoveObserver(observer); |
306 } | 305 } |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 if (CanSendRequest()) { | 768 if (CanSendRequest()) { |
770 FOR_EACH_OBSERVER( | 769 FOR_EACH_OBSERVER( |
771 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 770 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
772 } else if (!HasRefreshToken()) { | 771 } else if (!HasRefreshToken()) { |
773 FOR_EACH_OBSERVER( | 772 FOR_EACH_OBSERVER( |
774 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 773 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
775 } | 774 } |
776 } | 775 } |
777 | 776 |
778 } // namespace drive | 777 } // namespace drive |
OLD | NEW |