| 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_GDATA_WAPI_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ |
| 6 #define CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ | 6 #define CHROME_BROWSER_DRIVE_GDATA_WAPI_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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 namespace drive { | 36 namespace drive { |
| 37 | 37 |
| 38 // This class provides documents feed service calls for WAPI (codename for | 38 // This class provides documents feed service calls for WAPI (codename for |
| 39 // DocumentsList API). | 39 // DocumentsList API). |
| 40 // Details of API call are abstracted in each request class and this class | 40 // Details of API call are abstracted in each request class and this class |
| 41 // works as a thin wrapper for the API. | 41 // works as a thin wrapper for the API. |
| 42 class GDataWapiService : public DriveServiceInterface, | 42 class GDataWapiService : public DriveServiceInterface, |
| 43 public google_apis::AuthServiceObserver { | 43 public google_apis::AuthServiceObserver { |
| 44 public: | 44 public: |
| 45 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. | 45 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. |
| 46 // |account_id| identifies account used to obtain OAuth2 access tokens. |
| 46 // |url_request_context_getter| is used to initialize URLFetcher. | 47 // |url_request_context_getter| is used to initialize URLFetcher. |
| 47 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). | 48 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). |
| 48 // |base_url| is used to generate URLs for communicating with the WAPI | 49 // |base_url| is used to generate URLs for communicating with the WAPI |
| 49 // |base_download_url| is used to generate URLs for downloading file with WAPI | 50 // |base_download_url| is used to generate URLs for downloading file with WAPI |
| 50 // |custom_user_agent| is used for the User-Agent header in HTTP | 51 // |custom_user_agent| is used for the User-Agent header in HTTP |
| 51 // requests issued through the service if the value is not empty. | 52 // requests issued through the service if the value is not empty. |
| 52 GDataWapiService(OAuth2TokenService* oauth2_token_service, | 53 GDataWapiService(OAuth2TokenService* oauth2_token_service, |
| 54 const std::string& account_id, |
| 53 net::URLRequestContextGetter* url_request_context_getter, | 55 net::URLRequestContextGetter* url_request_context_getter, |
| 54 base::TaskRunner* blocking_task_runner, | 56 base::TaskRunner* blocking_task_runner, |
| 55 const GURL& base_url, | 57 const GURL& base_url, |
| 56 const GURL& base_download_url, | 58 const GURL& base_download_url, |
| 57 const std::string& custom_user_agent); | 59 const std::string& custom_user_agent); |
| 58 virtual ~GDataWapiService(); | 60 virtual ~GDataWapiService(); |
| 59 | 61 |
| 60 // DriveServiceInterface Overrides | 62 // DriveServiceInterface Overrides |
| 61 virtual void Initialize() OVERRIDE; | 63 virtual void Initialize() OVERRIDE; |
| 62 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; | 64 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 const google_apis::GetResourceListCallback& callback) OVERRIDE; | 184 const google_apis::GetResourceListCallback& callback) OVERRIDE; |
| 183 virtual google_apis::CancelCallback GetRemainingResourceList( | 185 virtual google_apis::CancelCallback GetRemainingResourceList( |
| 184 const GURL& next_link, | 186 const GURL& next_link, |
| 185 const google_apis::GetResourceListCallback& callback) OVERRIDE; | 187 const google_apis::GetResourceListCallback& callback) OVERRIDE; |
| 186 | 188 |
| 187 private: | 189 private: |
| 188 // AuthService::Observer override. | 190 // AuthService::Observer override. |
| 189 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; | 191 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; |
| 190 | 192 |
| 191 OAuth2TokenService* oauth2_token_service_; // Not owned. | 193 OAuth2TokenService* oauth2_token_service_; // Not owned. |
| 194 std::string account_id_; |
| 192 net::URLRequestContextGetter* url_request_context_getter_; // Not owned. | 195 net::URLRequestContextGetter* url_request_context_getter_; // Not owned. |
| 193 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 196 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
| 194 scoped_ptr<google_apis::RequestSender> sender_; | 197 scoped_ptr<google_apis::RequestSender> sender_; |
| 195 ObserverList<DriveServiceObserver> observers_; | 198 ObserverList<DriveServiceObserver> observers_; |
| 196 // Request objects should hold a copy of this, rather than a const | 199 // Request objects should hold a copy of this, rather than a const |
| 197 // reference, as they may outlive this object. | 200 // reference, as they may outlive this object. |
| 198 const google_apis::GDataWapiUrlGenerator url_generator_; | 201 const google_apis::GDataWapiUrlGenerator url_generator_; |
| 199 const std::string custom_user_agent_; | 202 const std::string custom_user_agent_; |
| 200 | 203 |
| 201 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); | 204 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); |
| 202 }; | 205 }; |
| 203 | 206 |
| 204 } // namespace drive | 207 } // namespace drive |
| 205 | 208 |
| 206 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ | 209 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ |
| OLD | NEW |