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

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

Issue 334783002: Componentize component_updater: Move some paths/constants to component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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_service.cc
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index 135bca66d96796515ab5fc8781a8c879ba034189..c0d176d5a46a08c1f98cbd147f43b0c03c16e64d 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -29,7 +29,6 @@
#include "chrome/browser/component_updater/crx_update_item.h"
#include "chrome/browser/component_updater/update_checker.h"
#include "chrome/browser/component_updater/update_response.h"
-#include "chrome/common/chrome_version_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_controller.h"
#include "content/public/browser/resource_throttle.h"
@@ -45,8 +44,8 @@ namespace component_updater {
namespace {
// Returns true if the |proposed| version is newer than |current| version.
-bool IsVersionNewer(const Version& current, const std::string& proposed) {
- Version proposed_ver(proposed);
+bool IsVersionNewer(const base::Version& current, const std::string& proposed) {
+ base::Version proposed_ver(proposed);
return proposed_ver.IsValid() && current.CompareTo(proposed_ver) < 0;
}
@@ -145,7 +144,9 @@ void UnblockandReapAllThrottles(CUResourceThrottle::WeakPtrVector* throttles) {
// thread.
class CrxUpdateService : public ComponentUpdateService, public OnDemandUpdater {
public:
- explicit CrxUpdateService(ComponentUpdateService::Configurator* config);
+ explicit CrxUpdateService(ComponentUpdateService::Configurator* config,
+ const std::string& chrome_version,
+ const std::string& platform_name);
virtual ~CrxUpdateService();
// Overrides for ComponentUpdateService.
@@ -263,7 +264,8 @@ class CrxUpdateService : public ComponentUpdateService, public OnDemandUpdater {
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
- const Version chrome_version_;
+ const base::Version chrome_version_;
+ const std::string platform_name_;
bool running_;
@@ -274,16 +276,20 @@ class CrxUpdateService : public ComponentUpdateService, public OnDemandUpdater {
//////////////////////////////////////////////////////////////////////////////
-CrxUpdateService::CrxUpdateService(ComponentUpdateService::Configurator* config)
+CrxUpdateService::CrxUpdateService(ComponentUpdateService::Configurator* config,
+ const std::string& chrome_version,
+ const std::string& platform_name)
: config_(config),
ping_manager_(
- new PingManager(config->PingUrl(), config->RequestContext())),
+ new PingManager(chrome_version, platform_name, config->PingUrl(),
+ config->RequestContext())),
blocking_task_runner_(
BrowserThread::GetBlockingPool()->
GetSequencedTaskRunnerWithShutdownBehavior(
BrowserThread::GetBlockingPool()->GetSequenceToken(),
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
- chrome_version_(chrome::VersionInfo().Version()),
+ chrome_version_(chrome_version),
+ platform_name_(platform_name),
running_(false) {
}
@@ -607,7 +613,7 @@ bool CrxUpdateService::CheckForUpdates() {
item->crx_urls.clear();
item->crx_diffurls.clear();
item->previous_version = item->component.version;
- item->next_version = Version();
+ item->next_version = base::Version();
item->previous_fp = item->component.fingerprint;
item->next_fp.clear();
item->diff_update_failed = false;
@@ -630,7 +636,8 @@ bool CrxUpdateService::CheckForUpdates() {
config_->RequestContext(),
base::Bind(&CrxUpdateService::UpdateCheckComplete,
base::Unretained(this))).Pass();
- return update_checker_->CheckForUpdates(items_to_check,
+ return update_checker_->CheckForUpdates(chrome_version_.GetString(),
+ platform_name_, items_to_check,
config_->ExtraRequestParams());
}
@@ -735,7 +742,7 @@ void CrxUpdateService::OnUpdateCheckSucceeded(
}
// Parse the members of the result and queue an upgrade for this component.
- crx->next_version = Version(it->manifest.version);
+ crx->next_version = base::Version(it->manifest.version);
VLOG(1) << "Update found for component: " << crx->id;
@@ -1087,9 +1094,11 @@ void CUResourceThrottle::Unblock() {
// The component update factory. Using the component updater as a singleton
// is the job of the browser process.
ComponentUpdateService* ComponentUpdateServiceFactory(
- ComponentUpdateService::Configurator* config) {
+ ComponentUpdateService::Configurator* config,
+ const std::string& chrome_version,
+ const std::string& platform_name) {
DCHECK(config);
- return new CrxUpdateService(config);
+ return new CrxUpdateService(config, chrome_version, platform_name);
}
} // namespace component_updater

Powered by Google App Engine
This is Rietveld 408576698