OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_UPDATE_CLIENT_ACTION_UPDATE_CHECK_H_ | |
6 #define COMPONENTS_UPDATE_CLIENT_ACTION_UPDATE_CHECK_H_ | |
7 | |
8 #include <map> | |
9 #include <memory> | |
10 #include <string> | |
11 #include <vector> | |
12 | |
13 #include "base/macros.h" | |
14 #include "base/threading/thread_checker.h" | |
15 #include "base/version.h" | |
16 #include "components/update_client/action.h" | |
17 #include "components/update_client/crx_update_item.h" | |
18 #include "components/update_client/update_client.h" | |
19 #include "components/update_client/update_engine.h" | |
20 #include "components/update_client/update_response.h" | |
21 #include "url/gurl.h" | |
22 | |
23 namespace update_client { | |
24 | |
25 class UpdateChecker; | |
26 | |
27 // Implements an update check for the CRXs in an update context. | |
28 class ActionUpdateCheck : public Action, private ActionImpl { | |
29 public: | |
30 ActionUpdateCheck(std::unique_ptr<UpdateChecker> update_checker, | |
31 const base::Version& browser_version, | |
32 const std::string& extra_request_parameters); | |
33 | |
34 ~ActionUpdateCheck() override; | |
35 | |
36 void Run(UpdateContext* update_context, Callback callback) override; | |
37 | |
38 private: | |
39 void UpdateCheckComplete(int error, | |
40 const UpdateResponse::Results& results, | |
41 int retry_after_sec); | |
42 void OnUpdateCheckSucceeded(const UpdateResponse::Results& results); | |
43 void OnUpdateCheckFailed(int error); | |
44 | |
45 void HandleUpdateCheckOK(const UpdateResponse::Result& result, | |
46 CrxUpdateItem* crx); | |
47 void HandleUpdateCheckNoupdate(const UpdateResponse::Result& result, | |
48 CrxUpdateItem* crx); | |
49 void HandleUpdateCheckError(const UpdateResponse::Result& result, | |
50 CrxUpdateItem* crx); | |
51 | |
52 std::unique_ptr<UpdateChecker> update_checker_; | |
53 const base::Version browser_version_; | |
54 const std::string extra_request_parameters_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(ActionUpdateCheck); | |
57 }; | |
58 | |
59 } // namespace update_client | |
60 | |
61 #endif // COMPONENTS_UPDATE_CLIENT_ACTION_UPDATE_CHECK_H_ | |
OLD | NEW |