OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 class UploadJobImpl : public UploadJob, | 28 class UploadJobImpl : public UploadJob, |
29 public OAuth2TokenService::Consumer, | 29 public OAuth2TokenService::Consumer, |
30 public net::URLFetcherDelegate { | 30 public net::URLFetcherDelegate { |
31 public: | 31 public: |
32 // UploadJobImpl uses a MimeBoundaryGenerator to generate strings which | 32 // UploadJobImpl uses a MimeBoundaryGenerator to generate strings which |
33 // mark the boundaries between data segments. | 33 // mark the boundaries between data segments. |
34 class MimeBoundaryGenerator { | 34 class MimeBoundaryGenerator { |
35 public: | 35 public: |
36 virtual ~MimeBoundaryGenerator(); | 36 virtual ~MimeBoundaryGenerator(); |
37 | 37 |
38 virtual std::string GenerateBoundary(size_t length) const = 0; | 38 virtual std::string GenerateBoundary() const = 0; |
39 | 39 |
40 private: | 40 private: |
41 DISALLOW_ASSIGN(MimeBoundaryGenerator); | 41 DISALLOW_ASSIGN(MimeBoundaryGenerator); |
42 }; | 42 }; |
43 | 43 |
44 // An implemenation of the MimeBoundaryGenerator which uses random | 44 // An implemenation of the MimeBoundaryGenerator which uses random |
45 // alpha-numeric characters to construct MIME boundaries. | 45 // alpha-numeric characters to construct MIME boundaries. |
46 class RandomMimeBoundaryGenerator : public MimeBoundaryGenerator { | 46 class RandomMimeBoundaryGenerator : public MimeBoundaryGenerator { |
47 public: | 47 public: |
48 ~RandomMimeBoundaryGenerator() override; | 48 ~RandomMimeBoundaryGenerator() override; |
49 | 49 |
50 std::string GenerateBoundary( | 50 std::string GenerateBoundary() const override; // MimeBoundaryGenerator |
51 size_t length) const override; // MimeBoundaryGenerator | |
52 }; | 51 }; |
53 | 52 |
54 UploadJobImpl(const GURL& upload_url, | 53 UploadJobImpl(const GURL& upload_url, |
55 const std::string& account_id, | 54 const std::string& account_id, |
56 OAuth2TokenService* token_service, | 55 OAuth2TokenService* token_service, |
57 scoped_refptr<net::URLRequestContextGetter> url_context_getter, | 56 scoped_refptr<net::URLRequestContextGetter> url_context_getter, |
58 Delegate* delegate, | 57 Delegate* delegate, |
59 scoped_ptr<MimeBoundaryGenerator> boundary_generator); | 58 scoped_ptr<MimeBoundaryGenerator> boundary_generator); |
60 ~UploadJobImpl() override; | 59 ~UploadJobImpl() override; |
61 | 60 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 147 |
149 // The data chunks to be uploaded. | 148 // The data chunks to be uploaded. |
150 ScopedVector<DataSegment> data_segments_; | 149 ScopedVector<DataSegment> data_segments_; |
151 | 150 |
152 DISALLOW_COPY_AND_ASSIGN(UploadJobImpl); | 151 DISALLOW_COPY_AND_ASSIGN(UploadJobImpl); |
153 }; | 152 }; |
154 | 153 |
155 } // namespace policy | 154 } // namespace policy |
156 | 155 |
157 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ | 156 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ |
OLD | NEW |