| 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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace policy { | 15 namespace policy { |
| 16 | 16 |
| 17 class DataSegment; | 17 class DataSegment; |
| 18 | 18 |
| 19 // UploadJob can be used to upload screenshots and logfiles to the cloud. | 19 // UploadJob can be used to upload screenshots and logfiles to the cloud. |
| 20 // Data is uploaded via a POST request of type "multipart/form-data". The class | 20 // Data is uploaded via a POST request of type "multipart/form-data". The class |
| 21 // relies on OAuth2TokenService to acquire an access token with a sufficient | 21 // relies on OAuth2TokenService to acquire an access token with a sufficient |
| 22 // scope. Data segments can be added to the upload queue using AddDataSegment() | 22 // scope. Data segments can be added to the upload queue using AddDataSegment() |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // each content-disposition has a |name| field, which must be unique within a | 58 // each content-disposition has a |name| field, which must be unique within a |
| 59 // given request. For file uploads the original local file name may be | 59 // given request. For file uploads the original local file name may be |
| 60 // supplied as well as in the |filename| field. If |filename| references an | 60 // supplied as well as in the |filename| field. If |filename| references an |
| 61 // empty string, no |filename| header will be added for this data segment. | 61 // empty string, no |filename| header will be added for this data segment. |
| 62 // This method must not be called on an UploadJob instance which is already | 62 // This method must not be called on an UploadJob instance which is already |
| 63 // uploading. | 63 // uploading. |
| 64 virtual void AddDataSegment( | 64 virtual void AddDataSegment( |
| 65 const std::string& name, | 65 const std::string& name, |
| 66 const std::string& filename, | 66 const std::string& filename, |
| 67 const std::map<std::string, std::string>& header_entries, | 67 const std::map<std::string, std::string>& header_entries, |
| 68 scoped_ptr<std::string> data) = 0; | 68 std::unique_ptr<std::string> data) = 0; |
| 69 | 69 |
| 70 // Initiates the data upload . This method must only be called once. | 70 // Initiates the data upload . This method must only be called once. |
| 71 virtual void Start() = 0; | 71 virtual void Start() = 0; |
| 72 | 72 |
| 73 DISALLOW_ASSIGN(UploadJob); | 73 DISALLOW_ASSIGN(UploadJob); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace policy | 76 } // namespace policy |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_H_ |
| OLD | NEW |