| 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 #ifndef CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ |
| 6 #define CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ | 6 #define CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "chrome/browser/drive/drive_service_interface.h" | 13 #include "chrome/browser/drive/drive_service_interface.h" |
| 14 #include "chrome/browser/google_apis/auth_service_interface.h" | 14 #include "chrome/browser/google_apis/auth_service_interface.h" |
| 15 #include "chrome/browser/google_apis/auth_service_observer.h" | 15 #include "chrome/browser/google_apis/auth_service_observer.h" |
| 16 #include "chrome/browser/google_apis/drive_api_url_generator.h" | 16 #include "chrome/browser/google_apis/drive_api_url_generator.h" |
| 17 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 17 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 class OAuth2TokenService; | 20 class OAuth2TokenService; |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class FilePath; | 23 class FilePath; |
| 24 class TaskRunner; | 24 class SequencedTaskRunner; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace google_apis { | 27 namespace google_apis { |
| 28 class RequestSender; | 28 class RequestSender; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace net { | 31 namespace net { |
| 32 class URLRequestContextGetter; | 32 class URLRequestContextGetter; |
| 33 } // namespace net | 33 } // namespace net |
| 34 | 34 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 47 // |base_download_url| is used to generate URLs for downloading file from the | 47 // |base_download_url| is used to generate URLs for downloading file from the |
| 48 // drive API. | 48 // drive API. |
| 49 // |wapi_base_url| is used to generate URLs for shared_url. Unfortunately, | 49 // |wapi_base_url| is used to generate URLs for shared_url. Unfortunately, |
| 50 // the share_url is not yet supported on Drive API v2, so as a fallback, | 50 // the share_url is not yet supported on Drive API v2, so as a fallback, |
| 51 // we use GData WAPI. | 51 // we use GData WAPI. |
| 52 // |custom_user_agent| will be used for the User-Agent header in HTTP | 52 // |custom_user_agent| will be used for the User-Agent header in HTTP |
| 53 // requests issues through the service if the value is not empty. | 53 // requests issues through the service if the value is not empty. |
| 54 DriveAPIService( | 54 DriveAPIService( |
| 55 OAuth2TokenService* oauth2_token_service, | 55 OAuth2TokenService* oauth2_token_service, |
| 56 net::URLRequestContextGetter* url_request_context_getter, | 56 net::URLRequestContextGetter* url_request_context_getter, |
| 57 base::TaskRunner* blocking_task_runner, | 57 base::SequencedTaskRunner* blocking_task_runner, |
| 58 const GURL& base_url, | 58 const GURL& base_url, |
| 59 const GURL& base_download_url, | 59 const GURL& base_download_url, |
| 60 const GURL& wapi_base_url, | 60 const GURL& wapi_base_url, |
| 61 const std::string& custom_user_agent); | 61 const std::string& custom_user_agent); |
| 62 virtual ~DriveAPIService(); | 62 virtual ~DriveAPIService(); |
| 63 | 63 |
| 64 // DriveServiceInterface Overrides | 64 // DriveServiceInterface Overrides |
| 65 virtual void Initialize(const std::string& account_id) OVERRIDE; | 65 virtual void Initialize(const std::string& account_id) OVERRIDE; |
| 66 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; | 66 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; |
| 67 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; | 67 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 virtual google_apis::CancelCallback GetRemainingResourceList( | 188 virtual google_apis::CancelCallback GetRemainingResourceList( |
| 189 const GURL& next_link, | 189 const GURL& next_link, |
| 190 const google_apis::GetResourceListCallback& callback) OVERRIDE; | 190 const google_apis::GetResourceListCallback& callback) OVERRIDE; |
| 191 | 191 |
| 192 private: | 192 private: |
| 193 // AuthServiceObserver override. | 193 // AuthServiceObserver override. |
| 194 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; | 194 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; |
| 195 | 195 |
| 196 OAuth2TokenService* oauth2_token_service_; | 196 OAuth2TokenService* oauth2_token_service_; |
| 197 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 197 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
| 198 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 198 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 199 scoped_ptr<google_apis::RequestSender> sender_; | 199 scoped_ptr<google_apis::RequestSender> sender_; |
| 200 ObserverList<DriveServiceObserver> observers_; | 200 ObserverList<DriveServiceObserver> observers_; |
| 201 google_apis::DriveApiUrlGenerator url_generator_; | 201 google_apis::DriveApiUrlGenerator url_generator_; |
| 202 google_apis::GDataWapiUrlGenerator wapi_url_generator_; | 202 google_apis::GDataWapiUrlGenerator wapi_url_generator_; |
| 203 const std::string custom_user_agent_; | 203 const std::string custom_user_agent_; |
| 204 | 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(DriveAPIService); | 205 DISALLOW_COPY_AND_ASSIGN(DriveAPIService); |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 } // namespace drive | 208 } // namespace drive |
| 209 | 209 |
| 210 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ | 210 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ |
| OLD | NEW |