1 // Copyright (c) 2011 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 CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_CONFIGURATOR_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_CONFIGURATOR_H_
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
17 class SingleThreadTaskRunner;
18 class SequencedTaskRunner;
23 class URLRequestContextGetter;
26 namespace component_updater {
28 class OutOfProcessPatcher;
30 // Controls the component updater behavior.
33 virtual ~Configurator() {}
35 // Delay in seconds from calling Start() to the first update check.
36 virtual int InitialDelay() const = 0;
38 // Delay in seconds to every subsequent update check. 0 means don't check.
39 // This function is a mutator for testing purposes.
40 virtual int NextCheckDelay() = 0;
42 // Delay in seconds from each task step. Used to smooth out CPU/IO usage.
43 virtual int StepDelay() const = 0;
45 // Delay in seconds between applying updates for different components, if
46 // several updates are available at a given time. This function is a mutator
47 // for testing purposes.
48 virtual int StepDelayMedium() = 0;
50 // Minimum delta time in seconds before checking again the same component.
51 virtual int MinimumReCheckWait() const = 0;
53 // Minimum delta time in seconds before an on-demand check is allowed
54 // for the same component.
55 virtual int OnDemandDelay() const = 0;
57 // The url that is going to be used update checks over Omaha protocol.
58 virtual GURL UpdateUrl() const = 0;
60 // The url where the completion pings are sent. Invalid if and only if
61 // pings are disabled.
62 virtual GURL PingUrl() const = 0;
64 // Version of the application. Used to compare the component manifests.
65 virtual base::Version GetBrowserVersion() const = 0;
67 // Returns the value we use for the "updaterchannel=" and "prodchannel="
68 // parameters. Possible return values include: "canary", "dev", "beta", and
70 virtual std::string GetChannel() const = 0;
72 // Returns the language for the present locale. Possible return values are
73 // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc.
74 virtual std::string GetLang() const = 0;
76 // Returns the OS's long name like "Windows", "Mac OS X", etc.
77 virtual std::string GetOSLongName() const = 0;
79 // Parameters added to each url request. It can be empty if none are needed.
80 // The return string must be safe for insertion as an attribute in an
82 virtual std::string ExtraRequestParams() const = 0;
84 // How big each update request can be. Don't go above 2000.
85 virtual size_t UrlSizeLimit() const = 0;
87 // The source of contexts for all the url requests.
88 virtual net::URLRequestContextGetter* RequestContext() const = 0;
90 // Returns a new out of process patcher. May be NULL for implementations
91 // that patch in-process.
92 virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher()
95 // True means that this client can handle delta updates.
96 virtual bool DeltasEnabled() const = 0;
98 // True means that the background downloader can be used for downloading
99 // non on-demand components.
100 virtual bool UseBackgroundDownloader() const = 0;
102 // Gets a task runner to a blocking pool of threads suitable for worker jobs.
103 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
106 // Gets a task runner for worker jobs guaranteed to run on a single thread.
107 // This thread must be capable of IO. On Windows, this thread must be
108 // initialized for use of COM objects.
109 virtual scoped_refptr<base::SingleThreadTaskRunner>
110 GetSingleThreadTaskRunner() const = 0;
113 Configurator* MakeChromeComponentUpdaterConfigurator(
114 const base::CommandLine* cmdline,
115 net::URLRequestContextGetter* context_getter);
117 } // namespace component_updater
119 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_CONFIGURATOR_H_