Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / update_client / update_checker.h
blob2f4b86847b60b9ca343215d1ac7a27c284474816
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_
6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "components/update_client/update_response.h"
15 #include "url/gurl.h"
17 class GURL;
19 namespace net {
20 class URLRequestContextGetter;
23 namespace update_client {
25 class Configurator;
26 struct CrxUpdateItem;
28 class UpdateChecker {
29 public:
30 using UpdateCheckCallback =
31 base::Callback<void(const GURL& original_url,
32 int error,
33 const std::string& error_message,
34 const UpdateResponse::Results& results)>;
36 using Factory = scoped_ptr<UpdateChecker>(*)(const Configurator& config);
38 virtual ~UpdateChecker() {}
40 // Initiates an update check for the |items_to_check|. |additional_attributes|
41 // provides a way to customize the <request> element. This value is inserted
42 // as-is, therefore it must be well-formed as an XML attribute string.
43 virtual bool CheckForUpdates(
44 const std::vector<CrxUpdateItem*>& items_to_check,
45 const std::string& additional_attributes,
46 const UpdateCheckCallback& update_check_callback) = 0;
48 static scoped_ptr<UpdateChecker> Create(const Configurator& config);
50 protected:
51 UpdateChecker() {}
53 private:
54 DISALLOW_COPY_AND_ASSIGN(UpdateChecker);
57 } // namespace update_client
59 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CHECKER_H_