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 <stddef.h> | 8 #include <stddef.h> |
bartfab (slow)
2016/01/05 14:20:45
Nit: No longer used.
Łukasz Anforowicz
2016/01/05 19:16:49
Done.
| |
9 | 9 |
10 #include <map> | 10 #include <map> |
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/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "chrome/browser/chromeos/policy/upload_job.h" | 17 #include "chrome/browser/chromeos/policy/upload_job.h" |
18 #include "google_apis/gaia/oauth2_token_service.h" | 18 #include "google_apis/gaia/oauth2_token_service.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
29 class UploadJobImpl : public UploadJob, | 29 class UploadJobImpl : public UploadJob, |
30 public OAuth2TokenService::Consumer, | 30 public OAuth2TokenService::Consumer, |
31 public net::URLFetcherDelegate { | 31 public net::URLFetcherDelegate { |
32 public: | 32 public: |
33 // UploadJobImpl uses a MimeBoundaryGenerator to generate strings which | 33 // UploadJobImpl uses a MimeBoundaryGenerator to generate strings which |
34 // mark the boundaries between data segments. | 34 // mark the boundaries between data segments. |
35 class MimeBoundaryGenerator { | 35 class MimeBoundaryGenerator { |
36 public: | 36 public: |
37 virtual ~MimeBoundaryGenerator(); | 37 virtual ~MimeBoundaryGenerator(); |
38 | 38 |
39 virtual std::string GenerateBoundary(size_t length) const = 0; | 39 virtual std::string GenerateBoundary() const = 0; |
40 | 40 |
41 private: | 41 private: |
42 DISALLOW_ASSIGN(MimeBoundaryGenerator); | 42 DISALLOW_ASSIGN(MimeBoundaryGenerator); |
43 }; | 43 }; |
44 | 44 |
45 // An implemenation of the MimeBoundaryGenerator which uses random | 45 // An implemenation of the MimeBoundaryGenerator which uses random |
46 // alpha-numeric characters to construct MIME boundaries. | 46 // alpha-numeric characters to construct MIME boundaries. |
47 class RandomMimeBoundaryGenerator : public MimeBoundaryGenerator { | 47 class RandomMimeBoundaryGenerator : public MimeBoundaryGenerator { |
48 public: | 48 public: |
49 ~RandomMimeBoundaryGenerator() override; | 49 ~RandomMimeBoundaryGenerator() override; |
50 | 50 |
51 std::string GenerateBoundary( | 51 std::string GenerateBoundary() const override; // MimeBoundaryGenerator |
52 size_t length) const override; // MimeBoundaryGenerator | |
53 }; | 52 }; |
54 | 53 |
55 UploadJobImpl(const GURL& upload_url, | 54 UploadJobImpl(const GURL& upload_url, |
56 const std::string& account_id, | 55 const std::string& account_id, |
57 OAuth2TokenService* token_service, | 56 OAuth2TokenService* token_service, |
58 scoped_refptr<net::URLRequestContextGetter> url_context_getter, | 57 scoped_refptr<net::URLRequestContextGetter> url_context_getter, |
59 Delegate* delegate, | 58 Delegate* delegate, |
60 scoped_ptr<MimeBoundaryGenerator> boundary_generator); | 59 scoped_ptr<MimeBoundaryGenerator> boundary_generator); |
61 ~UploadJobImpl() override; | 60 ~UploadJobImpl() override; |
62 | 61 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 | 148 |
150 // The data chunks to be uploaded. | 149 // The data chunks to be uploaded. |
151 ScopedVector<DataSegment> data_segments_; | 150 ScopedVector<DataSegment> data_segments_; |
152 | 151 |
153 DISALLOW_COPY_AND_ASSIGN(UploadJobImpl); | 152 DISALLOW_COPY_AND_ASSIGN(UploadJobImpl); |
154 }; | 153 }; |
155 | 154 |
156 } // namespace policy | 155 } // namespace policy |
157 | 156 |
158 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ | 157 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ |
OLD | NEW |