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 COMPONENTS_UPDATE_CLIENT_TASK_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_TASK_H_ |
6 #define COMPONENTS_UPDATE_CLIENT_TASK_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_TASK_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "components/update_client/update_client.h" | 13 #include "components/update_client/update_client.h" |
14 | 14 |
15 namespace update_client { | 15 namespace update_client { |
16 | 16 |
17 class Task; | 17 class Task; |
18 | 18 |
19 // Defines an abstraction for a unit of work done by the update client. | 19 // Defines an abstraction for a unit of work done by the update client. |
20 // Each invocation of the update client API results in a task being created and | 20 // Each invocation of the update client API results in a task being created and |
21 // run. In most cases, a task corresponds to a set of CRXs, which are updated | 21 // run. In most cases, a task corresponds to a set of CRXs, which are updated |
22 // together. | 22 // together. |
23 class Task { | 23 class Task { |
24 public: | 24 public: |
25 virtual ~Task() {} | 25 virtual ~Task() {} |
26 | 26 |
27 virtual void Run() = 0; | 27 virtual void Run() = 0; |
28 | 28 |
| 29 // Does a best effort attempt to make a task release its resources and stop |
| 30 // soon. It is possible that a running task may complete even if this |
| 31 // method is called. |
| 32 virtual void Cancel() = 0; |
| 33 |
29 // Returns the ids corresponding to the CRXs associated with this update task. | 34 // Returns the ids corresponding to the CRXs associated with this update task. |
30 virtual std::vector<std::string> GetIds() const = 0; | 35 virtual std::vector<std::string> GetIds() const = 0; |
31 }; | 36 }; |
32 | 37 |
33 } // namespace update_client | 38 } // namespace update_client |
34 | 39 |
35 #endif // COMPONENTS_UPDATE_CLIENT_TASK_H_ | 40 #endif // COMPONENTS_UPDATE_CLIENT_TASK_H_ |
OLD | NEW |