Roll src/third_party/skia de7665a:76033be
[chromium-blink-merge.git] / components / update_client / configurator.h
blobb9a86faee434d248baba7cc53f10237e59849ed3
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 {
35 public:
36 virtual ~Configurator() {}
38 // Delay in seconds from calling Start() to the first update check.
39 virtual int InitialDelay() const = 0;
41 // Delay in seconds to every subsequent update check. 0 means don't check.
42 // This function is a mutator for testing purposes.
43 virtual int NextCheckDelay() = 0;
45 // Delay in seconds from each task step. Used to smooth out CPU/IO usage.
46 virtual int StepDelay() const = 0;
48 // Delay in seconds between applying updates for different components, if
49 // several updates are available at a given time. This function is a mutator
50 // for testing purposes.
51 virtual int StepDelayMedium() = 0;
53 // Minimum delta time in seconds before checking again the same component.
54 virtual int MinimumReCheckWait() const = 0;
56 // Minimum delta time in seconds before an on-demand check is allowed
57 // for the same component.
58 virtual int OnDemandDelay() const = 0;
60 // The URLs for the update checks. The URLs are tried in order, the first one
61 // that succeeds wins.
62 virtual std::vector<GURL> UpdateUrl() const = 0;
64 // The URLs for pings. Returns an empty vector if and only if pings are
65 // disabled. Similarly, these URLs have a fall back behavior too.
66 virtual std::vector<GURL> PingUrl() const = 0;
68 // Version of the application. Used to compare the component manifests.
69 virtual base::Version GetBrowserVersion() const = 0;
71 // Returns the value we use for the "updaterchannel=" and "prodchannel="
72 // parameters. Possible return values include: "canary", "dev", "beta", and
73 // "stable".
74 virtual std::string GetChannel() const = 0;
76 // Returns the language for the present locale. Possible return values are
77 // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc.
78 virtual std::string GetLang() const = 0;
80 // Returns the OS's long name like "Windows", "Mac OS X", etc.
81 virtual std::string GetOSLongName() const = 0;
83 // Parameters added to each url request. It can be empty if none are needed.
84 // The return string must be safe for insertion as an attribute in an
85 // XML element.
86 virtual std::string ExtraRequestParams() const = 0;
88 // How big each update request can be. Don't go above 2000.
89 virtual size_t UrlSizeLimit() const = 0;
91 // The source of contexts for all the url requests.
92 virtual net::URLRequestContextGetter* RequestContext() const = 0;
94 // Returns a new out of process patcher. May be NULL for implementations
95 // that patch in-process.
96 virtual scoped_refptr<update_client::OutOfProcessPatcher>
97 CreateOutOfProcessPatcher() const = 0;
99 // True means that this client can handle delta updates.
100 virtual bool DeltasEnabled() const = 0;
102 // True means that the background downloader can be used for downloading
103 // non on-demand components.
104 virtual bool UseBackgroundDownloader() const = 0;
106 // Gets a task runner to a blocking pool of threads suitable for worker jobs.
107 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
108 const = 0;
110 // Gets a task runner for worker jobs guaranteed to run on a single thread.
111 // This thread must be capable of IO. On Windows, this thread must be
112 // initialized for use of COM objects.
113 virtual scoped_refptr<base::SingleThreadTaskRunner>
114 GetSingleThreadTaskRunner() const = 0;
117 } // namespace update_client
119 #endif // COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_