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_UPDATE_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_TASK_UPDATE_H_ |
6 #define COMPONENTS_UPDATE_CLIENT_TASK_UPDATE_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_TASK_UPDATE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 22 matching lines...) Expand all Loading... |
33 // this task when the task is done. | 33 // this task when the task is done. |
34 TaskUpdate(UpdateEngine* update_engine, | 34 TaskUpdate(UpdateEngine* update_engine, |
35 bool is_foreground, | 35 bool is_foreground, |
36 const std::vector<std::string>& ids, | 36 const std::vector<std::string>& ids, |
37 const UpdateClient::CrxDataCallback& crx_data_callback, | 37 const UpdateClient::CrxDataCallback& crx_data_callback, |
38 const Callback& callback); | 38 const Callback& callback); |
39 ~TaskUpdate() override; | 39 ~TaskUpdate() override; |
40 | 40 |
41 void Run() override; | 41 void Run() override; |
42 | 42 |
| 43 void Cancel() override; |
| 44 |
43 std::vector<std::string> GetIds() const override; | 45 std::vector<std::string> GetIds() const override; |
44 | 46 |
45 private: | 47 private: |
46 // Called when the Run function associated with this task has completed. | 48 // Called when the task has completed either because the task has run or |
47 void RunComplete(int error); | 49 // it has been canceled. |
| 50 void TaskComplete(int error); |
48 | 51 |
49 base::ThreadChecker thread_checker_; | 52 base::ThreadChecker thread_checker_; |
50 | 53 |
51 UpdateEngine* update_engine_; // Not owned by this class. | 54 UpdateEngine* update_engine_; // Not owned by this class. |
52 | 55 |
53 const bool is_foreground_; | 56 const bool is_foreground_; |
54 const std::vector<std::string> ids_; | 57 const std::vector<std::string> ids_; |
55 const UpdateClient::CrxDataCallback crx_data_callback_; | 58 const UpdateClient::CrxDataCallback crx_data_callback_; |
56 const Callback callback_; | 59 const Callback callback_; |
57 | 60 |
58 DISALLOW_COPY_AND_ASSIGN(TaskUpdate); | 61 DISALLOW_COPY_AND_ASSIGN(TaskUpdate); |
59 }; | 62 }; |
60 | 63 |
61 } // namespace update_client | 64 } // namespace update_client |
62 | 65 |
63 #endif // COMPONENTS_UPDATE_CLIENT_TASK_UPDATE_H_ | 66 #endif // COMPONENTS_UPDATE_CLIENT_TASK_UPDATE_H_ |
OLD | NEW |