| 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 COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ | 5 #ifndef COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ |
| 6 #define COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ | 6 #define COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // This class provides Drive request calls using Drive V2 API. | 87 // This class provides Drive request calls using Drive V2 API. |
| 88 // Details of API call are abstracted in each request class and this class | 88 // Details of API call are abstracted in each request class and this class |
| 89 // works as a thin wrapper for the API. | 89 // works as a thin wrapper for the API. |
| 90 class DriveAPIService : public DriveServiceInterface, | 90 class DriveAPIService : public DriveServiceInterface, |
| 91 public google_apis::AuthServiceObserver { | 91 public google_apis::AuthServiceObserver { |
| 92 public: | 92 public: |
| 93 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. | 93 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. |
| 94 // |url_request_context_getter| is used to initialize URLFetcher. | 94 // |url_request_context_getter| is used to initialize URLFetcher. |
| 95 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). | 95 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). |
| 96 // |base_url| is used to generate URLs for communication with the drive API. | 96 // |base_url| is used to generate URLs for communication with the drive API. |
| 97 // |base_download_url| is used to generate URLs for downloading file from the | |
| 98 // drive API. | |
| 99 // |base_thumbnail_url| is used to generate URLs for downloading thumbnail | 97 // |base_thumbnail_url| is used to generate URLs for downloading thumbnail |
| 100 // from image server. | 98 // from image server. |
| 101 // |custom_user_agent| will be used for the User-Agent header in HTTP | 99 // |custom_user_agent| will be used for the User-Agent header in HTTP |
| 102 // requests issues through the service if the value is not empty. | 100 // requests issues through the service if the value is not empty. |
| 103 DriveAPIService( | 101 DriveAPIService( |
| 104 OAuth2TokenService* oauth2_token_service, | 102 OAuth2TokenService* oauth2_token_service, |
| 105 net::URLRequestContextGetter* url_request_context_getter, | 103 net::URLRequestContextGetter* url_request_context_getter, |
| 106 base::SequencedTaskRunner* blocking_task_runner, | 104 base::SequencedTaskRunner* blocking_task_runner, |
| 107 const GURL& base_url, | 105 const GURL& base_url, |
| 108 const GURL& base_download_url, | |
| 109 const GURL& base_thumbnail_url, | 106 const GURL& base_thumbnail_url, |
| 110 const std::string& custom_user_agent); | 107 const std::string& custom_user_agent); |
| 111 ~DriveAPIService() override; | 108 ~DriveAPIService() override; |
| 112 | 109 |
| 113 // DriveServiceInterface Overrides | 110 // DriveServiceInterface Overrides |
| 114 void Initialize(const std::string& account_id) override; | 111 void Initialize(const std::string& account_id) override; |
| 115 void AddObserver(DriveServiceObserver* observer) override; | 112 void AddObserver(DriveServiceObserver* observer) override; |
| 116 void RemoveObserver(DriveServiceObserver* observer) override; | 113 void RemoveObserver(DriveServiceObserver* observer) override; |
| 117 bool CanSendRequest() const override; | 114 bool CanSendRequest() const override; |
| 118 bool HasAccessToken() const override; | 115 bool HasAccessToken() const override; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 base::ObserverList<DriveServiceObserver> observers_; | 265 base::ObserverList<DriveServiceObserver> observers_; |
| 269 google_apis::DriveApiUrlGenerator url_generator_; | 266 google_apis::DriveApiUrlGenerator url_generator_; |
| 270 const std::string custom_user_agent_; | 267 const std::string custom_user_agent_; |
| 271 | 268 |
| 272 DISALLOW_COPY_AND_ASSIGN(DriveAPIService); | 269 DISALLOW_COPY_AND_ASSIGN(DriveAPIService); |
| 273 }; | 270 }; |
| 274 | 271 |
| 275 } // namespace drive | 272 } // namespace drive |
| 276 | 273 |
| 277 #endif // COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ | 274 #endif // COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ |
| OLD | NEW |