OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_ |
| 6 #define COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 |
| 14 class GURL; |
| 15 |
| 16 namespace base { |
| 17 class SingleThreadTaskRunner; |
| 18 class SequencedTaskRunner; |
| 19 class Version; |
| 20 } |
| 21 |
| 22 namespace net { |
| 23 class URLRequestContextGetter; |
| 24 } |
| 25 |
| 26 namespace update_client { |
| 27 |
| 28 class OutOfProcessPatcher; |
| 29 |
| 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() {} |
| 37 |
| 38 // Delay in seconds from calling Start() to the first update check. |
| 39 virtual int InitialDelay() const = 0; |
| 40 |
| 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; |
| 44 |
| 45 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. |
| 46 virtual int StepDelay() const = 0; |
| 47 |
| 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; |
| 52 |
| 53 // Minimum delta time in seconds before checking again the same component. |
| 54 virtual int MinimumReCheckWait() const = 0; |
| 55 |
| 56 // Minimum delta time in seconds before an on-demand check is allowed |
| 57 // for the same component. |
| 58 virtual int OnDemandDelay() const = 0; |
| 59 |
| 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; |
| 63 |
| 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; |
| 67 |
| 68 // Version of the application. Used to compare the component manifests. |
| 69 virtual base::Version GetBrowserVersion() const = 0; |
| 70 |
| 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; |
| 75 |
| 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; |
| 79 |
| 80 // Returns the OS's long name like "Windows", "Mac OS X", etc. |
| 81 virtual std::string GetOSLongName() const = 0; |
| 82 |
| 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; |
| 87 |
| 88 // How big each update request can be. Don't go above 2000. |
| 89 virtual size_t UrlSizeLimit() const = 0; |
| 90 |
| 91 // The source of contexts for all the url requests. |
| 92 virtual net::URLRequestContextGetter* RequestContext() const = 0; |
| 93 |
| 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; |
| 98 |
| 99 // True means that this client can handle delta updates. |
| 100 virtual bool DeltasEnabled() const = 0; |
| 101 |
| 102 // True means that the background downloader can be used for downloading |
| 103 // non on-demand components. |
| 104 virtual bool UseBackgroundDownloader() const = 0; |
| 105 |
| 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; |
| 109 |
| 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; |
| 115 }; |
| 116 |
| 117 } // namespace update_client |
| 118 |
| 119 #endif // COMPONENTS_UPDATE_CLIENT_CONFIGURATOR_H_ |
OLD | NEW |