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