| 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" |
| 11 #include "base/sequenced_task_runner.h" |
| 11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 12 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "chrome/browser/drive/drive_api_util.h" | 15 #include "chrome/browser/drive/drive_api_util.h" |
| 15 #include "chrome/browser/google_apis/auth_service.h" | 16 #include "chrome/browser/google_apis/auth_service.h" |
| 16 #include "chrome/browser/google_apis/drive_api_parser.h" | 17 #include "chrome/browser/google_apis/drive_api_parser.h" |
| 17 #include "chrome/browser/google_apis/drive_api_requests.h" | 18 #include "chrome/browser/google_apis/drive_api_requests.h" |
| 18 #include "chrome/browser/google_apis/gdata_errorcode.h" | 19 #include "chrome/browser/google_apis/gdata_errorcode.h" |
| 19 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | 20 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
| 20 #include "chrome/browser/google_apis/gdata_wapi_requests.h" | 21 #include "chrome/browser/google_apis/gdata_wapi_requests.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 276 |
| 276 // The resource ID for the root directory for Drive API is defined in the spec: | 277 // The resource ID for the root directory for Drive API is defined in the spec: |
| 277 // https://developers.google.com/drive/folder | 278 // https://developers.google.com/drive/folder |
| 278 const char kDriveApiRootDirectoryResourceId[] = "root"; | 279 const char kDriveApiRootDirectoryResourceId[] = "root"; |
| 279 | 280 |
| 280 } // namespace | 281 } // namespace |
| 281 | 282 |
| 282 DriveAPIService::DriveAPIService( | 283 DriveAPIService::DriveAPIService( |
| 283 OAuth2TokenService* oauth2_token_service, | 284 OAuth2TokenService* oauth2_token_service, |
| 284 net::URLRequestContextGetter* url_request_context_getter, | 285 net::URLRequestContextGetter* url_request_context_getter, |
| 285 base::TaskRunner* blocking_task_runner, | 286 base::SequencedTaskRunner* blocking_task_runner, |
| 286 const GURL& base_url, | 287 const GURL& base_url, |
| 287 const GURL& base_download_url, | 288 const GURL& base_download_url, |
| 288 const GURL& wapi_base_url, | 289 const GURL& wapi_base_url, |
| 289 const std::string& custom_user_agent) | 290 const std::string& custom_user_agent) |
| 290 : oauth2_token_service_(oauth2_token_service), | 291 : oauth2_token_service_(oauth2_token_service), |
| 291 url_request_context_getter_(url_request_context_getter), | 292 url_request_context_getter_(url_request_context_getter), |
| 292 blocking_task_runner_(blocking_task_runner), | 293 blocking_task_runner_(blocking_task_runner), |
| 293 url_generator_(base_url, base_download_url), | 294 url_generator_(base_url, base_download_url), |
| 294 wapi_url_generator_(wapi_base_url, base_download_url), | 295 wapi_url_generator_(wapi_base_url, base_download_url), |
| 295 custom_user_agent_(custom_user_agent) { | 296 custom_user_agent_(custom_user_agent) { |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 if (CanSendRequest()) { | 885 if (CanSendRequest()) { |
| 885 FOR_EACH_OBSERVER( | 886 FOR_EACH_OBSERVER( |
| 886 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 887 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
| 887 } else if (!HasRefreshToken()) { | 888 } else if (!HasRefreshToken()) { |
| 888 FOR_EACH_OBSERVER( | 889 FOR_EACH_OBSERVER( |
| 889 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 890 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
| 890 } | 891 } |
| 891 } | 892 } |
| 892 | 893 |
| 893 } // namespace drive | 894 } // namespace drive |
| OLD | NEW |