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 | |
45 std::vector<std::string> GetIds() const override; | 43 std::vector<std::string> GetIds() const override; |
46 | 44 |
47 private: | 45 private: |
48 // Called when the task has completed either because the task has run or | 46 // Called when the Run function associated with this task has completed. |
49 // it has been canceled. | 47 void RunComplete(int error); |
50 void TaskComplete(int error); | |
51 | 48 |
52 base::ThreadChecker thread_checker_; | 49 base::ThreadChecker thread_checker_; |
53 | 50 |
54 UpdateEngine* update_engine_; // Not owned by this class. | 51 UpdateEngine* update_engine_; // Not owned by this class. |
55 | 52 |
56 const bool is_foreground_; | 53 const bool is_foreground_; |
57 const std::vector<std::string> ids_; | 54 const std::vector<std::string> ids_; |
58 const UpdateClient::CrxDataCallback crx_data_callback_; | 55 const UpdateClient::CrxDataCallback crx_data_callback_; |
59 const Callback callback_; | 56 const Callback callback_; |
60 | 57 |
61 DISALLOW_COPY_AND_ASSIGN(TaskUpdate); | 58 DISALLOW_COPY_AND_ASSIGN(TaskUpdate); |
62 }; | 59 }; |
63 | 60 |
64 } // namespace update_client | 61 } // namespace update_client |
65 | 62 |
66 #endif // COMPONENTS_UPDATE_CLIENT_TASK_UPDATE_H_ | 63 #endif // COMPONENTS_UPDATE_CLIENT_TASK_UPDATE_H_ |
OLD | NEW |