| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // and the upload is started by calling Start(). Calls to AddDataSegment() are | 23 // and the upload is started by calling Start(). Calls to AddDataSegment() are |
| 24 // only allowed prior to the first call to Start(). | 24 // only allowed prior to the first call to Start(). |
| 25 // An Upload instance may be destroyed at any point in time, the pending | 25 // An Upload instance may be destroyed at any point in time, the pending |
| 26 // operations are guaranteed to be canceled and the Delegate::OnSuccess() and | 26 // operations are guaranteed to be canceled and the Delegate::OnSuccess() and |
| 27 // Delegate::OnFailure() methods will not be invoked. | 27 // Delegate::OnFailure() methods will not be invoked. |
| 28 class UploadJob { | 28 class UploadJob { |
| 29 public: | 29 public: |
| 30 // If the upload fails, the Delegate's OnFailure() method is invoked with | 30 // If the upload fails, the Delegate's OnFailure() method is invoked with |
| 31 // one of these error codes. | 31 // one of these error codes. |
| 32 enum ErrorCode { | 32 enum ErrorCode { |
| 33 CONTENT_ENCODING_ERROR = 0, // Failed to encode content. | |
| 34 NETWORK_ERROR = 1, // Network failure. | 33 NETWORK_ERROR = 1, // Network failure. |
| 35 AUTHENTICATION_ERROR = 2, // Authentication failure. | 34 AUTHENTICATION_ERROR = 2, // Authentication failure. |
| 36 SERVER_ERROR = 3 // Server returned error or malformed reply. | 35 SERVER_ERROR = 3 // Server returned error or malformed reply. |
| 37 }; | 36 }; |
| 38 | 37 |
| 39 class Delegate { | 38 class Delegate { |
| 40 public: | 39 public: |
| 41 // When the upload finishes successfully, the OnSuccess() method is invoked. | 40 // When the upload finishes successfully, the OnSuccess() method is invoked. |
| 42 virtual void OnSuccess() = 0; | 41 virtual void OnSuccess() = 0; |
| 43 | 42 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 | 69 |
| 71 // Initiates the data upload . This method must only be called once. | 70 // Initiates the data upload . This method must only be called once. |
| 72 virtual void Start() = 0; | 71 virtual void Start() = 0; |
| 73 | 72 |
| 74 DISALLOW_ASSIGN(UploadJob); | 73 DISALLOW_ASSIGN(UploadJob); |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 } // namespace policy | 76 } // namespace policy |
| 78 | 77 |
| 79 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_H_ |
| OLD | NEW |