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 #include "chrome/browser/chromeos/drive/drive_file_error.h" |
10 | 11 |
11 namespace drive { | 12 namespace drive { |
12 | 13 |
13 // Enum representing the type of job. | 14 // Enum representing the type of job. |
14 enum JobType { | 15 enum JobType { |
15 TYPE_GET_ABOUT_RESOURCE, | 16 TYPE_GET_ABOUT_RESOURCE, |
16 TYPE_GET_ACCOUNT_METADATA, | 17 TYPE_GET_ACCOUNT_METADATA, |
17 TYPE_GET_APP_LIST, | 18 TYPE_GET_APP_LIST, |
18 TYPE_GET_ALL_RESOURCE_LIST, | 19 TYPE_GET_ALL_RESOURCE_LIST, |
19 TYPE_GET_RESOURCE_LIST_IN_DIRECTORY, | 20 TYPE_GET_RESOURCE_LIST_IN_DIRECTORY, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 }; | 81 }; |
81 | 82 |
82 // The interface for observing JobListInterface. | 83 // The interface for observing JobListInterface. |
83 // All events are notified in the UI thread. | 84 // All events are notified in the UI thread. |
84 class JobListObserver { | 85 class JobListObserver { |
85 public: | 86 public: |
86 // Called when a new job id added. | 87 // Called when a new job id added. |
87 virtual void OnJobAdded(const JobInfo& job_info) {} | 88 virtual void OnJobAdded(const JobInfo& job_info) {} |
88 | 89 |
89 // Called when a job id finished. | 90 // Called when a job id finished. |
90 virtual void OnJobDone(const JobInfo& job_info) {} | 91 // |error| is DRIVE_FILE_OK when the job successfully finished, and a value |
| 92 // telling the reason of failure when the jobs is failed. |
| 93 virtual void OnJobDone(const JobInfo& job_info, |
| 94 DriveFileError error) {} |
91 | 95 |
92 // Called when a job status is updated. | 96 // Called when a job status is updated. |
93 virtual void OnJobUpdated(const JobInfo& job_info) {} | 97 virtual void OnJobUpdated(const JobInfo& job_info) {} |
94 | 98 |
95 protected: | 99 protected: |
96 virtual ~JobListObserver() {} | 100 virtual ~JobListObserver() {} |
97 }; | 101 }; |
98 | 102 |
99 // The interface to expose the list of issued Drive jobs. | 103 // The interface to expose the list of issued Drive jobs. |
100 class JobListInterface { | 104 class JobListInterface { |
101 public: | 105 public: |
102 virtual ~JobListInterface() {} | 106 virtual ~JobListInterface() {} |
103 | 107 |
104 // Returns the list of jobs currently managed by the scheduler. | 108 // Returns the list of jobs currently managed by the scheduler. |
105 virtual std::vector<JobInfo> GetJobInfoList() = 0; | 109 virtual std::vector<JobInfo> GetJobInfoList() = 0; |
106 | 110 |
107 // Adds an observer. | 111 // Adds an observer. |
108 virtual void AddObserver(JobListObserver* observer) = 0; | 112 virtual void AddObserver(JobListObserver* observer) = 0; |
109 | 113 |
110 // Removes an observer. | 114 // Removes an observer. |
111 virtual void RemoveObserver(JobListObserver* observer) = 0; | 115 virtual void RemoveObserver(JobListObserver* observer) = 0; |
112 }; | 116 }; |
113 | 117 |
114 } // namespace drive | 118 } // namespace drive |
115 | 119 |
116 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ | 120 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_LIST_INTERFACE_H_ |
OLD | NEW |