| 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 Configurator; | 22 class Configurator; |
| 23 struct CrxUpdateItem; | 23 struct CrxUpdateItem; |
| 24 | 24 |
| 25 class UpdateChecker { | 25 class UpdateChecker { |
| 26 public: | 26 public: |
| 27 using UpdateCheckCallback = | 27 using UpdateCheckCallback = |
| 28 base::Callback<void(int error, const UpdateResponse::Results& results)>; | 28 base::Callback<void(int error, |
| 29 const UpdateResponse::Results& results, |
| 30 int retry_after_sec)>; |
| 29 | 31 |
| 30 using Factory = | 32 using Factory = |
| 31 scoped_ptr<UpdateChecker> (*)(const scoped_refptr<Configurator>& config); | 33 scoped_ptr<UpdateChecker> (*)(const scoped_refptr<Configurator>& config); |
| 32 | 34 |
| 33 virtual ~UpdateChecker() {} | 35 virtual ~UpdateChecker() {} |
| 34 | 36 |
| 35 // Initiates an update check for the |items_to_check|. |additional_attributes| | 37 // Initiates an update check for the |items_to_check|. |additional_attributes| |
| 36 // 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 |
| 37 // 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. |
| 38 virtual bool CheckForUpdates( | 40 virtual bool CheckForUpdates( |
| 39 const std::vector<CrxUpdateItem*>& items_to_check, | 41 const std::vector<CrxUpdateItem*>& items_to_check, |
| 40 const std::string& additional_attributes, | 42 const std::string& additional_attributes, |
| 41 const UpdateCheckCallback& update_check_callback) = 0; | 43 const UpdateCheckCallback& update_check_callback) = 0; |
| 42 | 44 |
| 43 static scoped_ptr<UpdateChecker> Create( | 45 static scoped_ptr<UpdateChecker> Create( |
| 44 const scoped_refptr<Configurator>& config); | 46 const scoped_refptr<Configurator>& config); |
| 45 | 47 |
| 46 protected: | 48 protected: |
| 47 UpdateChecker() {} | 49 UpdateChecker() {} |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); | 52 DISALLOW_COPY_AND_ASSIGN(UpdateChecker); |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 } // namespace update_client | 55 } // namespace update_client |
| 54 | 56 |
| 55 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ | 57 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_ |
| OLD | NEW |