Fix "Googlers" typo.
[chromium-blink-merge.git] / components / update_client / configurator.h
blob3cd3b674d4ea7bbe699d732be6df4df27929da61
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 virtual int NextCheckDelay() const = 0;
42 // Delay in seconds from each task step. Used to smooth out CPU/IO usage.
43 virtual int StepDelay() const = 0;
45 // Minimum delta time in seconds before an on-demand check is allowed
46 // for the same component.
47 virtual int OnDemandDelay() const = 0;
49 // The time delay in seconds between applying updates for different
50 // components.
51 virtual int UpdateDelay() const = 0;
53 // The URLs for the update checks. The URLs are tried in order, the first one
54 // that succeeds wins.
55 virtual std::vector<GURL> UpdateUrl() const = 0;
57 // The URLs for pings. Returns an empty vector if and only if pings are
58 // disabled. Similarly, these URLs have a fall back behavior too.
59 virtual std::vector<GURL> PingUrl() const = 0;
61 // Version of the application. Used to compare the component manifests.
62 virtual base::Version GetBrowserVersion() const = 0;
64 // Returns the value we use for the "updaterchannel=" and "prodchannel="
65 // parameters. Possible return values include: "canary", "dev", "beta", and
66 // "stable".
67 virtual std::string GetChannel() const = 0;
69 // Returns the language for the present locale. Possible return values are
70 // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc.
71 virtual std::string GetLang() const = 0;
73 // Returns the OS's long name like "Windows", "Mac OS X", etc.
74 virtual std::string GetOSLongName() const = 0;
76 // Parameters added to each url request. It can be empty if none are needed.
77 // The return string must be safe for insertion as an attribute in an
78 // XML element.
79 virtual std::string ExtraRequestParams() const = 0;
81 // The source of contexts for all the url requests.
82 virtual net::URLRequestContextGetter* RequestContext() const = 0;
84 // Returns a new out of process patcher. May be NULL for implementations
85 // that patch in-process.
86 virtual scoped_refptr<update_client::OutOfProcessPatcher>
87 CreateOutOfProcessPatcher() const = 0;
89 // True means that this client can handle delta updates.
90 virtual bool DeltasEnabled() const = 0;
92 // True means that the background downloader can be used for downloading
93 // non on-demand components.
94 virtual bool UseBackgroundDownloader() const = 0;
96 // Gets a task runner to a blocking pool of threads suitable for worker jobs.
97 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
98 const = 0;
100 // Gets a task runner for worker jobs guaranteed to run on a single thread.
101 // This thread must be capable of IO. On Windows, this thread must be
102 // initialized for use of COM objects.
103 virtual scoped_refptr<base::SingleThreadTaskRunner>
104 GetSingleThreadTaskRunner() const = 0;
106 protected:
107 friend class base::RefCountedThreadSafe<Configurator>;
109 virtual ~Configurator() {}
112 } // namespace update_client
114 #endif // COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_