diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 00:37:18 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 00:37:18 +0000 |
commit | 484fce46af7b7521b1bea54ab9e50ed2f60dd97a (patch) | |
tree | 43728b0d80da098c1d4a8e4a0d70e8a7afac9d86 /chrome/browser | |
parent | d5b7f1658e3ce35e28492e4d873bf73400930a30 (diff) | |
download | chromium_src-484fce46af7b7521b1bea54ab9e50ed2f60dd97a.zip chromium_src-484fce46af7b7521b1bea54ab9e50ed2f60dd97a.tar.gz chromium_src-484fce46af7b7521b1bea54ab9e50ed2f60dd97a.tar.bz2 |
Change the SafeBrowsing client version to use the proper
Google Chrome version number.
Review URL: http://codereview.chromium.org/6022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/safe_browsing/protocol_manager.cc | 25 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/protocol_manager.h | 3 |
2 files changed, 17 insertions, 11 deletions
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index e3a91ad..d1b7380e 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -4,6 +4,7 @@ #include "chrome/browser/safe_browsing/protocol_manager.h" +#include "base/file_version_info.h" #include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" @@ -26,23 +27,21 @@ static const int kSbTimerStartIntervalSec = 5 * 60; // Update URL for querying about the latest set of chunk updates. static const char* const kSbUpdateUrl = - "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=%s&appver=%d.%d&pver=2.1"; + "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=%s&appver=%s&pver=2.1"; // GetHash request URL for retrieving full hashes. static const char* const kSbGetHashUrl = - "http://safebrowsing.clients.google.com/safebrowsing/gethash?client=%s&appver=%d.%d&pver=2.1"; + "http://safebrowsing.clients.google.com/safebrowsing/gethash?client=%s&appver=%s&pver=2.1"; // New MAC client key requests URL. static const char* const kSbNewKeyUrl = - "https://sb-ssl.google.com/safebrowsing/newkey?client=%s&appver=%d.%d&pver=2.1"; + "https://sb-ssl.google.com/safebrowsing/newkey?client=%s&appver=%s&pver=2.1"; #if defined(GOOGLE_CHROME_BUILD) static const char* const kSbClientName = "googlechrome"; #else static const char* const kSbClientName = "chromium"; #endif -static const int kSbClientMajorVersion = 1; -static const int kSbClientMinorVersion = 0; // Maximum back off multiplier. static const int kSbMaxBackOff = 8; @@ -73,6 +72,13 @@ SafeBrowsingProtocolManager::SafeBrowsingProtocolManager( // The first update must happen between 0-5 minutes of start up. next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec); + + scoped_ptr<FileVersionInfo> version_info( + FileVersionInfo::CreateFileVersionInfoForCurrentModule()); + if (!version_info.get()) + version_ = "0.1"; + else + version_ = WideToASCII(version_info->product_version()); } SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() { @@ -101,8 +107,7 @@ void SafeBrowsingProtocolManager::GetFullHash( std::string url = StringPrintf(kSbGetHashUrl, kSbClientName, - kSbClientMajorVersion, - kSbClientMinorVersion); + version_.c_str()); if (!client_key_.empty()) { url.append("&wrkey="); url.append(wrapped_key_); @@ -458,8 +463,7 @@ void SafeBrowsingProtocolManager::IssueChunkRequest() { void SafeBrowsingProtocolManager::IssueKeyRequest() { GURL key_url(StringPrintf(kSbNewKeyUrl, kSbClientName, - kSbClientMajorVersion, - kSbClientMinorVersion)); + version_.c_str())); request_type_ = GETKEY_REQUEST; request_.reset(new URLFetcher(key_url, URLFetcher::GET, this)); request_->set_load_flags(net::LOAD_DISABLE_CACHE); @@ -503,8 +507,7 @@ void SafeBrowsingProtocolManager::OnGetChunksComplete( std::string url = StringPrintf(kSbUpdateUrl, kSbClientName, - kSbClientMajorVersion, - kSbClientMinorVersion); + version_.c_str()); if (use_mac) { url.append("&wrkey="); url.append(wrapped_key_); diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h index 178aecd..723a1ed 100644 --- a/chrome/browser/safe_browsing/protocol_manager.h +++ b/chrome/browser/safe_browsing/protocol_manager.h @@ -201,6 +201,9 @@ class SafeBrowsingProtocolManager : public URLFetcher::Delegate { // While in GetHash backoff, we can't make another GetHash until this time. Time next_gethash_time_; + // Current product version sent in each request. + std::string version_; + DISALLOW_EVIL_CONSTRUCTORS(SafeBrowsingProtocolManager); }; |