| 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/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "chrome/browser/drive/drive_api_util.h" | 12 #include "chrome/browser/drive/drive_api_util.h" |
| 13 #include "google_apis/drive/auth_service.h" | 13 #include "google_apis/drive/auth_service.h" |
| 14 #include "google_apis/drive/drive_api_parser.h" | 14 #include "google_apis/drive/drive_api_parser.h" |
| 15 #include "google_apis/drive/drive_api_requests.h" | 15 #include "google_apis/drive/drive_api_requests.h" |
| 16 #include "google_apis/drive/gdata_errorcode.h" | |
| 17 #include "google_apis/drive/request_sender.h" | 16 #include "google_apis/drive/request_sender.h" |
| 18 #include "google_apis/google_api_keys.h" | 17 #include "google_apis/google_api_keys.h" |
| 19 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 20 | 19 |
| 21 using google_apis::AboutResourceCallback; | 20 using google_apis::AboutResourceCallback; |
| 22 using google_apis::AppList; | 21 using google_apis::AppList; |
| 23 using google_apis::AppListCallback; | 22 using google_apis::AppListCallback; |
| 24 using google_apis::AuthStatusCallback; | 23 using google_apis::AuthStatusCallback; |
| 25 using google_apis::AuthorizeAppCallback; | 24 using google_apis::AuthorizeAppCallback; |
| 26 using google_apis::CancelCallback; | 25 using google_apis::CancelCallback; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 const char kDriveApiRootDirectoryResourceId[] = "root"; | 158 const char kDriveApiRootDirectoryResourceId[] = "root"; |
| 160 | 159 |
| 161 } // namespace | 160 } // namespace |
| 162 | 161 |
| 163 DriveAPIService::DriveAPIService( | 162 DriveAPIService::DriveAPIService( |
| 164 OAuth2TokenService* oauth2_token_service, | 163 OAuth2TokenService* oauth2_token_service, |
| 165 net::URLRequestContextGetter* url_request_context_getter, | 164 net::URLRequestContextGetter* url_request_context_getter, |
| 166 base::SequencedTaskRunner* blocking_task_runner, | 165 base::SequencedTaskRunner* blocking_task_runner, |
| 167 const GURL& base_url, | 166 const GURL& base_url, |
| 168 const GURL& base_download_url, | 167 const GURL& base_download_url, |
| 169 const GURL& wapi_base_url, | |
| 170 const std::string& custom_user_agent) | 168 const std::string& custom_user_agent) |
| 171 : oauth2_token_service_(oauth2_token_service), | 169 : oauth2_token_service_(oauth2_token_service), |
| 172 url_request_context_getter_(url_request_context_getter), | 170 url_request_context_getter_(url_request_context_getter), |
| 173 blocking_task_runner_(blocking_task_runner), | 171 blocking_task_runner_(blocking_task_runner), |
| 174 url_generator_(base_url, base_download_url), | 172 url_generator_(base_url, base_download_url), |
| 175 wapi_url_generator_(wapi_base_url), | |
| 176 custom_user_agent_(custom_user_agent) { | 173 custom_user_agent_(custom_user_agent) { |
| 177 } | 174 } |
| 178 | 175 |
| 179 DriveAPIService::~DriveAPIService() { | 176 DriveAPIService::~DriveAPIService() { |
| 180 DCHECK(thread_checker_.CalledOnValidThread()); | 177 DCHECK(thread_checker_.CalledOnValidThread()); |
| 181 if (sender_.get()) | 178 if (sender_.get()) |
| 182 sender_->auth_service()->RemoveObserver(this); | 179 sender_->auth_service()->RemoveObserver(this); |
| 183 } | 180 } |
| 184 | 181 |
| 185 void DriveAPIService::Initialize(const std::string& account_id) { | 182 void DriveAPIService::Initialize(const std::string& account_id) { |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 if (CanSendRequest()) { | 768 if (CanSendRequest()) { |
| 772 FOR_EACH_OBSERVER( | 769 FOR_EACH_OBSERVER( |
| 773 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 770 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
| 774 } else if (!HasRefreshToken()) { | 771 } else if (!HasRefreshToken()) { |
| 775 FOR_EACH_OBSERVER( | 772 FOR_EACH_OBSERVER( |
| 776 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 773 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
| 777 } | 774 } |
| 778 } | 775 } |
| 779 | 776 |
| 780 } // namespace drive | 777 } // namespace drive |
| OLD | NEW |