| 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 CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // Unique ID assigned to each job. | 47 // Unique ID assigned to each job. |
| 48 typedef int32 JobID; | 48 typedef int32 JobID; |
| 49 | 49 |
| 50 // Information about a specific job that is visible to other systems. | 50 // Information about a specific job that is visible to other systems. |
| 51 struct JobInfo { | 51 struct JobInfo { |
| 52 explicit JobInfo(JobType in_job_type) | 52 explicit JobInfo(JobType in_job_type) |
| 53 : job_type(in_job_type), | 53 : job_type(in_job_type), |
| 54 job_id(-1), | 54 job_id(-1), |
| 55 state(STATE_NONE), |
| 55 num_completed_bytes(0), | 56 num_completed_bytes(0), |
| 56 num_total_bytes(0), | 57 num_total_bytes(0) { |
| 57 state(STATE_NONE) { | |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Type of the job. | 60 // Type of the job. |
| 61 JobType job_type; | 61 JobType job_type; |
| 62 | 62 |
| 63 // Id of the job, which can be used to query or modify it. | 63 // Id of the job, which can be used to query or modify it. |
| 64 JobID job_id; | 64 JobID job_id; |
| 65 | 65 |
| 66 // Number of bytes completed, if applicable. | 66 // Current state of the operation. |
| 67 JobState state; |
| 68 |
| 69 // The fields below are available only for jobs with job_type: |
| 70 // TYPE_DOWNLOAD_FILE, TYPE_UPLOAD_NEW_FILE, or TYPE_UPLOAD_EXISTING_FILE. |
| 71 |
| 72 // Number of bytes completed. |
| 67 int64 num_completed_bytes; | 73 int64 num_completed_bytes; |
| 68 | 74 |
| 69 // Total bytes of this operation, if applicable. | 75 // Total bytes of this operation. |
| 70 int64 num_total_bytes; | 76 int64 num_total_bytes; |
| 71 | 77 |
| 72 // Drive path of the file that this job acts on. | 78 // Drive path of the file that this job acts on. |
| 73 base::FilePath file_path; | 79 base::FilePath file_path; |
| 74 | |
| 75 // Current state of the operation. | |
| 76 JobState state; | |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 // The interface for observing JobListInterface. | 82 // The interface for observing JobListInterface. |
| 80 // All events are notified in the UI thread. | 83 // All events are notified in the UI thread. |
| 81 class JobListObserver { | 84 class JobListObserver { |
| 82 public: | 85 public: |
| 83 // Called when a new job id added. | 86 // Called when a new job id added. |
| 84 virtual void OnJobAdded(const JobInfo& job_info) {} | 87 virtual void OnJobAdded(const JobInfo& job_info) {} |
| 85 | 88 |
| 86 // Called when a job id finished. | 89 // Called when a job id finished. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 104 // Adds an observer. | 107 // Adds an observer. |
| 105 virtual void AddObserver(JobListObserver* observer) = 0; | 108 virtual void AddObserver(JobListObserver* observer) = 0; |
| 106 | 109 |
| 107 // Removes an observer. | 110 // Removes an observer. |
| 108 virtual void RemoveObserver(JobListObserver* observer) = 0; | 111 virtual void RemoveObserver(JobListObserver* observer) = 0; |
| 109 }; | 112 }; |
| 110 | 113 |
| 111 } // namespace drive | 114 } // namespace drive |
| 112 | 115 |
| 113 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ | 116 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ |
| OLD | NEW |