Add Platform Verification Mojo Services.
[chromium-blink-merge.git] / components / update_client / configurator.h
blobc4c763f8feffe2d307449dc6a688916ded9e3860
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_CONFIGURATOR_H_
6 #define COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
14 class GURL;
16 namespace base {
17 class SingleThreadTaskRunner;
18 class SequencedTaskRunner;
19 class Version;
22 namespace net {
23 class URLRequestContextGetter;
26 namespace update_client {
28 class OutOfProcessPatcher;
30 // Controls the component updater behavior.
31 // TODO(sorin): this class will be split soon in two. One class controls
32 // the behavior of the update client, and the other class controls the
33 // behavior of the component updater.
34 class Configurator : public base::RefCountedThreadSafe<Configurator> {
35 public:
36 // Delay in seconds from calling Start() to the first update check.
37 virtual int InitialDelay() const = 0;
39 // Delay in seconds to every subsequent update check. 0 means don't check.
40 // This function is a mutator for testing purposes.
41 virtual int NextCheckDelay() = 0;
43 // Delay in seconds from each task step. Used to smooth out CPU/IO usage.
44 virtual int StepDelay() const = 0;
46 // Delay in seconds between applying updates for different components, if
47 // several updates are available at a given time. This function is a mutator
48 // for testing purposes.
49 virtual int StepDelayMedium() = 0;
51 // Minimum delta time in seconds before checking again the same component.
52 virtual int MinimumReCheckWait() const = 0;
54 // Minimum delta time in seconds before an on-demand check is allowed
55 // for the same component.
56 virtual int OnDemandDelay() const = 0;
58 // The time delay in seconds between applying updates for different
59 // components.
60 virtual int UpdateDelay() const = 0;
62 // The URLs for the update checks. The URLs are tried in order, the first one
63 // that succeeds wins.
64 virtual std::vector<GURL> UpdateUrl() const = 0;
66 // The URLs for pings. Returns an empty vector if and only if pings are
67 // disabled. Similarly, these URLs have a fall back behavior too.
68 virtual std::vector<GURL> PingUrl() const = 0;
70 // Version of the application. Used to compare the component manifests.
71 virtual base::Version GetBrowserVersion() const = 0;
73 // Returns the value we use for the "updaterchannel=" and "prodchannel="
74 // parameters. Possible return values include: "canary", "dev", "beta", and
75 // "stable".
76 virtual std::string GetChannel() const = 0;
78 // Returns the language for the present locale. Possible return values are
79 // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc.
80 virtual std::string GetLang() const = 0;
82 // Returns the OS's long name like "Windows", "Mac OS X", etc.
83 virtual std::string GetOSLongName() const = 0;
85 // Parameters added to each url request. It can be empty if none are needed.
86 // The return string must be safe for insertion as an attribute in an
87 // XML element.
88 virtual std::string ExtraRequestParams() const = 0;
90 // How big each update request can be. Don't go above 2000.
91 virtual size_t UrlSizeLimit() const = 0;
93 // The source of contexts for all the url requests.
94 virtual net::URLRequestContextGetter* RequestContext() const = 0;
96 // Returns a new out of process patcher. May be NULL for implementations
97 // that patch in-process.
98 virtual scoped_refptr<update_client::OutOfProcessPatcher>
99 CreateOutOfProcessPatcher() const = 0;
101 // True means that this client can handle delta updates.
102 virtual bool DeltasEnabled() const = 0;
104 // True means that the background downloader can be used for downloading
105 // non on-demand components.
106 virtual bool UseBackgroundDownloader() const = 0;
108 // Gets a task runner to a blocking pool of threads suitable for worker jobs.
109 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
110 const = 0;
112 // Gets a task runner for worker jobs guaranteed to run on a single thread.
113 // This thread must be capable of IO. On Windows, this thread must be
114 // initialized for use of COM objects.
115 virtual scoped_refptr<base::SingleThreadTaskRunner>
116 GetSingleThreadTaskRunner() const = 0;
118 protected:
119 friend class base::RefCountedThreadSafe<Configurator>;
121 virtual ~Configurator() {}
124 } // namespace update_client
126 #endif // COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_