diff options
-rw-r--r-- | chrome/browser/component_updater/component_updater_service.cc | 34 | ||||
-rw-r--r-- | chrome/browser/component_updater/test/component_updater_service_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/component_updater/test/update_response_unittest.cc (renamed from chrome/browser/component_updater/test/component_updater_manifest_unittest.cc) | 8 | ||||
-rw-r--r-- | chrome/browser/component_updater/update_response.cc (renamed from chrome/browser/component_updater/update_manifest.cc) | 42 | ||||
-rw-r--r-- | chrome/browser/component_updater/update_response.h (renamed from chrome/browser/component_updater/update_manifest.h) | 20 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 4 | ||||
-rw-r--r-- | chrome/chrome_tests_unit.gypi | 2 |
7 files changed, 57 insertions, 57 deletions
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc index beee14a..774a21b 100644 --- a/chrome/browser/component_updater/component_updater_service.cc +++ b/chrome/browser/component_updater/component_updater_service.cc @@ -29,7 +29,7 @@ #include "chrome/browser/component_updater/component_updater_ping_manager.h" #include "chrome/browser/component_updater/component_updater_utils.h" #include "chrome/browser/component_updater/crx_update_item.h" -#include "chrome/browser/component_updater/update_manifest.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" @@ -307,9 +307,9 @@ class CrxUpdateService : public ComponentUpdateService { kStepDelayLong, }; - void OnParseUpdateManifestSucceeded( - const component_updater::UpdateManifest::Results& results); - void OnParseUpdateManifestFailed(const std::string& error_message); + void OnParseUpdateResponseSucceeded( + const component_updater::UpdateResponse::Results& results); + void OnParseUpdateResponseFailed(const std::string& error_message); Status OnDemandUpdateInternal(CrxUpdateItem* item); @@ -328,7 +328,7 @@ class CrxUpdateService : public ComponentUpdateService { void ScheduleNextRun(StepDelayInterval step_delay); - void ParseManifest(const std::string& xml); + void ParseResponse(const std::string& xml); void Install(const CRXContext* context, const base::FilePath& crx_path); @@ -847,32 +847,32 @@ void CrxUpdateService::OnURLFetchComplete(const net::URLFetcher* source, std::string xml; source->GetResponseAsString(&xml); url_fetcher_.reset(); - ParseManifest(xml); + ParseResponse(xml); } else { url_fetcher_.reset(); - CrxUpdateService::OnParseUpdateManifestFailed("network error"); + CrxUpdateService::OnParseUpdateResponseFailed("network error"); } delete context; } -void CrxUpdateService::ParseManifest(const std::string& xml) { +void CrxUpdateService::ParseResponse(const std::string& xml) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - component_updater::UpdateManifest manifest; - if (manifest.Parse(xml)) - CrxUpdateService::OnParseUpdateManifestSucceeded(manifest.results()); + component_updater::UpdateResponse update_response; + if (update_response.Parse(xml)) + CrxUpdateService::OnParseUpdateResponseSucceeded(update_response.results()); else - CrxUpdateService::OnParseUpdateManifestFailed(manifest.errors()); + CrxUpdateService::OnParseUpdateResponseFailed(update_response.errors()); } // A valid Omaha update check has arrived, from only the list of components that // we are currently upgrading we check for a match in which the server side // version is newer, if so we queue them for an upgrade. The next time we call // ProcessPendingItems() one of them will be drafted for the upgrade process. -void CrxUpdateService::OnParseUpdateManifestSucceeded( - const component_updater::UpdateManifest::Results& results) { +void CrxUpdateService::OnParseUpdateResponseSucceeded( + const component_updater::UpdateResponse::Results& results) { size_t num_updates_pending = 0; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - std::vector<component_updater::UpdateManifest::Result>::const_iterator it; + std::vector<component_updater::UpdateResponse::Result>::const_iterator it; for (it = results.list.begin(); it != results.list.end(); ++it) { CrxUpdateItem* crx = FindUpdateItemById(it->extension_id); if (!crx) @@ -913,7 +913,7 @@ void CrxUpdateService::OnParseUpdateManifestSucceeded( crx->next_version = Version(it->manifest.version); typedef component_updater:: - UpdateManifest::Result::Manifest::Package Package; + UpdateResponse::Result::Manifest::Package Package; const Package& package(it->manifest.packages[0]); crx->next_fp = package.fingerprint; @@ -937,7 +937,7 @@ void CrxUpdateService::OnParseUpdateManifestSucceeded( ScheduleNextRun(num_updates_pending > 0 ? kStepDelayShort : kStepDelayMedium); } -void CrxUpdateService::OnParseUpdateManifestFailed( +void CrxUpdateService::OnParseUpdateResponseFailed( const std::string& error_message) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); size_t count = ChangeItemStatus(CrxUpdateItem::kChecking, diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest.cc b/chrome/browser/component_updater/test/component_updater_service_unittest.cc index 688ed43..1637c9e 100644 --- a/chrome/browser/component_updater/test/component_updater_service_unittest.cc +++ b/chrome/browser/component_updater/test/component_updater_service_unittest.cc @@ -358,10 +358,10 @@ TEST_F(ComponentUpdaterTest, CheckCrxSleep) { // should have been fired. We do two loops so the second time around there // should be nothing left to do. // We also check that the following network requests are issued: -// 1- manifest check +// 1- update check // 2- download crx // 3- ping -// 4- second manifest check. +// 4- second update check. TEST_F(ComponentUpdaterTest, InstallCrx) { MockComponentObserver observer1; { diff --git a/chrome/browser/component_updater/test/component_updater_manifest_unittest.cc b/chrome/browser/component_updater/test/update_response_unittest.cc index 1583c49..248c028 100644 --- a/chrome/browser/component_updater/test/component_updater_manifest_unittest.cc +++ b/chrome/browser/component_updater/test/update_response_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/memory/scoped_vector.h" -#include "chrome/browser/component_updater/update_manifest.h" +#include "chrome/browser/component_updater/update_response.h" #include "libxml/globals.h" #include "testing/gtest/include/gtest/gtest.h" @@ -191,8 +191,8 @@ const char* kTwoAppsOneError = " </app>" "</response>"; -TEST(ComponentUpdaterManifestTest, TestUpdateManifest) { - UpdateManifest parser; +TEST(ComponentUpdaterUpdateResponseTest, TestParser) { + UpdateResponse parser; // Test parsing of a number of invalid xml cases EXPECT_FALSE(parser.Parse(std::string())); @@ -218,7 +218,7 @@ TEST(ComponentUpdaterManifestTest, TestUpdateManifest) { EXPECT_TRUE(parser.Parse(kValidXml)); EXPECT_TRUE(parser.errors().empty()); EXPECT_EQ(1u, parser.results().list.size()); - const UpdateManifest::Result* firstResult = &parser.results().list[0]; + const UpdateResponse::Result* firstResult = &parser.results().list[0]; EXPECT_EQ(1u, firstResult->crx_urls.size()); EXPECT_EQ(GURL("http://example.com/"), firstResult->crx_urls[0]); EXPECT_EQ(GURL("http://diff.example.com/"), firstResult->crx_diffurls[0]); diff --git a/chrome/browser/component_updater/update_manifest.cc b/chrome/browser/component_updater/update_response.cc index f9e1316..cf93658 100644 --- a/chrome/browser/component_updater/update_manifest.cc +++ b/chrome/browser/component_updater/update_response.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/component_updater/update_manifest.h" +#include "chrome/browser/component_updater/update_response.h" #include <algorithm> #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" @@ -17,23 +17,23 @@ namespace component_updater { static const char* kExpectedResponseProtocol = "3.0"; -UpdateManifest::UpdateManifest() {} -UpdateManifest::~UpdateManifest() {} +UpdateResponse::UpdateResponse() {} +UpdateResponse::~UpdateResponse() {} -UpdateManifest::Results::Results() : daystart_elapsed_seconds(kNoDaystart) {} -UpdateManifest::Results::~Results() {} +UpdateResponse::Results::Results() : daystart_elapsed_seconds(kNoDaystart) {} +UpdateResponse::Results::~Results() {} -UpdateManifest::Result::Result() {} +UpdateResponse::Result::Result() {} -UpdateManifest::Result::~Result() {} +UpdateResponse::Result::~Result() {} -UpdateManifest::Result::Manifest::Manifest() {} -UpdateManifest::Result::Manifest::~Manifest() {} +UpdateResponse::Result::Manifest::Manifest() {} +UpdateResponse::Result::Manifest::~Manifest() {} -UpdateManifest::Result::Manifest::Package::Package() : size(0), sizediff(0) {} -UpdateManifest::Result::Manifest::Package::~Package() {} +UpdateResponse::Result::Manifest::Package::Package() : size(0), sizediff(0) {} +UpdateResponse::Result::Manifest::Package::~Package() {} -void UpdateManifest::ParseError(const char* details, ...) { +void UpdateResponse::ParseError(const char* details, ...) { va_list args; va_start(args, details); @@ -104,9 +104,9 @@ class ScopedXmlDocument { // Parses the <package> tag. bool ParsePackageTag(xmlNode* package, - UpdateManifest::Result* result, + UpdateResponse::Result* result, std::string* error) { - UpdateManifest::Result::Manifest::Package p; + UpdateResponse::Result::Manifest::Package p; p.name = GetAttribute(package, "name"); if (p.name.empty()) { *error = "Missing name for package."; @@ -138,7 +138,7 @@ bool ParsePackageTag(xmlNode* package, // Parses the <manifest> tag. bool ParseManifestTag(xmlNode* manifest, - UpdateManifest::Result* result, + UpdateResponse::Result* result, std::string* error) { // Get the version. result->manifest.version = GetAttribute(manifest, "version"); @@ -186,7 +186,7 @@ bool ParseManifestTag(xmlNode* manifest, // Parses the <urls> tag and its children in the <updatecheck>. bool ParseUrlsTag(xmlNode* urls, - UpdateManifest::Result* result, + UpdateResponse::Result* result, std::string* error) { // Get the url nodes. std::vector<xmlNode*> url = GetChildren(urls, "url"); @@ -222,7 +222,7 @@ bool ParseUrlsTag(xmlNode* urls, // Parses the <updatecheck> tag. bool ParseUpdateCheckTag(xmlNode* updatecheck, - UpdateManifest::Result* result, + UpdateResponse::Result* result, std::string* error) { if (GetAttribute(updatecheck, "status") == "noupdate") { return true; @@ -250,7 +250,7 @@ bool ParseUpdateCheckTag(xmlNode* updatecheck, // Parses a single <app> tag. bool ParseAppTag(xmlNode* app, - UpdateManifest::Result* result, + UpdateResponse::Result* result, std::string* error) { // Read the crx id. result->extension_id = GetAttribute(app, "appid"); @@ -269,12 +269,12 @@ bool ParseAppTag(xmlNode* app, return ParseUpdateCheckTag(updates[0], result, error); } -bool UpdateManifest::Parse(const std::string& manifest_xml) { +bool UpdateResponse::Parse(const std::string& response_xml) { results_.daystart_elapsed_seconds = kNoDaystart; results_.list.clear(); errors_.clear(); - if (manifest_xml.length() < 1) { + if (response_xml.length() < 1) { ParseError("Empty xml"); return false; } @@ -284,7 +284,7 @@ bool UpdateManifest::Parse(const std::string& manifest_xml) { // Start up the xml parser with the manifest_xml contents. ScopedXmlDocument document(xmlParseDoc( - reinterpret_cast<const xmlChar*>(manifest_xml.c_str()))); + reinterpret_cast<const xmlChar*>(response_xml.c_str()))); if (!document.get()) { ParseError("%s", xml_errors.c_str()); return false; diff --git a/chrome/browser/component_updater/update_manifest.h b/chrome/browser/component_updater/update_response.h index 109d60a..495fef4 100644 --- a/chrome/browser/component_updater/update_manifest.h +++ b/chrome/browser/component_updater/update_response.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_COMPONENT_UPDATER_UPDATE_MANIFEST_H_ -#define CHROME_BROWSER_COMPONENT_UPDATER_UPDATE_MANIFEST_H_ +#ifndef CHROME_BROWSER_COMPONENT_UPDATER_UPDATE_RESPONSE_H_ +#define CHROME_BROWSER_COMPONENT_UPDATER_UPDATE_RESPONSE_H_ #include <string> #include <vector> @@ -15,7 +15,7 @@ namespace component_updater { // Parses responses for the update protocol version 3. // (http://code.google.com/p/omaha/wiki/ServerProtocol) // -// An update manifest looks like this: +// An update response looks like this: // // <?xml version="1.0" encoding="UTF-8"?> // <response protocol="3.0" server="prod"> @@ -54,9 +54,9 @@ namespace component_updater { // // The diff data members correspond to the differential update package, if // a differential update is specified in the response. -class UpdateManifest { +class UpdateResponse { public: - // The result of parsing one <app> tag in an xml update check manifest. + // The result of parsing one <app> tag in an xml update check response. struct Result { struct Manifest { struct Package { @@ -106,10 +106,10 @@ class UpdateManifest { std::vector<Result> list; }; - UpdateManifest(); - ~UpdateManifest(); + UpdateResponse(); + ~UpdateResponse(); - // Parses an update manifest xml string into Result data. Returns a bool + // Parses an update response xml string into Result data. Returns a bool // indicating success or failure. On success, the results are available by // calling results(). The details for any failures are available by calling // errors(). @@ -125,10 +125,10 @@ class UpdateManifest { // Adds parse error details to |errors_| string. void ParseError(const char* details, ...); - DISALLOW_COPY_AND_ASSIGN(UpdateManifest); + DISALLOW_COPY_AND_ASSIGN(UpdateResponse); }; } // namespace component_updater -#endif // CHROME_BROWSER_COMPONENT_UPDATER_UPDATE_MANIFEST_H_ +#endif // CHROME_BROWSER_COMPONENT_UPDATER_UPDATE_RESPONSE_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 962ac8a..4e7ea9e 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -433,6 +433,8 @@ 'browser/component_updater/component_updater_configurator.h', 'browser/component_updater/component_unpacker.cc', 'browser/component_updater/component_unpacker.h', + 'browser/component_updater/update_response.cc', + 'browser/component_updater/update_response.h', 'browser/component_updater/component_updater_ping_manager.cc', 'browser/component_updater/component_updater_ping_manager.h', 'browser/component_updater/component_updater_service.cc', @@ -454,8 +456,6 @@ 'browser/component_updater/recovery_component_installer.h', 'browser/component_updater/swiftshader_component_installer.cc', 'browser/component_updater/swiftshader_component_installer.h', - 'browser/component_updater/update_manifest.cc', - 'browser/component_updater/update_manifest.h', 'browser/component_updater/widevine_cdm_component_installer.cc', 'browser/component_updater/widevine_cdm_component_installer.h', 'browser/content_settings/content_settings_default_provider.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index ddc4a47..741c7a6 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -759,7 +759,7 @@ 'browser/component_updater/test/component_patcher_unittest.cc', 'browser/component_updater/test/component_updater_service_unittest.cc', 'browser/component_updater/test/test_installer.cc', - 'browser/component_updater/test/component_updater_manifest_unittest.cc', + 'browser/component_updater/test/update_response_unittest.cc', 'browser/component_updater/test/url_request_post_interceptor.cc', 'browser/content_settings/content_settings_default_provider_unittest.cc', 'browser/content_settings/content_settings_mock_observer.cc', |