| Index: chrome/browser/component_updater/component_updater_configurator.cc
|
| diff --git a/chrome/browser/component_updater/component_updater_configurator.cc b/chrome/browser/component_updater/component_updater_configurator.cc
|
| index 16fa3e9619752730b02326dba994faf4c14aef10..43e90725a1a59ad428f20f9156162e07581c1fb8 100644
|
| --- a/chrome/browser/component_updater/component_updater_configurator.cc
|
| +++ b/chrome/browser/component_updater/component_updater_configurator.cc
|
| @@ -14,31 +14,39 @@
|
| #include "base/strings/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;
|
|
|
| // Debug values you can pass to --component-updater-debug=value1,value2.
|
| // Speed up component checking.
|
| -const char kDebugFastUpdate[] = "fast-update";
|
| +const char kSwitchFastUpdate[] = "fast-update";
|
| // Force out-of-process-xml parsing.
|
| -const char kDebugOutOfProcess[] = "out-of-process";
|
| +const char kSwitchOutOfProcess[] = "out-of-process";
|
| // Add "testrequest=1" parameter to the update check query.
|
| -const char kDebugRequestParam[] = "test-request";
|
| +const char kSwitchRequestParam[] = "test-request";
|
| +// Disables differential updates.
|
| +const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates";
|
|
|
| // The urls from which an update manifest can be fetched.
|
| 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
|
| };
|
|
|
| -bool HasDebugValue(const std::vector<std::string>& vec, const char* test) {
|
| +bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) {
|
| if (vec.empty())
|
| return 0;
|
| return (std::find(vec.begin(), vec.end(), test) != vec.end());
|
| @@ -64,25 +72,36 @@ class ChromeConfigurator : public ComponentUpdateService::Configurator {
|
| virtual net::URLRequestContextGetter* RequestContext() OVERRIDE;
|
| virtual bool InProcess() OVERRIDE;
|
| virtual void OnEvent(Events event, int val) OVERRIDE;
|
| + virtual ComponentPatcher* CreateComponentPatcher() OVERRIDE;
|
| + virtual bool DeltasEnabled() const OVERRIDE;
|
|
|
| private:
|
| net::URLRequestContextGetter* url_request_getter_;
|
| std::string extra_info_;
|
| bool fast_update_;
|
| bool out_of_process_;
|
| + 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)),
|
| + fast_update_(false),
|
| + out_of_process_(false),
|
| + deltas_enabled_(false) {
|
| // Parse comma-delimited debug flags.
|
| - std::vector<std::string> debug_values;
|
| - Tokenize(cmdline->GetSwitchValueASCII(switches::kComponentUpdaterDebug),
|
| - ",", &debug_values);
|
| - fast_update_ = HasDebugValue(debug_values, kDebugFastUpdate);
|
| - out_of_process_ = HasDebugValue(debug_values, kDebugOutOfProcess);
|
| + std::vector<std::string> switch_values;
|
| + Tokenize(cmdline->GetSwitchValueASCII(switches::kComponentUpdater),
|
| + ",", &switch_values);
|
| + fast_update_ = HasSwitchValue(switch_values, kSwitchFastUpdate);
|
| + out_of_process_ = HasSwitchValue(switch_values, kSwitchOutOfProcess);
|
| +#if defined(OS_WIN)
|
| + deltas_enabled_ = !HasSwitchValue(switch_values, kSwitchDisableDeltaUpdates);
|
| +#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.
|
| @@ -91,7 +110,7 @@ ChromeConfigurator::ChromeConfigurator(const CommandLine* cmdline,
|
| base::win::OSInfo::WOW64_ENABLED)
|
| extra_info_ += "&wow64=1";
|
| #endif
|
| - if (HasDebugValue(debug_values, kDebugRequestParam))
|
| + if (HasSwitchValue(switch_values, kSwitchRequestParam))
|
| extra_info_ += "&testrequest=1";
|
| }
|
|
|
| @@ -161,6 +180,18 @@ void ChromeConfigurator::OnEvent(Events event, int val) {
|
| }
|
| }
|
|
|
| +ComponentPatcher* ChromeConfigurator::CreateComponentPatcher() {
|
| +#if defined(OS_WIN)
|
| + return new ComponentPatcherWin();
|
| +#else
|
| + return new ComponentPatcherCrossPlatform();
|
| +#endif
|
| +}
|
| +
|
| +bool ChromeConfigurator::DeltasEnabled() const {
|
| + return deltas_enabled_;
|
| +}
|
| +
|
| ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator(
|
| const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) {
|
| return new ChromeConfigurator(cmdline, context_getter);
|
|
|