| Index: chrome/browser/component_updater/component_updater_configurator.cc
|
| ===================================================================
|
| --- chrome/browser/component_updater/component_updater_configurator.cc (revision 201835)
|
| +++ chrome/browser/component_updater/component_updater_configurator.cc (working copy)
|
| @@ -14,11 +14,17 @@
|
| #include "base/string_util.h"
|
| #include "base/win/windows_version.h"
|
| #include "build/build_config.h"
|
| +#include "chrome/browser/component_updater/component_patcher.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/omaha_query_params/omaha_query_params.h"
|
| #include "net/url_request/url_request_context_getter.h"
|
|
|
| +#if defined(OS_WIN)
|
| +#include "chrome/browser/component_updater/component_patcher_win.h"
|
| +#endif
|
| +
|
| namespace {
|
| +
|
| // Default time constants.
|
| const int kDelayOneMinute = 60;
|
| const int kDelayOneHour = kDelayOneMinute * 60;
|
| @@ -35,9 +41,13 @@
|
| const char* kUrlSources[] = {
|
| "http://clients2.google.com/service/update2/crx", // BANDAID
|
| "http://omaha.google.com/service/update2/crx", // CWS_PUBLIC
|
| - "http://omaha.sandbox.google.com/service/update2/crx" // CWS_SANDBOX
|
| + "http://omaha.sandbox.google.com/service/update2/crx", // CWS_SANDBOX
|
| };
|
|
|
| +// The url to send the completion pings to. Completion pings are sent when
|
| +// updates have completed, either successfully or with errors.
|
| +const char kUrlPing[] = "http://tools.google.com/service/update2";
|
| +
|
| bool HasDebugValue(const std::vector<std::string>& vec, const char* test) {
|
| if (vec.empty())
|
| return 0;
|
| @@ -59,24 +69,32 @@
|
| virtual int MinimumReCheckWait() OVERRIDE;
|
| virtual int OnDemandDelay() OVERRIDE;
|
| virtual GURL UpdateUrl(CrxComponent::UrlSource source) OVERRIDE;
|
| + virtual GURL PingUrl() OVERRIDE;
|
| virtual const char* ExtraRequestParams() OVERRIDE;
|
| virtual size_t UrlSizeLimit() OVERRIDE;
|
| virtual net::URLRequestContextGetter* RequestContext() OVERRIDE;
|
| virtual bool InProcess() OVERRIDE;
|
| virtual void OnEvent(Events event, int val) OVERRIDE;
|
| + virtual ComponentPatcher* CreateComponentPatcher() OVERRIDE;
|
| + virtual bool PingsEnabled() const OVERRIDE;
|
| + virtual bool DeltasEnabled() const OVERRIDE;
|
|
|
| private:
|
| net::URLRequestContextGetter* url_request_getter_;
|
| std::string extra_info_;
|
| bool fast_update_;
|
| bool out_of_process_;
|
| + bool pings_enabled_;
|
| + bool deltas_enabled_;
|
| };
|
|
|
| ChromeConfigurator::ChromeConfigurator(const CommandLine* cmdline,
|
| net::URLRequestContextGetter* url_request_getter)
|
| : url_request_getter_(url_request_getter),
|
| extra_info_(chrome::OmahaQueryParams::Get(
|
| - chrome::OmahaQueryParams::CHROME)) {
|
| + chrome::OmahaQueryParams::CHROME)),
|
| + pings_enabled_(false),
|
| + deltas_enabled_(false) {
|
| // Parse comma-delimited debug flags.
|
| std::vector<std::string> debug_values;
|
| Tokenize(cmdline->GetSwitchValueASCII(switches::kComponentUpdaterDebug),
|
| @@ -84,6 +102,14 @@
|
| fast_update_ = HasDebugValue(debug_values, kDebugFastUpdate);
|
| out_of_process_ = HasDebugValue(debug_values, kDebugOutOfProcess);
|
|
|
| + // Parse other command-ling flags.
|
| + pings_enabled_ = cmdline->HasSwitch(switches::kEnableComponentUpdatePings);
|
| +#if defined(OS_WIN)
|
| + deltas_enabled_ = cmdline->HasSwitch(switches::kEnableComponentUpdateDeltas);
|
| +#else
|
| + deltas_enabled_ = false;
|
| +#endif
|
| +
|
| // Make the extra request params, they are necessary so omaha does
|
| // not deliver components that are going to be rejected at install time.
|
| #if defined(OS_WIN)
|
| @@ -119,6 +145,10 @@
|
| return GURL(kUrlSources[source]);
|
| }
|
|
|
| +GURL ChromeConfigurator::PingUrl() {
|
| + return GURL(kUrlPing);
|
| +}
|
| +
|
| const char* ChromeConfigurator::ExtraRequestParams() {
|
| return extra_info_.c_str();
|
| }
|
| @@ -161,6 +191,22 @@
|
| }
|
| }
|
|
|
| +ComponentPatcher* ChromeConfigurator::CreateComponentPatcher() {
|
| +#if defined(OS_WIN)
|
| + return new ComponentPatcherWin();
|
| +#else
|
| + return new ComponentPatcherCrossPlatform();
|
| +#endif
|
| +}
|
| +
|
| +bool ChromeConfigurator::DeltasEnabled() const {
|
| + return deltas_enabled_;
|
| +}
|
| +
|
| +bool ChromeConfigurator::PingsEnabled() const {
|
| + return pings_enabled_;
|
| +}
|
| +
|
| ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator(
|
| const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) {
|
| return new ChromeConfigurator(cmdline, context_getter);
|
|
|