Update V8 to version 4.7.1.
[chromium-blink-merge.git] / components / component_updater / configurator_impl.h
blobdf58473d80449c27bcffa2d13d46d7c89e428c1d
1 // Copyright 2015 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_COMPONENT_UPDATER_CONFIGURATOR_IMPL_H_
6 #define COMPONENTS_COMPONENT_UPDATER_CONFIGURATOR_IMPL_H_
8 #include <string>
9 #include <vector>
11 #include "base/macros.h"
12 #include "url/gurl.h"
14 namespace base {
15 class CommandLine;
16 class Version;
19 namespace net {
20 class URLRequestContextGetter;
23 namespace component_updater {
25 // Helper class for the implementations of update_client::Configurator.
26 // Can be used both on iOS and other platforms.
27 class ConfiguratorImpl {
28 public:
29 ConfiguratorImpl(const base::CommandLine* cmdline,
30 net::URLRequestContextGetter* url_request_getter);
32 ~ConfiguratorImpl();
34 // Delay in seconds from calling Start() to the first update check.
35 int InitialDelay() const;
37 // Delay in seconds to every subsequent update check. 0 means don't check.
38 int NextCheckDelay() const;
40 // Delay in seconds from each task step. Used to smooth out CPU/IO usage.
41 int StepDelay() const;
43 // Minimum delta time in seconds before an on-demand check is allowed for the
44 // same component.
45 int OnDemandDelay() const;
47 // The time delay in seconds between applying updates for different
48 // components.
49 int UpdateDelay() const;
51 // The URLs for the update checks. The URLs are tried in order, the first one
52 // that succeeds wins.
53 std::vector<GURL> UpdateUrl() const;
55 // The URLs for pings. Returns an empty vector if and only if pings are
56 // disabled. Similarly, these URLs have a fall back behavior too.
57 std::vector<GURL> PingUrl() const;
59 // Version of the application. Used to compare the component manifests.
60 base::Version GetBrowserVersion() const;
62 // Returns the OS's long name like "Windows", "Mac OS X", etc.
63 std::string GetOSLongName() const;
65 // Parameters added to each url request. It can be empty if none are needed.
66 // The return string must be safe for insertion as an attribute in an
67 // XML element.
68 std::string ExtraRequestParams() const;
70 // The source of contexts for all the url requests.
71 net::URLRequestContextGetter* RequestContext() const;
73 // True means that this client can handle delta updates.
74 bool DeltasEnabled() const;
76 // True means that the background downloader can be used for downloading
77 // non on-demand components.
78 bool UseBackgroundDownloader() const;
80 private:
81 net::URLRequestContextGetter* url_request_getter_;
82 std::string extra_info_;
83 GURL url_source_override_;
84 bool fast_update_;
85 bool pings_enabled_;
86 bool deltas_enabled_;
87 bool background_downloads_enabled_;
88 bool fallback_to_alt_source_url_enabled_;
90 DISALLOW_COPY_AND_ASSIGN(ConfiguratorImpl);
93 } // namespace component_updater
95 #endif // COMPONENTS_COMPONENT_UPDATER_CONFIGURATOR_IMPL_H_