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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "components/update_client/update_response.h" | 15 #include "components/update_client/update_response.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 | 19 |
20 namespace update_client { | 20 namespace update_client { |
21 | 21 |
| 22 class ComponentMetadata; |
22 class Configurator; | 23 class Configurator; |
23 struct CrxUpdateItem; | 24 struct CrxUpdateItem; |
24 | 25 |
25 class UpdateChecker { | 26 class UpdateChecker { |
26 public: | 27 public: |
27 using UpdateCheckCallback = | 28 using UpdateCheckCallback = |
28 base::Callback<void(int error, | 29 base::Callback<void(int error, |
29 const UpdateResponse::Results& results, | 30 const UpdateResponse::Results& results, |
30 int retry_after_sec)>; | 31 int retry_after_sec)>; |
31 | 32 |
32 using Factory = | 33 using Factory = scoped_ptr<UpdateChecker> (*)( |
33 scoped_ptr<UpdateChecker> (*)(const scoped_refptr<Configurator>& config); | 34 const scoped_refptr<Configurator>& config, |
| 35 const scoped_refptr<ComponentMetadata>& metadata); |
34 | 36 |
35 virtual ~UpdateChecker() {} | 37 virtual ~UpdateChecker() {} |
36 | 38 |
37 // Initiates an update check for the |items_to_check|. |additional_attributes| | 39 // Initiates an update check for the |items_to_check|. |additional_attributes| |
38 // provides a way to customize the <request> element. This value is inserted | 40 // provides a way to customize the <request> element. This value is inserted |
39 // as-is, therefore it must be well-formed as an XML attribute string. | 41 // as-is, therefore it must be well-formed as an XML attribute string. |
40 virtual bool CheckForUpdates( | 42 virtual bool CheckForUpdates( |
41 const std::vector<CrxUpdateItem*>& items_to_check, | 43 const std::vector<CrxUpdateItem*>& items_to_check, |
42 const std::string& additional_attributes, | 44 const std::string& additional_attributes, |
43 const UpdateCheckCallback& update_check_callback) = 0; | 45 const UpdateCheckCallback& update_check_callback) = 0; |
44 | 46 |
45 static scoped_ptr<UpdateChecker> Create( | 47 static scoped_ptr<UpdateChecker> Create( |
46 const scoped_refptr<Configurator>& config); | 48 const scoped_refptr<Configurator>& config, |
| 49 const scoped_refptr<ComponentMetadata>& metadata); |
47 | 50 |
48 protected: | 51 protected: |
49 UpdateChecker() {} | 52 UpdateChecker() {} |
50 | 53 |
51 private: | 54 private: |
52 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); | 55 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); |
53 }; | 56 }; |
54 | 57 |
55 } // namespace update_client | 58 } // namespace update_client |
56 | 59 |
57 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ | 60 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ |
OLD | NEW |