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/component.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 Configurator; |
22 class PersistedData; | |
23 | 22 |
24 class UpdateChecker { | 23 class UpdateChecker { |
25 public: | 24 public: |
26 using UpdateCheckCallback = | 25 using UpdateCheckCallback = |
27 base::Callback<void(int error, int retry_after_sec)>; | 26 base::Callback<void(int error, int retry_after_sec)>; |
28 | 27 |
29 using Factory = std::unique_ptr<UpdateChecker> (*)( | 28 using Factory = std::unique_ptr<UpdateChecker> (*)( |
30 const scoped_refptr<Configurator>& config, | 29 const scoped_refptr<Configurator>& config); |
31 PersistedData* persistent); | |
32 | 30 |
33 virtual ~UpdateChecker() = default; | 31 virtual ~UpdateChecker() = default; |
34 | 32 |
35 // Initiates an update check for the components specified by their ids. | 33 // Initiates an update check for the components specified by their ids. |
36 // |additional_attributes| provides a way to customize the <request> element. | 34 // |additional_attributes| provides a way to customize the <request> element. |
37 // This value is inserted as-is, therefore it must be well-formed as an | 35 // This value is inserted as-is, therefore it must be well-formed as an |
38 // XML attribute string. | 36 // XML attribute string. |
39 // On completion, the state of |components| is mutated as required by the | 37 // On completion, the state of |components| is mutated as required by the |
40 // server response received. | 38 // server response received. |
41 virtual bool CheckForUpdates( | 39 virtual bool CheckForUpdates( |
42 const std::vector<std::string>& ids_to_check, | 40 const std::vector<std::string>& ids_to_check, |
43 const IdToComponentPtrMap& components, | 41 const IdToComponentPtrMap& components, |
44 const std::string& additional_attributes, | 42 const std::string& additional_attributes, |
45 bool enabled_component_updates, | 43 bool enabled_component_updates, |
46 const UpdateCheckCallback& update_check_callback) = 0; | 44 const UpdateCheckCallback& update_check_callback) = 0; |
47 | 45 |
48 static std::unique_ptr<UpdateChecker> Create( | 46 static std::unique_ptr<UpdateChecker> Create( |
49 const scoped_refptr<Configurator>& config, | 47 const scoped_refptr<Configurator>& config); |
50 PersistedData* persistent); | |
51 | 48 |
52 protected: | 49 protected: |
53 UpdateChecker() = default; | 50 UpdateChecker() = default; |
54 | 51 |
55 private: | 52 private: |
56 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); | 53 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); |
57 }; | 54 }; |
58 | 55 |
59 } // namespace update_client | 56 } // namespace update_client |
60 | 57 |
61 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ | 58 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ |
OLD | NEW |