OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_JOB_LIST_H_ | 5 #ifndef COMPONENTS_DRIVE_JOB_LIST_H_ |
6 #define COMPONENTS_DRIVE_JOB_LIST_H_ | 6 #define COMPONENTS_DRIVE_JOB_LIST_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "components/drive/file_errors.h" | 13 #include "components/drive/file_errors.h" |
13 | 14 |
14 namespace drive { | 15 namespace drive { |
15 | 16 |
16 // Enum representing the type of job. | 17 // Enum representing the type of job. |
17 enum JobType { | 18 enum JobType { |
18 TYPE_GET_ABOUT_RESOURCE, | 19 TYPE_GET_ABOUT_RESOURCE, |
19 TYPE_GET_APP_LIST, | 20 TYPE_GET_APP_LIST, |
20 TYPE_GET_ALL_RESOURCE_LIST, | 21 TYPE_GET_ALL_RESOURCE_LIST, |
(...skipping 28 matching lines...) Expand all Loading... |
49 STATE_RUNNING, | 50 STATE_RUNNING, |
50 | 51 |
51 // The job failed, but has been re-added to the queue. | 52 // The job failed, but has been re-added to the queue. |
52 STATE_RETRY, | 53 STATE_RETRY, |
53 }; | 54 }; |
54 | 55 |
55 // Returns the string representation of |state|. | 56 // Returns the string representation of |state|. |
56 std::string JobStateToString(JobState state); | 57 std::string JobStateToString(JobState state); |
57 | 58 |
58 // Unique ID assigned to each job. | 59 // Unique ID assigned to each job. |
59 typedef int32 JobID; | 60 typedef int32_t JobID; |
60 | 61 |
61 // Information about a specific job that is visible to other systems. | 62 // Information about a specific job that is visible to other systems. |
62 struct JobInfo { | 63 struct JobInfo { |
63 explicit JobInfo(JobType job_type); | 64 explicit JobInfo(JobType job_type); |
64 | 65 |
65 // Type of the job. | 66 // Type of the job. |
66 JobType job_type; | 67 JobType job_type; |
67 | 68 |
68 // Id of the job, which can be used to query or modify it. | 69 // Id of the job, which can be used to query or modify it. |
69 JobID job_id; | 70 JobID job_id; |
70 | 71 |
71 // Current state of the operation. | 72 // Current state of the operation. |
72 JobState state; | 73 JobState state; |
73 | 74 |
74 // The fields below are available only for jobs with job_type: | 75 // The fields below are available only for jobs with job_type: |
75 // TYPE_DOWNLOAD_FILE, TYPE_UPLOAD_NEW_FILE, or TYPE_UPLOAD_EXISTING_FILE. | 76 // TYPE_DOWNLOAD_FILE, TYPE_UPLOAD_NEW_FILE, or TYPE_UPLOAD_EXISTING_FILE. |
76 | 77 |
77 // Number of bytes completed. | 78 // Number of bytes completed. |
78 int64 num_completed_bytes; | 79 int64_t num_completed_bytes; |
79 | 80 |
80 // Total bytes of this operation. | 81 // Total bytes of this operation. |
81 int64 num_total_bytes; | 82 int64_t num_total_bytes; |
82 | 83 |
83 // Drive path of the file that this job acts on. | 84 // Drive path of the file that this job acts on. |
84 base::FilePath file_path; | 85 base::FilePath file_path; |
85 | 86 |
86 // Time when the job is started (i.e. the request is sent to the server). | 87 // Time when the job is started (i.e. the request is sent to the server). |
87 base::Time start_time; | 88 base::Time start_time; |
88 | 89 |
89 // Returns the string representation of the job info. | 90 // Returns the string representation of the job info. |
90 std::string ToString() const; | 91 std::string ToString() const; |
91 }; | 92 }; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Cancels the job. | 131 // Cancels the job. |
131 virtual void CancelJob(JobID job_id) = 0; | 132 virtual void CancelJob(JobID job_id) = 0; |
132 | 133 |
133 // Cancels all the jobs. | 134 // Cancels all the jobs. |
134 virtual void CancelAllJobs() = 0; | 135 virtual void CancelAllJobs() = 0; |
135 }; | 136 }; |
136 | 137 |
137 } // namespace drive | 138 } // namespace drive |
138 | 139 |
139 #endif // COMPONENTS_DRIVE_JOB_LIST_H_ | 140 #endif // COMPONENTS_DRIVE_JOB_LIST_H_ |
OLD | NEW |