| 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_COMPONENT_UPDATER_COMPONENT_UPDATER_CONFIGURATOR_H_ | |
| 6 #define COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_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 component_updater { | |
| 27 | |
| 28 class OutOfProcessPatcher; | |
| 29 | |
| 30 // Controls the component updater behavior. | |
| 31 class Configurator { | |
| 32 public: | |
| 33 virtual ~Configurator() {} | |
| 34 | |
| 35 // Delay in seconds from calling Start() to the first update check. | |
| 36 virtual int InitialDelay() const = 0; | |
| 37 | |
| 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; | |
| 41 | |
| 42 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. | |
| 43 virtual int StepDelay() const = 0; | |
| 44 | |
| 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; | |
| 49 | |
| 50 // Minimum delta time in seconds before checking again the same component. | |
| 51 virtual int MinimumReCheckWait() const = 0; | |
| 52 | |
| 53 // Minimum delta time in seconds before an on-demand check is allowed | |
| 54 // for the same component. | |
| 55 virtual int OnDemandDelay() const = 0; | |
| 56 | |
| 57 // The URLs for the update checks. The URLs are tried in order, the first one | |
| 58 // that succeeds wins. | |
| 59 virtual std::vector<GURL> UpdateUrl() const = 0; | |
| 60 | |
| 61 // The URLs for pings. Returns an empty vector if and only if pings are | |
| 62 // disabled. Similarly, these URLs have a fall back behavior too. | |
| 63 virtual std::vector<GURL> PingUrl() const = 0; | |
| 64 | |
| 65 // Version of the application. Used to compare the component manifests. | |
| 66 virtual base::Version GetBrowserVersion() const = 0; | |
| 67 | |
| 68 // Returns the value we use for the "updaterchannel=" and "prodchannel=" | |
| 69 // parameters. Possible return values include: "canary", "dev", "beta", and | |
| 70 // "stable". | |
| 71 virtual std::string GetChannel() const = 0; | |
| 72 | |
| 73 // Returns the language for the present locale. Possible return values are | |
| 74 // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc. | |
| 75 virtual std::string GetLang() const = 0; | |
| 76 | |
| 77 // Returns the OS's long name like "Windows", "Mac OS X", etc. | |
| 78 virtual std::string GetOSLongName() const = 0; | |
| 79 | |
| 80 // Parameters added to each url request. It can be empty if none are needed. | |
| 81 // The return string must be safe for insertion as an attribute in an | |
| 82 // XML element. | |
| 83 virtual std::string ExtraRequestParams() const = 0; | |
| 84 | |
| 85 // How big each update request can be. Don't go above 2000. | |
| 86 virtual size_t UrlSizeLimit() const = 0; | |
| 87 | |
| 88 // The source of contexts for all the url requests. | |
| 89 virtual net::URLRequestContextGetter* RequestContext() const = 0; | |
| 90 | |
| 91 // Returns a new out of process patcher. May be NULL for implementations | |
| 92 // that patch in-process. | |
| 93 virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher() | |
| 94 const = 0; | |
| 95 | |
| 96 // True means that this client can handle delta updates. | |
| 97 virtual bool DeltasEnabled() const = 0; | |
| 98 | |
| 99 // True means that the background downloader can be used for downloading | |
| 100 // non on-demand components. | |
| 101 virtual bool UseBackgroundDownloader() const = 0; | |
| 102 | |
| 103 // Gets a task runner to a blocking pool of threads suitable for worker jobs. | |
| 104 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | |
| 105 const = 0; | |
| 106 | |
| 107 // Gets a task runner for worker jobs guaranteed to run on a single thread. | |
| 108 // This thread must be capable of IO. On Windows, this thread must be | |
| 109 // initialized for use of COM objects. | |
| 110 virtual scoped_refptr<base::SingleThreadTaskRunner> | |
| 111 GetSingleThreadTaskRunner() const = 0; | |
| 112 }; | |
| 113 | |
| 114 } // namespace component_updater | |
| 115 | |
| 116 #endif // COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_CONFIGURATOR_H_ | |
| OLD | NEW |