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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/sequence_checker.h" |
17 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
18 #include "components/drive/service/drive_service_interface.h" | 19 #include "components/drive/service/drive_service_interface.h" |
19 #include "google_apis/drive/auth_service_interface.h" | 20 #include "google_apis/drive/auth_service_interface.h" |
20 #include "google_apis/drive/auth_service_observer.h" | 21 #include "google_apis/drive/auth_service_observer.h" |
21 #include "google_apis/drive/drive_api_url_generator.h" | 22 #include "google_apis/drive/drive_api_url_generator.h" |
22 #include "net/traffic_annotation/network_traffic_annotation.h" | 23 #include "net/traffic_annotation/network_traffic_annotation.h" |
23 | 24 |
24 class GURL; | 25 class GURL; |
25 class OAuth2TokenService; | 26 class OAuth2TokenService; |
26 | 27 |
(...skipping 10 matching lines...) Expand all Loading... |
37 } // namespace drive | 38 } // namespace drive |
38 } // namespace google_apis | 39 } // namespace google_apis |
39 | 40 |
40 namespace net { | 41 namespace net { |
41 class URLRequestContextGetter; | 42 class URLRequestContextGetter; |
42 } // namespace net | 43 } // namespace net |
43 | 44 |
44 namespace drive { | 45 namespace drive { |
45 | 46 |
46 // Builder for batch request returned by |DriveAPIService|. | 47 // Builder for batch request returned by |DriveAPIService|. |
47 class BatchRequestConfigurator : public BatchRequestConfiguratorInterface, | 48 class BatchRequestConfigurator : public BatchRequestConfiguratorInterface { |
48 public base::NonThreadSafe { | |
49 public: | 49 public: |
50 BatchRequestConfigurator( | 50 BatchRequestConfigurator( |
51 const base::WeakPtr<google_apis::drive::BatchUploadRequest>& | 51 const base::WeakPtr<google_apis::drive::BatchUploadRequest>& |
52 batch_request, | 52 batch_request, |
53 base::SequencedTaskRunner* task_runner, | 53 base::SequencedTaskRunner* task_runner, |
54 const google_apis::DriveApiUrlGenerator& url_generator, | 54 const google_apis::DriveApiUrlGenerator& url_generator, |
55 const google_apis::CancelCallback& cancel_callback); | 55 const google_apis::CancelCallback& cancel_callback); |
56 ~BatchRequestConfigurator() override; | 56 ~BatchRequestConfigurator() override; |
57 | 57 |
58 // BatchRequestConfiguratorInterface overrides. | 58 // BatchRequestConfiguratorInterface overrides. |
(...skipping 16 matching lines...) Expand all Loading... |
75 const google_apis::ProgressCallback& progress_callback) override; | 75 const google_apis::ProgressCallback& progress_callback) override; |
76 void Commit() override; | 76 void Commit() override; |
77 | 77 |
78 private: | 78 private: |
79 // Reference to batch request. It turns to null after committing. | 79 // Reference to batch request. It turns to null after committing. |
80 base::WeakPtr<google_apis::drive::BatchUploadRequest> batch_request_; | 80 base::WeakPtr<google_apis::drive::BatchUploadRequest> batch_request_; |
81 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 81 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
82 google_apis::DriveApiUrlGenerator url_generator_; | 82 google_apis::DriveApiUrlGenerator url_generator_; |
83 google_apis::CancelCallback cancel_callback_; | 83 google_apis::CancelCallback cancel_callback_; |
84 | 84 |
| 85 SEQUENCE_CHECKER(sequence_checker_); |
| 86 |
85 DISALLOW_COPY_AND_ASSIGN(BatchRequestConfigurator); | 87 DISALLOW_COPY_AND_ASSIGN(BatchRequestConfigurator); |
86 }; | 88 }; |
87 | 89 |
88 // This class provides Drive request calls using Drive V2 API. | 90 // This class provides Drive request calls using Drive V2 API. |
89 // Details of API call are abstracted in each request class and this class | 91 // Details of API call are abstracted in each request class and this class |
90 // works as a thin wrapper for the API. | 92 // works as a thin wrapper for the API. |
91 class DriveAPIService : public DriveServiceInterface, | 93 class DriveAPIService : public DriveServiceInterface, |
92 public google_apis::AuthServiceObserver { | 94 public google_apis::AuthServiceObserver { |
93 public: | 95 public: |
94 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. | 96 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 google_apis::DriveApiUrlGenerator url_generator_; | 276 google_apis::DriveApiUrlGenerator url_generator_; |
275 const std::string custom_user_agent_; | 277 const std::string custom_user_agent_; |
276 const net::NetworkTrafficAnnotationTag traffic_annotation_; | 278 const net::NetworkTrafficAnnotationTag traffic_annotation_; |
277 | 279 |
278 DISALLOW_COPY_AND_ASSIGN(DriveAPIService); | 280 DISALLOW_COPY_AND_ASSIGN(DriveAPIService); |
279 }; | 281 }; |
280 | 282 |
281 } // namespace drive | 283 } // namespace drive |
282 | 284 |
283 #endif // COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ | 285 #endif // COMPONENTS_DRIVE_SERVICE_DRIVE_API_SERVICE_H_ |
OLD | NEW |