Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: chrome/browser/component_updater/component_updater_configurator.cc

Issue 15908002: Differential updates for components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Added missing const decl. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..577d6dad8c5880c813de1a0879c82d1c1ad456b2 100644
--- a/chrome/browser/component_updater/component_updater_configurator.cc
+++ b/chrome/browser/component_updater/component_updater_configurator.cc
@@ -14,11 +14,17 @@
#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;
@@ -35,9 +41,13 @@ const char kDebugRequestParam[] = "test-request";
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,31 @@ class ChromeConfigurator : public ComponentUpdateService::Configurator {
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 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 +101,14 @@ ChromeConfigurator::ChromeConfigurator(const CommandLine* cmdline,
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 +144,10 @@ GURL ChromeConfigurator::UpdateUrl(CrxComponent::UrlSource source) {
return GURL(kUrlSources[source]);
}
+GURL ChromeConfigurator::PingUrl() {
+ return pings_enabled_ ? GURL(kUrlPing) : GURL();
+}
+
const char* ChromeConfigurator::ExtraRequestParams() {
return extra_info_.c_str();
}
@@ -161,6 +190,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);

Powered by Google App Engine
This is Rietveld 408576698