OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UPDATE_CHECKER_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ |
6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "components/update_client/crx_update_item.h" | 15 #include "components/update_client/component.h" |
16 #include "components/update_client/update_response.h" | 16 #include "components/update_client/update_response.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace update_client { | 19 namespace update_client { |
20 | 20 |
| 21 class Configurator; |
21 class PersistedData; | 22 class PersistedData; |
22 class Configurator; | |
23 | 23 |
24 class UpdateChecker { | 24 class UpdateChecker { |
25 public: | 25 public: |
26 using UpdateCheckCallback = | 26 using UpdateCheckCallback = |
27 base::Callback<void(int error, | 27 base::Callback<void(int error, int retry_after_sec)>; |
28 const UpdateResponse::Results& results, | |
29 int retry_after_sec)>; | |
30 | 28 |
31 using Factory = std::unique_ptr<UpdateChecker> (*)( | 29 using Factory = std::unique_ptr<UpdateChecker> (*)( |
32 const scoped_refptr<Configurator>& config, | 30 const scoped_refptr<Configurator>& config, |
33 PersistedData* persistent); | 31 PersistedData* persistent); |
34 | 32 |
35 virtual ~UpdateChecker() {} | 33 virtual ~UpdateChecker() = default; |
36 | 34 |
37 // Initiates an update check for the |items_to_check|. |additional_attributes| | 35 // Initiates an update check for the components specified by their ids. |
38 // provides a way to customize the <request> element. This value is inserted | 36 // |additional_attributes| provides a way to customize the <request> element. |
39 // as-is, therefore it must be well-formed as an XML attribute string. | 37 // This value is inserted as-is, therefore it must be well-formed as an |
| 38 // XML attribute string. |
| 39 // On completion, the state of |components| is mutated as required by the |
| 40 // server response received. |
40 virtual bool CheckForUpdates( | 41 virtual bool CheckForUpdates( |
41 const IdToCrxUpdateItemMap& items_to_check, | 42 const std::vector<std::string>& ids_to_check, |
| 43 const IdToComponentPtrMap& components, |
42 const std::string& additional_attributes, | 44 const std::string& additional_attributes, |
43 bool enabled_component_updates, | 45 bool enabled_component_updates, |
44 const UpdateCheckCallback& update_check_callback) = 0; | 46 const UpdateCheckCallback& update_check_callback) = 0; |
45 | 47 |
46 static std::unique_ptr<UpdateChecker> Create( | 48 static std::unique_ptr<UpdateChecker> Create( |
47 const scoped_refptr<Configurator>& config, | 49 const scoped_refptr<Configurator>& config, |
48 PersistedData* persistent); | 50 PersistedData* persistent); |
49 | 51 |
50 protected: | 52 protected: |
51 UpdateChecker() {} | 53 UpdateChecker() = default; |
52 | 54 |
53 private: | 55 private: |
54 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); | 56 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); |
55 }; | 57 }; |
56 | 58 |
57 } // namespace update_client | 59 } // namespace update_client |
58 | 60 |
59 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ | 61 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ |
OLD | NEW |