OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef COMPONENTS_COMPONENT_UPDATER_CONFIGURATOR_IMPL_H_ |
| 6 #define COMPONENTS_COMPONENT_UPDATER_CONFIGURATOR_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace base { |
| 15 class CommandLine; |
| 16 class Version; |
| 17 } |
| 18 |
| 19 namespace net { |
| 20 class URLRequestContextGetter; |
| 21 } |
| 22 |
| 23 namespace component_updater { |
| 24 |
| 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); |
| 31 |
| 32 ~ConfiguratorImpl(); |
| 33 |
| 34 // Delay in seconds from calling Start() to the first update check. |
| 35 int InitialDelay() const; |
| 36 |
| 37 // Delay in seconds to every subsequent update check. 0 means don't check. |
| 38 int NextCheckDelay() const; |
| 39 |
| 40 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. |
| 41 int StepDelay() const; |
| 42 |
| 43 // Minimum delta time in seconds before an on-demand check is allowed for the |
| 44 // same component. |
| 45 int OnDemandDelay() const; |
| 46 |
| 47 // The time delay in seconds between applying updates for different |
| 48 // components. |
| 49 int UpdateDelay() const; |
| 50 |
| 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; |
| 54 |
| 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; |
| 58 |
| 59 // Version of the application. Used to compare the component manifests. |
| 60 base::Version GetBrowserVersion() const; |
| 61 |
| 62 // Returns the OS's long name like "Windows", "Mac OS X", etc. |
| 63 std::string GetOSLongName() const; |
| 64 |
| 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; |
| 69 |
| 70 // The source of contexts for all the url requests. |
| 71 net::URLRequestContextGetter* RequestContext() const; |
| 72 |
| 73 // True means that this client can handle delta updates. |
| 74 bool DeltasEnabled() const; |
| 75 |
| 76 // True means that the background downloader can be used for downloading |
| 77 // non on-demand components. |
| 78 bool UseBackgroundDownloader() const; |
| 79 |
| 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_; |
| 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(ConfiguratorImpl); |
| 91 }; |
| 92 |
| 93 } // namespace component_updater |
| 94 |
| 95 #endif // COMPONENTS_COMPONENT_UPDATER_CONFIGURATOR_IMPL_H_ |
OLD | NEW |