| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "chrome/browser/drive/drive_service_interface.h" | 14 #include "chrome/browser/drive/drive_service_interface.h" |
| 15 #include "chrome/browser/google_apis/auth_service_interface.h" | 15 #include "chrome/browser/google_apis/auth_service_interface.h" |
| 16 #include "chrome/browser/google_apis/auth_service_observer.h" | 16 #include "chrome/browser/google_apis/auth_service_observer.h" |
| 17 #include "chrome/browser/google_apis/gdata_wapi_requests.h" | 17 #include "chrome/browser/google_apis/gdata_wapi_requests.h" |
| 18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
| 19 | 19 |
| 20 class GURL; | 20 class GURL; |
| 21 class Profile; | 21 class Profile; |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class FilePath; | 24 class FilePath; |
| 25 class TaskRunner; | 25 class TaskRunner; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace google_apis { | 28 namespace google_apis { |
| 29 class AuthService; | |
| 30 class RequestSender; | 29 class RequestSender; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace net { | 32 namespace net { |
| 34 class URLRequestContextGetter; | 33 class URLRequestContextGetter; |
| 35 } // namespace net | 34 } // namespace net |
| 36 | 35 |
| 37 namespace drive { | 36 namespace drive { |
| 38 | 37 |
| 39 // This class provides documents feed service calls for WAPI (codename for | 38 // This class provides documents feed service calls for WAPI (codename for |
| 40 // DocumentsList API). | 39 // DocumentsList API). |
| 41 // 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 |
| 42 // works as a thin wrapper for the API. | 41 // works as a thin wrapper for the API. |
| 43 class GDataWapiService : public DriveServiceInterface, | 42 class GDataWapiService : public DriveServiceInterface, |
| 44 public google_apis::AuthServiceObserver { | 43 public google_apis::AuthServiceObserver { |
| 45 public: | 44 public: |
| 46 // |url_request_context_getter| is used to initialize URLFetcher. | 45 // |url_request_context_getter| is used to initialize URLFetcher. |
| 47 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). | 46 // |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 | 47 // |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 | 48 // |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 | 49 // |custom_user_agent| is used for the User-Agent header in HTTP |
| 51 // requests issued through the service if the value is not empty. | 50 // requests issued through the service if the value is not empty. |
| 52 GDataWapiService(net::URLRequestContextGetter* url_request_context_getter, | 51 GDataWapiService(net::URLRequestContextGetter* url_request_context_getter, |
| 53 base::TaskRunner* blocking_task_runner, | 52 base::TaskRunner* blocking_task_runner, |
| 54 const GURL& base_url, | 53 const GURL& base_url, |
| 55 const GURL& base_download_url, | 54 const GURL& base_download_url, |
| 56 const std::string& custom_user_agent); | 55 const std::string& custom_user_agent); |
| 57 virtual ~GDataWapiService(); | 56 virtual ~GDataWapiService(); |
| 58 | 57 |
| 59 google_apis::AuthService* auth_service_for_testing(); | |
| 60 | |
| 61 // DriveServiceInterface Overrides | 58 // DriveServiceInterface Overrides |
| 62 virtual void Initialize(Profile* profile) OVERRIDE; | 59 virtual void Initialize(Profile* profile) OVERRIDE; |
| 63 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; | 60 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; |
| 64 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; | 61 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; |
| 65 virtual bool CanSendRequest() const OVERRIDE; | 62 virtual bool CanSendRequest() const OVERRIDE; |
| 66 virtual std::string CanonicalizeResourceId( | 63 virtual std::string CanonicalizeResourceId( |
| 67 const std::string& resource_id) const OVERRIDE; | 64 const std::string& resource_id) const OVERRIDE; |
| 68 virtual bool HasAccessToken() const OVERRIDE; | 65 virtual bool HasAccessToken() const OVERRIDE; |
| 69 virtual void RequestAccessToken( | 66 virtual void RequestAccessToken( |
| 70 const google_apis::AuthStatusCallback& callback) OVERRIDE; | 67 const google_apis::AuthStatusCallback& callback) OVERRIDE; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // reference, as they may outlive this object. | 176 // reference, as they may outlive this object. |
| 180 const google_apis::GDataWapiUrlGenerator url_generator_; | 177 const google_apis::GDataWapiUrlGenerator url_generator_; |
| 181 const std::string custom_user_agent_; | 178 const std::string custom_user_agent_; |
| 182 | 179 |
| 183 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); | 180 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); |
| 184 }; | 181 }; |
| 185 | 182 |
| 186 } // namespace drive | 183 } // namespace drive |
| 187 | 184 |
| 188 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ | 185 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ |
| OLD | NEW |