diff options
54 files changed, 363 insertions, 350 deletions
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 240f3cd..27d4b55 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -92,7 +92,6 @@ static_library("browser") { "//components/metrics/proto:proto", "//components/navigation_metrics", "//components/network_time", - "//components/omaha_client", "//components/omnibox", "//components/os_crypt", "//components/password_manager/core/browser", @@ -113,6 +112,7 @@ static_library("browser") { "//components/translate/core/browser", "//components/translate/core/common", "//components/ui/zoom:ui_zoom", + "//components/update_client", "//components/url_fixer", "//components/user_prefs", "//components/variations", diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index c577666..923e246 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -49,7 +49,6 @@ include_rules = [ "+components/navigation_interception", "+components/navigation_metrics", "+components/network_time", - "+components/omaha_client", "+components/omnibox", "+components/os_crypt", "+components/password_manager", @@ -77,6 +76,7 @@ include_rules = [ "+components/translate/core/browser", "+components/translate/core/common", "+components/ui", + "+components/update_client", "+components/url_matcher", "+components/user_manager", "+components/user_prefs", diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index fa4bc86..8870d79 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -45,7 +45,6 @@ #include "chrome/browser/net/chrome_net_log.h" #include "chrome/browser/net/crl_set_fetcher.h" #include "chrome/browser/notifications/notification_ui_manager.h" -#include "chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h" #include "chrome/browser/plugins/chrome_plugin_service_filter.h" #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/prefs/browser_prefs.h" @@ -62,6 +61,7 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/user_manager.h" +#include "chrome/browser/update_client/chrome_update_query_params_delegate.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" @@ -76,10 +76,10 @@ #include "components/gcm_driver/gcm_driver.h" #include "components/metrics/metrics_service.h" #include "components/network_time/network_time_tracker.h" -#include "components/omaha_client/omaha_query_params.h" #include "components/policy/core/common/policy_service.h" #include "components/signin/core/common/profile_management_switches.h" #include "components/translate/core/browser/translate_download_manager.h" +#include "components/update_client/update_query_params.h" #include "components/web_resource/web_resource_pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" @@ -221,8 +221,8 @@ BrowserProcessImpl::BrowserProcessImpl( message_center::MessageCenter::Initialize(); - omaha_client::OmahaQueryParams::SetDelegate( - ChromeOmahaQueryParamsDelegate::GetInstance()); + update_client::UpdateQueryParams::SetDelegate( + ChromeUpdateQueryParamsDelegate::GetInstance()); } BrowserProcessImpl::~BrowserProcessImpl() { diff --git a/chrome/browser/component_updater/chrome_component_updater_configurator.cc b/chrome/browser/component_updater/chrome_component_updater_configurator.cc index aac305a..efaa772 100644 --- a/chrome/browser/component_updater/chrome_component_updater_configurator.cc +++ b/chrome/browser/component_updater/chrome_component_updater_configurator.cc @@ -17,7 +17,7 @@ #endif // OS_WIN #include "build/build_config.h" #include "chrome/browser/component_updater/component_patcher_operation_out_of_process.h" -#include "chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h" +#include "chrome/browser/update_client/chrome_update_query_params_delegate.h" #include "chrome/common/chrome_version_info.h" #include "components/component_updater/component_updater_configurator.h" #include "components/component_updater/component_updater_switches.h" @@ -232,11 +232,11 @@ base::Version ChromeConfigurator::GetBrowserVersion() const { } std::string ChromeConfigurator::GetChannel() const { - return ChromeOmahaQueryParamsDelegate::GetChannelString(); + return ChromeUpdateQueryParamsDelegate::GetChannelString(); } std::string ChromeConfigurator::GetLang() const { - return ChromeOmahaQueryParamsDelegate::GetLang(); + return ChromeUpdateQueryParamsDelegate::GetLang(); } std::string ChromeConfigurator::GetOSLongName() const { diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc index d20f75e..25c74b7 100644 --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc @@ -28,11 +28,11 @@ #include "chrome/common/chrome_paths.h" #include "components/component_updater/component_updater_service.h" #include "components/nacl/common/nacl_switches.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; -using omaha_client::OmahaQueryParams; +using update_client::UpdateQueryParams; namespace component_updater { @@ -82,7 +82,7 @@ void CheckVersionCompatiblity(const base::Version& current_version) { // PNaCl is packaged as a multi-CRX. This returns the platform-specific // subdirectory that is part of that multi-CRX. base::FilePath GetPlatformDir(const base::FilePath& base_path) { - std::string arch = SanitizeForPath(OmahaQueryParams::GetNaclArch()); + std::string arch = SanitizeForPath(UpdateQueryParams::GetNaclArch()); return base_path.AppendASCII("_platform_specific").AppendASCII(arch); } @@ -191,9 +191,9 @@ bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest, LOG(WARNING) << "'pnacl-arch' field is missing from pnacl-manifest!"; return false; } - if (arch.compare(OmahaQueryParams::GetNaclArch()) != 0) { + if (arch.compare(UpdateQueryParams::GetNaclArch()) != 0) { LOG(WARNING) << "'pnacl-arch' field in manifest is invalid (" << arch - << " vs " << OmahaQueryParams::GetNaclArch() << ")"; + << " vs " << UpdateQueryParams::GetNaclArch() << ")"; return false; } diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 0a4584a..5625d79 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn @@ -46,10 +46,10 @@ static_library("extensions") { "//chrome/installer/util", "//components/copresence", "//components/history/core/browser:proto", - "//components/omaha_client", "//components/onc", "//components/proximity_auth", "//components/strings", + "//components/update_client", "//components/url_matcher", "//content/app/resources", "//content/public/common", diff --git a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc index 9d9ce57..72cc78b 100644 --- a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc +++ b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc @@ -4,6 +4,9 @@ #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h" +#include <string> +#include <utility> + #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/time/time.h" @@ -13,7 +16,7 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/notification_types.h" @@ -181,7 +184,7 @@ void ChromeRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { } bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { - const char* os = omaha_client::OmahaQueryParams::GetOS(); + const char* os = update_client::UpdateQueryParams::GetOS(); if (strcmp(os, "mac") == 0) { info->os = PlatformInfo::OS_MAC_; } else if (strcmp(os, "win") == 0) { @@ -197,7 +200,7 @@ bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { return false; } - const char* arch = omaha_client::OmahaQueryParams::GetArch(); + const char* arch = update_client::UpdateQueryParams::GetArch(); if (strcmp(arch, "arm") == 0) { info->arch = PlatformInfo::ARCH_ARM; } else if (strcmp(arch, "x86") == 0) { @@ -209,7 +212,7 @@ bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { return false; } - const char* nacl_arch = omaha_client::OmahaQueryParams::GetNaclArch(); + const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch(); if (strcmp(nacl_arch, "arm") == 0) { info->nacl_arch = PlatformInfo::NACL_ARCH_ARM; } else if (strcmp(nacl_arch, "x86-32") == 0) { diff --git a/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc b/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc index 36b76dd..0e2d906 100644 --- a/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc +++ b/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc @@ -4,6 +4,8 @@ #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory.h" +#include <string> + #include "chrome/browser/google/google_brand.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/profiles/profile.h" @@ -11,14 +13,14 @@ #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" -#include "components/omaha_client/omaha_query_params.h" #include "components/signin/core/browser/signin_manager.h" +#include "components/update_client/update_query_params.h" #include "extensions/browser/updater/extension_downloader.h" #include "google_apis/gaia/identity_provider.h" using extensions::ExtensionDownloader; using extensions::ExtensionDownloaderDelegate; -using omaha_client::OmahaQueryParams; +using update_client::UpdateQueryParams; scoped_ptr<ExtensionDownloader> ChromeExtensionDownloaderFactory::CreateForRequestContext( @@ -33,7 +35,7 @@ ChromeExtensionDownloaderFactory::CreateForRequestContext( downloader->set_brand_code(brand); #endif // defined(GOOGLE_CHROME_BUILD) downloader->set_manifest_query_params( - OmahaQueryParams::Get(OmahaQueryParams::CRX)); + UpdateQueryParams::Get(UpdateQueryParams::CRX)); downloader->set_ping_enabled_domain("google.com"); downloader->set_enable_extra_update_metrics( ChromeMetricsServiceAccessor::IsMetricsReportingEnabled()); diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index 6561c75..0a373a9 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <set> +#include <vector> #include "base/bind.h" #include "base/files/file_util.h" @@ -22,7 +23,7 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/pending_extension_manager.h" #include "chrome/browser/profiles/profile.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" @@ -44,7 +45,7 @@ using base::TimeDelta; using content::BrowserThread; using extensions::Extension; using extensions::ExtensionSet; -using omaha_client::OmahaQueryParams; +using update_client::UpdateQueryParams; typedef extensions::ExtensionDownloaderDelegate::Error Error; typedef extensions::ExtensionDownloaderDelegate::PingResult PingResult; @@ -127,7 +128,7 @@ void DetermineForcedUpdatesOnBlockingPool( std::string nacl_arch; if (p->GetString(extensions::manifest_keys::kNaClArch, &nacl_arch) && - nacl_arch == OmahaQueryParams::GetNaclArch()) { + nacl_arch == UpdateQueryParams::GetNaclArch()) { std::string subpath; if (p->GetString(extensions::manifest_keys::kSubPackagePath, &subpath)) { @@ -145,7 +146,7 @@ void DetermineForcedUpdatesOnBlockingPool( if (force) forced_updates->insert(extension->id()); - } + } } BrowserThread::PostTask( BrowserThread::UI, diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index ff6d808..b1e2f51 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -36,7 +36,7 @@ #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/test/base/testing_profile.h" #include "components/crx_file/id_util.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -76,7 +76,7 @@ using base::Time; using base::TimeDelta; using content::BrowserThread; -using omaha_client::OmahaQueryParams; +using update_client::UpdateQueryParams; using testing::DoAll; using testing::Invoke; using testing::InvokeWithoutArgs; @@ -618,7 +618,7 @@ static void VerifyQueryAndExtractParameters( std::map<std::string, std::string> params; ExtractParameters(query, ¶ms); - std::string omaha_params = OmahaQueryParams::Get(OmahaQueryParams::CRX); + std::string omaha_params = UpdateQueryParams::Get(UpdateQueryParams::CRX); std::map<std::string, std::string> expected; ExtractParameters(omaha_params, &expected); @@ -1896,10 +1896,8 @@ class ExtensionUpdaterTest : public testing::Test { scoped_ptr<TestExtensionPrefs> prefs_; ManifestFetchData* CreateManifestFetchData(const GURL& update_url) { - return new ManifestFetchData(update_url, - 0, - "", - OmahaQueryParams::Get(OmahaQueryParams::CRX), + return new ManifestFetchData(update_url, 0, "", + UpdateQueryParams::Get(UpdateQueryParams::CRX), ManifestFetchData::PING); } @@ -2187,9 +2185,11 @@ TEST_F(ExtensionUpdaterTest, TestStartUpdateCheckMemory) { MockExtensionDownloaderDelegate delegate; ExtensionDownloader downloader(&delegate, service.request_context()); - StartUpdateCheck(&downloader, CreateManifestFetchData(GURL("http://localhost/foo"))); + StartUpdateCheck(&downloader, + CreateManifestFetchData(GURL("http://localhost/foo"))); // This should delete the newly-created ManifestFetchData. - StartUpdateCheck(&downloader, CreateManifestFetchData(GURL("http://localhost/foo"))); + StartUpdateCheck(&downloader, + CreateManifestFetchData(GURL("http://localhost/foo"))); // This should add into |manifests_pending_|. StartUpdateCheck(&downloader, CreateManifestFetchData(GURL("http://www.google.com"))); diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 1ec913ef..a4f84a5 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/webstore_installer.h" +#include <set> #include <vector> #include "base/basictypes.h" @@ -33,7 +34,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "components/crx_file/id_util.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/download_save_info.h" @@ -199,8 +200,8 @@ GURL WebstoreInstaller::GetWebstoreInstallURL( std::string url_string = extension_urls::GetWebstoreUpdateUrl().spec(); GURL url(url_string + "?response=redirect&" + - omaha_client::OmahaQueryParams::Get( - omaha_client::OmahaQueryParams::CRX) + + update_client::UpdateQueryParams::Get( + update_client::UpdateQueryParams::CRX) + "&x=" + net::EscapeQueryParamValue(JoinString(params, '&'), true)); DCHECK(url.is_valid()); diff --git a/chrome/browser/extensions/webstore_installer_unittest.cc b/chrome/browser/extensions/webstore_installer_unittest.cc index 7b2aa59..e61084a 100644 --- a/chrome/browser/extensions/webstore_installer_unittest.cc +++ b/chrome/browser/extensions/webstore_installer_unittest.cc @@ -6,14 +6,14 @@ #include "base/strings/stringprintf.h" #include "chrome/browser/extensions/webstore_installer.h" -#include "chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h" +#include "chrome/browser/update_client/chrome_update_query_params_delegate.h" #include "components/crx_file/id_util.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "net/base/escape.h" #include "testing/gtest/include/gtest/gtest.h" using base::StringPrintf; -using omaha_client::OmahaQueryParams; +using update_client::UpdateQueryParams; namespace extensions { @@ -29,18 +29,18 @@ TEST(WebstoreInstallerTest, PlatformParams) { WebstoreInstaller::INSTALL_SOURCE_INLINE); std::string query = url.query(); EXPECT_TRUE( - Contains(query, StringPrintf("os=%s", OmahaQueryParams::GetOS()))); + Contains(query, StringPrintf("os=%s", UpdateQueryParams::GetOS()))); EXPECT_TRUE( - Contains(query, StringPrintf("arch=%s", OmahaQueryParams::GetArch()))); + Contains(query, StringPrintf("arch=%s", UpdateQueryParams::GetArch()))); EXPECT_TRUE(Contains( - query, StringPrintf("nacl_arch=%s", OmahaQueryParams::GetNaclArch()))); + query, StringPrintf("nacl_arch=%s", UpdateQueryParams::GetNaclArch()))); EXPECT_TRUE( Contains(query, net::EscapeQueryParamValue( StringPrintf("installsource=%s", source.c_str()), true))); EXPECT_TRUE(Contains( query, - StringPrintf("lang=%s", ChromeOmahaQueryParamsDelegate::GetLang()))); + StringPrintf("lang=%s", ChromeUpdateQueryParamsDelegate::GetLang()))); } } // namespace extensions diff --git a/chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h b/chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h deleted file mode 100644 index 43f3965..0000000 --- a/chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_OMAHA_CLIENT_CHROME_OMAHA_QUERY_PARAMS_DELEGATE_H_ -#define CHROME_BROWSER_OMAHA_CLIENT_CHROME_OMAHA_QUERY_PARAMS_DELEGATE_H_ - -#include "components/omaha_client/omaha_query_params_delegate.h" - -class ChromeOmahaQueryParamsDelegate - : public omaha_client::OmahaQueryParamsDelegate { - public: - ChromeOmahaQueryParamsDelegate(); - ~ChromeOmahaQueryParamsDelegate() override; - - // Gets the LazyInstance for ChromeOmahaQueryParamsDelegate. - static ChromeOmahaQueryParamsDelegate* GetInstance(); - - // omaha_client::OmahaQueryParamsDelegate: - std::string GetExtraParams() override; - - // Returns the value we use for the "updaterchannel=" and "prodchannel=" - // parameters. Possible return values include: "canary", "dev", "beta", and - // "stable". - static const char* GetChannelString(); - - // Returns the language for the present locale. Possible return values are - // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc. - static const char* GetLang(); - - private: - DISALLOW_COPY_AND_ASSIGN(ChromeOmahaQueryParamsDelegate); -}; - -#endif // CHROME_BROWSER_OMAHA_CLIENT_CHROME_OMAHA_QUERY_PARAMS_DELEGATE_H_ diff --git a/chrome/browser/omaha_client/chrome_omaha_query_params_delegate_unittest.cc b/chrome/browser/omaha_client/chrome_omaha_query_params_delegate_unittest.cc deleted file mode 100644 index 9f3aa13..0000000 --- a/chrome/browser/omaha_client/chrome_omaha_query_params_delegate_unittest.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/strings/stringprintf.h" -#include "chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h" -#include "chrome/common/chrome_version_info.h" -#include "components/omaha_client/omaha_query_params.h" -#include "testing/gtest/include/gtest/gtest.h" - -using base::StringPrintf; - -namespace { - -bool Contains(const std::string& source, const std::string& target) { - return source.find(target) != std::string::npos; -} - -} // namespace - -void TestParams(omaha_client::OmahaQueryParams::ProdId prod_id) { - std::string params = omaha_client::OmahaQueryParams::Get(prod_id); - - EXPECT_TRUE(Contains( - params, - StringPrintf("os=%s", omaha_client::OmahaQueryParams::GetOS()))); - EXPECT_TRUE( - Contains(params, - StringPrintf("arch=%s", - omaha_client::OmahaQueryParams::GetArch()))); - EXPECT_TRUE(Contains( - params, - StringPrintf( - "prod=%s", - omaha_client::OmahaQueryParams::GetProdIdString(prod_id)))); - EXPECT_TRUE(Contains( - params, - StringPrintf("prodchannel=%s", - ChromeOmahaQueryParamsDelegate::GetChannelString()))); - EXPECT_TRUE(Contains( - params, - StringPrintf("prodversion=%s", chrome::VersionInfo().Version().c_str()))); - EXPECT_TRUE(Contains( - params, - StringPrintf("lang=%s", ChromeOmahaQueryParamsDelegate::GetLang()))); -} - -TEST(ChromeOmahaQueryParamsDelegateTest, GetParams) { - TestParams(omaha_client::OmahaQueryParams::CRX); - TestParams(omaha_client::OmahaQueryParams::CHROME); -} diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 6ca4613..66f1070 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -50,11 +50,11 @@ static_library("ui") { "//components/feedback/proto", "//components/history/core/browser:proto", "//components/invalidation", - "//components/omaha_client", "//components/onc", "//components/password_manager/core/browser", "//components/resources", "//components/strings", + "//components/update_client", "//content/public/browser", "//content/public/common", "//crypto", diff --git a/chrome/browser/ui/webui/app_list/start_page_handler.cc b/chrome/browser/ui/webui/app_list/start_page_handler.cc index 70a215c..57bc177 100644 --- a/chrome/browser/ui/webui/app_list/start_page_handler.cc +++ b/chrome/browser/ui/webui/app_list/start_page_handler.cc @@ -19,7 +19,7 @@ #include "chrome/browser/ui/host_desktop.h" #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" #include "chrome/common/pref_names.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/web_ui.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" @@ -191,7 +191,7 @@ void StartPageHandler::HandleInitialize(const base::ListValue* args) { base::Version(kOldHotwordExtensionVersionString)) <= 0) { web_ui()->CallJavascriptFunction( "appList.startPage.setNaclArch", - base::StringValue(omaha_client::OmahaQueryParams::GetNaclArch())); + base::StringValue(update_client::UpdateQueryParams::GetNaclArch())); } #endif diff --git a/chrome/browser/omaha_client/OWNERS b/chrome/browser/update_client/OWNERS index c089b54..c089b54 100644 --- a/chrome/browser/omaha_client/OWNERS +++ b/chrome/browser/update_client/OWNERS diff --git a/chrome/browser/omaha_client/chrome_omaha_query_params_delegate.cc b/chrome/browser/update_client/chrome_update_query_params_delegate.cc index ef32618..fdb8038 100644 --- a/chrome/browser/omaha_client/chrome_omaha_query_params_delegate.cc +++ b/chrome/browser/update_client/chrome_update_query_params_delegate.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/omaha_client/chrome_omaha_query_params_delegate.h" +#include "chrome/browser/update_client/chrome_update_query_params_delegate.h" #include "base/lazy_instance.h" #include "base/strings/stringprintf.h" @@ -17,31 +17,31 @@ const char kBeta[] = "beta"; const char kDev[] = "dev"; const char kCanary[] = "canary"; -base::LazyInstance<ChromeOmahaQueryParamsDelegate> g_delegate = +base::LazyInstance<ChromeUpdateQueryParamsDelegate> g_delegate = LAZY_INSTANCE_INITIALIZER; } // namespace -ChromeOmahaQueryParamsDelegate::ChromeOmahaQueryParamsDelegate() { +ChromeUpdateQueryParamsDelegate::ChromeUpdateQueryParamsDelegate() { } -ChromeOmahaQueryParamsDelegate::~ChromeOmahaQueryParamsDelegate() { +ChromeUpdateQueryParamsDelegate::~ChromeUpdateQueryParamsDelegate() { } // static -ChromeOmahaQueryParamsDelegate* ChromeOmahaQueryParamsDelegate::GetInstance() { +ChromeUpdateQueryParamsDelegate* +ChromeUpdateQueryParamsDelegate::GetInstance() { return g_delegate.Pointer(); } -std::string ChromeOmahaQueryParamsDelegate::GetExtraParams() { +std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() { return base::StringPrintf("&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString(), - chrome::VersionInfo().Version().c_str(), - GetLang()); + chrome::VersionInfo().Version().c_str(), GetLang()); } // static -const char* ChromeOmahaQueryParamsDelegate::GetChannelString() { +const char* ChromeUpdateQueryParamsDelegate::GetChannelString() { switch (chrome::VersionInfo::GetChannel()) { case chrome::VersionInfo::CHANNEL_STABLE: return kStable; @@ -63,6 +63,6 @@ const char* ChromeOmahaQueryParamsDelegate::GetChannelString() { } // static -const char* ChromeOmahaQueryParamsDelegate::GetLang() { +const char* ChromeUpdateQueryParamsDelegate::GetLang() { return g_browser_process->GetApplicationLocale().c_str(); } diff --git a/chrome/browser/update_client/chrome_update_query_params_delegate.h b/chrome/browser/update_client/chrome_update_query_params_delegate.h new file mode 100644 index 0000000..a90bdc3 --- /dev/null +++ b/chrome/browser/update_client/chrome_update_query_params_delegate.h @@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UPDATE_CLIENT_CHROME_UPDATE_QUERY_PARAMS_DELEGATE_H_ +#define CHROME_BROWSER_UPDATE_CLIENT_CHROME_UPDATE_QUERY_PARAMS_DELEGATE_H_ + +#include <string> + +#include "components/update_client/update_query_params_delegate.h" + +class ChromeUpdateQueryParamsDelegate + : public update_client::UpdateQueryParamsDelegate { + public: + ChromeUpdateQueryParamsDelegate(); + ~ChromeUpdateQueryParamsDelegate() override; + + // Gets the LazyInstance for ChromeUpdateQueryParamsDelegate. + static ChromeUpdateQueryParamsDelegate* GetInstance(); + + // update_client::UpdateQueryParamsDelegate: + std::string GetExtraParams() override; + + // Returns the value we use for the "updaterchannel=" and "prodchannel=" + // parameters. Possible return values include: "canary", "dev", "beta", and + // "stable". + static const char* GetChannelString(); + + // Returns the language for the present locale. Possible return values are + // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc. + static const char* GetLang(); + + private: + DISALLOW_COPY_AND_ASSIGN(ChromeUpdateQueryParamsDelegate); +}; + +#endif // CHROME_BROWSER_UPDATE_CLIENT_CHROME_UPDATE_QUERY_PARAMS_DELEGATE_H_ diff --git a/chrome/browser/update_client/chrome_update_query_params_delegate_unittest.cc b/chrome/browser/update_client/chrome_update_query_params_delegate_unittest.cc new file mode 100644 index 0000000..76026d3 --- /dev/null +++ b/chrome/browser/update_client/chrome_update_query_params_delegate_unittest.cc @@ -0,0 +1,51 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <string> + +#include "base/strings/stringprintf.h" +#include "chrome/browser/update_client/chrome_update_query_params_delegate.h" +#include "chrome/common/chrome_version_info.h" +#include "components/update_client/update_query_params.h" +#include "testing/gtest/include/gtest/gtest.h" + +using base::StringPrintf; + +namespace { + +bool Contains(const std::string& source, const std::string& target) { + return source.find(target) != std::string::npos; +} + +} // namespace + +void TestParams(update_client::UpdateQueryParams::ProdId prod_id) { + std::string params = update_client::UpdateQueryParams::Get(prod_id); + + EXPECT_TRUE(Contains( + params, + StringPrintf("os=%s", update_client::UpdateQueryParams::GetOS()))); + EXPECT_TRUE(Contains( + params, + StringPrintf("arch=%s", update_client::UpdateQueryParams::GetArch()))); + EXPECT_TRUE(Contains( + params, StringPrintf( + "prod=%s", + update_client::UpdateQueryParams::GetProdIdString(prod_id)))); + EXPECT_TRUE(Contains( + params, + StringPrintf("prodchannel=%s", + ChromeUpdateQueryParamsDelegate::GetChannelString()))); + EXPECT_TRUE(Contains( + params, + StringPrintf("prodversion=%s", chrome::VersionInfo().Version().c_str()))); + EXPECT_TRUE(Contains( + params, + StringPrintf("lang=%s", ChromeUpdateQueryParamsDelegate::GetLang()))); +} + +TEST(ChromeUpdateQueryParamsDelegateTest, GetParams) { + TestParams(update_client::UpdateQueryParams::CRX); + TestParams(update_client::UpdateQueryParams::CHROME); +} diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 27abb9a..eb837be 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -484,8 +484,6 @@ 'browser/memory_details_mac.cc', 'browser/memory_details_win.cc', 'browser/native_window_notification_source.h', - 'browser/omaha_client/chrome_omaha_query_params_delegate.cc', - 'browser/omaha_client/chrome_omaha_query_params_delegate.h', 'browser/omnibox/omnibox_log.cc', 'browser/omnibox/omnibox_log.h', 'browser/performance_monitor/performance_monitor.cc', @@ -666,6 +664,8 @@ 'browser/undo/bookmark_renumber_observer.h', 'browser/undo/undo_manager_observer.h', 'browser/undo/undo_operation.h', + 'browser/update_client/chrome_update_query_params_delegate.cc', + 'browser/update_client/chrome_update_query_params_delegate.h', 'browser/upgrade_detector.cc', 'browser/upgrade_detector.h', 'browser/upload_list.cc', @@ -2897,7 +2897,6 @@ '../components/components.gyp:metrics_profiler', '../components/components.gyp:navigation_metrics', '../components/components.gyp:network_time', - '../components/components.gyp:omaha_client', '../components/components.gyp:omnibox', '../components/components.gyp:os_crypt', '../components/components.gyp:password_manager_core_browser', @@ -2916,6 +2915,7 @@ '../components/components.gyp:sync_driver', '../components/components.gyp:translate_core_browser', '../components/components.gyp:translate_core_common', + '../components/components.gyp:update_client', '../components/components.gyp:url_fixer', '../components/components.gyp:user_prefs', '../components/components.gyp:wallpaper', diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 4cb3be8..e1053d3 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -924,9 +924,9 @@ 'safe_browsing_proto', '../components/components.gyp:copresence', '../components/components.gyp:history_core_browser_proto', - '../components/components.gyp:omaha_client', '../components/components.gyp:onc_component', '../components/components.gyp:proximity_auth', + '../components/components.gyp:update_client', '../components/components.gyp:url_matcher', '../components/components_strings.gyp:components_strings', '../content/app/resources/content_resources.gyp:content_resources', diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 9223e5f..93f0db7 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2671,10 +2671,10 @@ '../components/components.gyp:feedback_proto', '../components/components.gyp:history_core_browser_proto', '../components/components.gyp:invalidation', - '../components/components.gyp:omaha_client', '../components/components.gyp:onc_component', '../components/components.gyp:password_manager_core_browser', '../components/components.gyp:ui_zoom', + '../components/components.gyp:update_client', '../components/components_resources.gyp:components_resources', '../components/components_strings.gyp:components_strings', '../content/content.gyp:content_browser', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 8c79455..2b893c1 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -562,7 +562,6 @@ 'browser/notifications/message_center_settings_controller_unittest.cc', 'browser/notifications/notification_conversion_helper_unittest.cc', 'browser/notifications/platform_notification_service_unittest.cc', - 'browser/omaha_client/chrome_omaha_query_params_delegate_unittest.cc', 'browser/password_manager/chrome_password_manager_client_unittest.cc', 'browser/password_manager/native_backend_kwallet_x_unittest.cc', 'browser/password_manager/password_manager_internals_service_unittest.cc', @@ -1259,6 +1258,7 @@ 'browser/undo/bookmark_undo_service_test.cc', 'browser/undo/undo_manager_test.cc', 'browser/upgrade_detector_impl_unittest.cc', + 'browser/update_client/chrome_update_query_params_delegate_unittest.cc', 'browser/upload_list_unittest.cc', 'browser/web_applications/web_app_mac_unittest.mm', 'browser/web_applications/web_app_unittest.cc', diff --git a/chrome/test/base/chrome_unit_test_suite.cc b/chrome/test/base/chrome_unit_test_suite.cc index 43425767..c78d463 100644 --- a/chrome/test/base/chrome_unit_test_suite.cc +++ b/chrome/test/base/chrome_unit_test_suite.cc @@ -8,15 +8,15 @@ #include "base/process/process_handle.h" #include "base/strings/stringprintf.h" #include "chrome/browser/chrome_content_browser_client.h" -#include "chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h" +#include "chrome/browser/update_client/chrome_update_query_params_delegate.h" #include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/utility/chrome_content_utility_client.h" #include "components/component_updater/component_updater_paths.h" -#include "components/omaha_client/omaha_query_params.h" #include "components/translate/content/browser/browser_cld_data_provider_factory.h" #include "components/translate/content/common/cld_data_source.h" +#include "components/update_client/update_query_params.h" #include "content/public/common/content_paths.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/resource/resource_bundle.h" @@ -49,7 +49,7 @@ class ChromeUnitTestSuiteInitializer : public testing::EmptyTestEventListener { ChromeUnitTestSuiteInitializer() {} virtual ~ChromeUnitTestSuiteInitializer() {} - virtual void OnTestStart(const testing::TestInfo& test_info) override { + void OnTestStart(const testing::TestInfo& test_info) override { content_client_.reset(new ChromeContentClient); content::SetContentClient(content_client_.get()); // TODO(ios): Bring this back once ChromeContentBrowserClient is building. @@ -63,7 +63,7 @@ class ChromeUnitTestSuiteInitializer : public testing::EmptyTestEventListener { TestingBrowserProcess::CreateInstance(); } - virtual void OnTestEnd(const testing::TestInfo& test_info) override { + void OnTestEnd(const testing::TestInfo& test_info) override { // TODO(ios): Bring this back once ChromeContentBrowserClient is building. #if !defined(OS_IOS) browser_content_client_.reset(); @@ -149,8 +149,8 @@ void ChromeUnitTestSuite::InitializeProviders() { gfx::GLSurface::InitializeOneOffForTests(); - omaha_client::OmahaQueryParams::SetDelegate( - ChromeOmahaQueryParamsDelegate::GetInstance()); + update_client::UpdateQueryParams::SetDelegate( + ChromeUpdateQueryParamsDelegate::GetInstance()); #endif } diff --git a/components/BUILD.gn b/components/BUILD.gn index 3933e39..dad4b80 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -55,7 +55,6 @@ group("all_components") { "//components/navigation_interception", "//components/navigation_metrics", "//components/network_time", - "//components/omaha_client", "//components/omnibox", "//components/onc", "//components/os_crypt", @@ -93,6 +92,7 @@ group("all_components") { "//components/translate/core/browser", "//components/translate/core/common", "//components/ui/zoom:ui_zoom", + "//components/update_client", "//components/url_fixer", "//components/url_matcher", "//components/user_manager", diff --git a/components/component_updater.gypi b/components/component_updater.gypi index c4e5589..bdec48c 100644 --- a/components/component_updater.gypi +++ b/components/component_updater.gypi @@ -18,7 +18,7 @@ '../ui/base/ui_base.gyp:ui_base', '../url/url.gyp:url_lib', 'crx_file', - 'omaha_client', + 'update_client', ], 'include_dirs': [ '..', diff --git a/components/component_updater/BUILD.gn b/components/component_updater/BUILD.gn index e8f6b7d..2f26cf6 100644 --- a/components/component_updater/BUILD.gn +++ b/components/component_updater/BUILD.gn @@ -43,7 +43,7 @@ source_set("component_updater") { deps = [ "//base", "//components/crx_file", - "//components/omaha_client", + "//components/update_client", "//courgette:courgette_lib", "//crypto", "//third_party/libxml", diff --git a/components/component_updater/DEPS b/components/component_updater/DEPS index 4cd206c..df47cfc 100644 --- a/components/component_updater/DEPS +++ b/components/component_updater/DEPS @@ -1,6 +1,6 @@ include_rules = [ "+components/crx_file", - "+components/omaha_client", + "+components/update_client", "+courgette", "+crypto", "+libxml", diff --git a/components/component_updater/component_updater_utils.cc b/components/component_updater/component_updater_utils.cc index 4bd8c55..56e33ac 100644 --- a/components/component_updater/component_updater_utils.cc +++ b/components/component_updater/component_updater_utils.cc @@ -19,13 +19,13 @@ #include "components/component_updater/component_updater_configurator.h" #include "components/component_updater/crx_update_item.h" #include "components/crx_file/id_util.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "net/base/load_flags.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_status.h" -using omaha_client::OmahaQueryParams; +using update_client::UpdateQueryParams; namespace component_updater { @@ -66,7 +66,7 @@ std::string BuildProtocolRequest(const std::string& browser_version, const std::string& request_body, const std::string& additional_attributes) { const std::string prod_id( - OmahaQueryParams::GetProdIdString(OmahaQueryParams::CHROME)); + UpdateQueryParams::GetProdIdString(UpdateQueryParams::CHROME)); std::string request( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" @@ -82,15 +82,15 @@ std::string BuildProtocolRequest(const std::string& browser_version, "requestid=\"{%s}\" lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"", prod_id.c_str(), - browser_version.c_str(), // "version" - browser_version.c_str(), // "prodversion" - base::GenerateGUID().c_str(), // "requestid" - lang.c_str(), // "lang", - channel.c_str(), // "updaterchannel" - channel.c_str(), // "prodchannel" - OmahaQueryParams::GetOS(), // "os" - OmahaQueryParams::GetArch(), // "arch" - OmahaQueryParams::GetNaclArch()); // "nacl_arch" + browser_version.c_str(), // "version" + browser_version.c_str(), // "prodversion" + base::GenerateGUID().c_str(), // "requestid" + lang.c_str(), // "lang", + channel.c_str(), // "updaterchannel" + channel.c_str(), // "prodchannel" + UpdateQueryParams::GetOS(), // "os" + UpdateQueryParams::GetArch(), // "arch" + UpdateQueryParams::GetNaclArch()); // "nacl_arch" #if defined(OS_WIN) const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == base::win::OSInfo::WOW64_ENABLED); diff --git a/components/components.gyp b/components/components.gyp index ba936f5..f21dc39 100644 --- a/components/components.gyp +++ b/components/components.gyp @@ -40,7 +40,6 @@ 'metrics.gypi', 'navigation_metrics.gypi', 'network_time.gypi', - 'omaha_client.gypi', 'onc.gypi', 'os_crypt.gypi', 'ownership.gypi', @@ -58,6 +57,7 @@ 'suggestions.gypi', 'translate.gypi', 'ui_zoom.gypi', + 'update_client.gypi', 'url_fixer.gypi', 'url_matcher.gypi', 'user_prefs.gypi', diff --git a/components/components_tests.gyp b/components/components_tests.gyp index fba5778..492b126 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp @@ -178,7 +178,6 @@ 'metrics/profiler/profiler_metrics_provider_unittest.cc', 'navigation_interception/intercept_navigation_resource_throttle_unittest.cc', 'network_time/network_time_tracker_unittest.cc', - 'omaha_client/omaha_query_params_unittest.cc', 'omnibox/answers_cache_unittest.cc', 'omnibox/base_search_provider_unittest.cc', 'omnibox/autocomplete_input_unittest.cc', @@ -274,6 +273,7 @@ 'translate/ios/browser/js_translate_manager_unittest.mm', 'translate/ios/browser/language_detection_controller_unittest.mm', 'translate/ios/browser/translate_controller_unittest.mm', + 'update_client/update_query_params_unittest.cc', 'url_matcher/regex_set_matcher_unittest.cc', 'url_matcher/string_pattern_unittest.cc', 'url_matcher/substring_set_matcher_unittest.cc', @@ -422,9 +422,6 @@ # Dependencies of network_time 'components.gyp:network_time', - # Dependencies of omaha_client - 'components.gyp:omaha_client', - # Dependencies of omnibox 'components.gyp:omnibox', 'components.gyp:omnibox_test_support', @@ -485,6 +482,9 @@ # Dependencies of wallpaper 'components.gyp:wallpaper', + # Dependencies of update_client + 'components.gyp:update_client', + # Dependencies of url_fixer 'components.gyp:url_fixer', '../url/url.gyp:url_lib', diff --git a/components/omaha_client/omaha_query_params_delegate.cc b/components/omaha_client/omaha_query_params_delegate.cc deleted file mode 100644 index 1da1854..0000000 --- a/components/omaha_client/omaha_query_params_delegate.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/omaha_client/omaha_query_params_delegate.h" - -namespace omaha_client { - -OmahaQueryParamsDelegate::OmahaQueryParamsDelegate() { -} - -OmahaQueryParamsDelegate::~OmahaQueryParamsDelegate() { -} - -} // namespace omaha_client diff --git a/components/omaha_client/omaha_query_params_unittest.cc b/components/omaha_client/omaha_query_params_unittest.cc deleted file mode 100644 index f18e46d..0000000 --- a/components/omaha_client/omaha_query_params_unittest.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/strings/stringprintf.h" -#include "components/omaha_client/omaha_query_params.h" -#include "components/omaha_client/omaha_query_params_delegate.h" -#include "testing/gtest/include/gtest/gtest.h" - -using base::StringPrintf; - -namespace omaha_client { - -namespace { - -bool Contains(const std::string& source, const std::string& target) { - return source.find(target) != std::string::npos; -} - -class TestOmahaQueryParamsDelegate : public OmahaQueryParamsDelegate { - std::string GetExtraParams() override { return "&cat=dog"; } -}; - -} // namespace - -void TestParams(OmahaQueryParams::ProdId prod_id, bool extra_params) { - std::string params = OmahaQueryParams::Get(prod_id); - - // This doesn't so much test what the values are (since that would be an - // almost exact duplication of code with omaha_query_params.cc, and wouldn't - // really test anything) as it is a verification that all the params are - // present in the generated string. - EXPECT_TRUE( - Contains(params, StringPrintf("os=%s", OmahaQueryParams::GetOS()))); - EXPECT_TRUE( - Contains(params, StringPrintf("arch=%s", OmahaQueryParams::GetArch()))); - EXPECT_TRUE(Contains( - params, - StringPrintf("prod=%s", OmahaQueryParams::GetProdIdString(prod_id)))); - if (extra_params) - EXPECT_TRUE(Contains(params, "cat=dog")); -} - -TEST(OmahaQueryParamsTest, GetParams) { - TestParams(OmahaQueryParams::CRX, false); - TestParams(OmahaQueryParams::CHROME, false); - - TestOmahaQueryParamsDelegate delegate; - OmahaQueryParams::SetDelegate(&delegate); - - TestParams(OmahaQueryParams::CRX, true); - TestParams(OmahaQueryParams::CHROME, true); -} - -} // namespace omaha_client diff --git a/components/omaha_client.gypi b/components/update_client.gypi index b5b9a7c..58640eb 100644 --- a/components/omaha_client.gypi +++ b/components/update_client.gypi @@ -5,7 +5,7 @@ { 'targets': [ { - 'target_name': 'omaha_client', + 'target_name': 'update_client', 'type': 'static_library', 'include_dirs': [ '..', @@ -14,10 +14,10 @@ '../base/base.gyp:base', ], 'sources': [ - 'omaha_client/omaha_query_params.cc', - 'omaha_client/omaha_query_params.h', - 'omaha_client/omaha_query_params_delegate.cc', - 'omaha_client/omaha_query_params_delegate.h', + 'update_client/update_query_params.cc', + 'update_client/update_query_params.h', + 'update_client/update_query_params_delegate.cc', + 'update_client/update_query_params_delegate.h', ], }, ], diff --git a/components/omaha_client/BUILD.gn b/components/update_client/BUILD.gn index 3cb5e01..d51bd9d 100644 --- a/components/omaha_client/BUILD.gn +++ b/components/update_client/BUILD.gn @@ -2,12 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -source_set("omaha_client") { +source_set("update_client") { sources = [ - "omaha_query_params.cc", - "omaha_query_params.h", - "omaha_query_params_delegate.cc", - "omaha_query_params_delegate.h", + "update_query_params.cc", + "update_query_params.h", + "update_query_params_delegate.cc", + "update_query_params_delegate.h", ] deps = [ diff --git a/components/omaha_client/DEPS b/components/update_client/DEPS index beabace..beabace 100644 --- a/components/omaha_client/DEPS +++ b/components/update_client/DEPS diff --git a/components/omaha_client/OWNERS b/components/update_client/OWNERS index c089b54..c089b54 100644 --- a/components/omaha_client/OWNERS +++ b/components/update_client/OWNERS diff --git a/components/omaha_client/omaha_query_params.cc b/components/update_client/update_query_params.cc index 9abaa9d..7bb4db5 100644 --- a/components/omaha_client/omaha_query_params.cc +++ b/components/update_client/update_query_params.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "base/compiler_specific.h" #include "base/logging.h" #include "base/strings/stringprintf.h" #include "base/win/windows_version.h" -#include "components/omaha_client/omaha_query_params_delegate.h" +#include "components/update_client/update_query_params_delegate.h" -namespace omaha_client { +namespace update_client { namespace { @@ -58,28 +58,25 @@ const char kChromeCrx[] = "chromecrx"; const char kChromiumCrx[] = "chromiumcrx"; #endif // defined(GOOGLE_CHROME_BUILD) -OmahaQueryParamsDelegate* g_delegate = NULL; +UpdateQueryParamsDelegate* g_delegate = NULL; } // namespace // static -std::string OmahaQueryParams::Get(ProdId prod) { +std::string UpdateQueryParams::Get(ProdId prod) { return base::StringPrintf( - "os=%s&arch=%s&nacl_arch=%s&prod=%s%s", - kOs, - kArch, - GetNaclArch(), + "os=%s&arch=%s&nacl_arch=%s&prod=%s%s", kOs, kArch, GetNaclArch(), GetProdIdString(prod), g_delegate ? g_delegate->GetExtraParams().c_str() : ""); } // static -const char* OmahaQueryParams::GetProdIdString(OmahaQueryParams::ProdId prod) { +const char* UpdateQueryParams::GetProdIdString(UpdateQueryParams::ProdId prod) { switch (prod) { - case OmahaQueryParams::CHROME: + case UpdateQueryParams::CHROME: return kChrome; break; - case OmahaQueryParams::CRX: + case UpdateQueryParams::CRX: #if defined(GOOGLE_CHROME_BUILD) return kChromeCrx; #else @@ -91,17 +88,17 @@ const char* OmahaQueryParams::GetProdIdString(OmahaQueryParams::ProdId prod) { } // static -const char* OmahaQueryParams::GetOS() { +const char* UpdateQueryParams::GetOS() { return kOs; } // static -const char* OmahaQueryParams::GetArch() { +const char* UpdateQueryParams::GetArch() { return kArch; } // static -const char* OmahaQueryParams::GetNaclArch() { +const char* UpdateQueryParams::GetNaclArch() { #if defined(ARCH_CPU_X86_FAMILY) #if defined(ARCH_CPU_X86_64) return "x86-64"; @@ -126,9 +123,9 @@ const char* OmahaQueryParams::GetNaclArch() { } // static -void OmahaQueryParams::SetDelegate(OmahaQueryParamsDelegate* delegate) { +void UpdateQueryParams::SetDelegate(UpdateQueryParamsDelegate* delegate) { DCHECK(!g_delegate || !delegate); g_delegate = delegate; } -} // namespace omaha_client +} // namespace update_client diff --git a/components/omaha_client/omaha_query_params.h b/components/update_client/update_query_params.h index 7a4d792..48f7acf 100644 --- a/components/omaha_client/omaha_query_params.h +++ b/components/update_client/update_query_params.h @@ -2,23 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_OMAHA_CLIENT_OMAHA_QUERY_PARAMS_H_ -#define COMPONENTS_OMAHA_CLIENT_OMAHA_QUERY_PARAMS_H_ +#ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_ +#define COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_ #include <string> #include "base/basictypes.h" -namespace omaha_client { +namespace update_client { -class OmahaQueryParamsDelegate; +class UpdateQueryParamsDelegate; // Generates a string of URL query parameters to be used when getting // component and extension updates. These parameters generally remain // fixed for a particular build. Embedders can use the delegate to // define different implementations. This should be used only in the // browser process. -class OmahaQueryParams { +class UpdateQueryParams { public: enum ProdId { CHROME = 0, @@ -49,12 +49,12 @@ class OmahaQueryParams { static const char* GetNaclArch(); // Use this delegate. - static void SetDelegate(OmahaQueryParamsDelegate* delegate); + static void SetDelegate(UpdateQueryParamsDelegate* delegate); private: - DISALLOW_IMPLICIT_CONSTRUCTORS(OmahaQueryParams); + DISALLOW_IMPLICIT_CONSTRUCTORS(UpdateQueryParams); }; -} // namespace omaha_client +} // namespace update_client -#endif // COMPONENTS_OMAHA_CLIENT_OMAHA_QUERY_PARAMS_H_ +#endif // COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_ diff --git a/components/update_client/update_query_params_delegate.cc b/components/update_client/update_query_params_delegate.cc new file mode 100644 index 0000000..e14665a --- /dev/null +++ b/components/update_client/update_query_params_delegate.cc @@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/update_client/update_query_params_delegate.h" + +namespace update_client { + +UpdateQueryParamsDelegate::UpdateQueryParamsDelegate() { +} + +UpdateQueryParamsDelegate::~UpdateQueryParamsDelegate() { +} + +} // namespace update_client diff --git a/components/omaha_client/omaha_query_params_delegate.h b/components/update_client/update_query_params_delegate.h index ab52436..0dd97ff 100644 --- a/components/omaha_client/omaha_query_params_delegate.h +++ b/components/update_client/update_query_params_delegate.h @@ -2,31 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_OMAHA_CLIENT_OMAHA_QUERY_PARAMS_DELEGATE_H_ -#define COMPONENTS_OMAHA_CLIENT_OMAHA_QUERY_PARAMS_DELEGATE_H_ +#ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_DELEGATE_H_ +#define COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_DELEGATE_H_ #include <string> #include "base/basictypes.h" -namespace omaha_client { +namespace update_client { -// Embedders can specify an OmahaQueryParamsDelegate to provide additional +// Embedders can specify an UpdateQueryParamsDelegate to provide additional // custom parameters. If not specified (Set is never called), no additional // parameters are added. -class OmahaQueryParamsDelegate { +class UpdateQueryParamsDelegate { public: - OmahaQueryParamsDelegate(); - virtual ~OmahaQueryParamsDelegate(); + UpdateQueryParamsDelegate(); + virtual ~UpdateQueryParamsDelegate(); // Returns additional parameters, if any. If there are any parameters, the // string should begin with a & character. virtual std::string GetExtraParams() = 0; private: - DISALLOW_COPY_AND_ASSIGN(OmahaQueryParamsDelegate); + DISALLOW_COPY_AND_ASSIGN(UpdateQueryParamsDelegate); }; -} // namespace omaha_client +} // namespace update_client -#endif // COMPONENTS_OMAHA_CLIENT_OMAHA_QUERY_PARAMS_DELEGATE_H_ +#endif // COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_DELEGATE_H_ diff --git a/components/update_client/update_query_params_unittest.cc b/components/update_client/update_query_params_unittest.cc new file mode 100644 index 0000000..992dbd37 --- /dev/null +++ b/components/update_client/update_query_params_unittest.cc @@ -0,0 +1,55 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/strings/stringprintf.h" +#include "components/update_client/update_query_params.h" +#include "components/update_client/update_query_params_delegate.h" +#include "testing/gtest/include/gtest/gtest.h" + +using base::StringPrintf; + +namespace update_client { + +namespace { + +bool Contains(const std::string& source, const std::string& target) { + return source.find(target) != std::string::npos; +} + +class TestUpdateQueryParamsDelegate : public UpdateQueryParamsDelegate { + std::string GetExtraParams() override { return "&cat=dog"; } +}; + +} // namespace + +void TestParams(UpdateQueryParams::ProdId prod_id, bool extra_params) { + std::string params = UpdateQueryParams::Get(prod_id); + + // This doesn't so much test what the values are (since that would be an + // almost exact duplication of code with update_query_params.cc, and wouldn't + // really test anything) as it is a verification that all the params are + // present in the generated string. + EXPECT_TRUE( + Contains(params, StringPrintf("os=%s", UpdateQueryParams::GetOS()))); + EXPECT_TRUE( + Contains(params, StringPrintf("arch=%s", UpdateQueryParams::GetArch()))); + EXPECT_TRUE(Contains( + params, + StringPrintf("prod=%s", UpdateQueryParams::GetProdIdString(prod_id)))); + if (extra_params) + EXPECT_TRUE(Contains(params, "cat=dog")); +} + +TEST(UpdateQueryParamsTest, GetParams) { + TestParams(UpdateQueryParams::CRX, false); + TestParams(UpdateQueryParams::CHROME, false); + + TestUpdateQueryParamsDelegate delegate; + UpdateQueryParams::SetDelegate(&delegate); + + TestParams(UpdateQueryParams::CRX, true); + TestParams(UpdateQueryParams::CHROME, true); +} + +} // namespace update_client diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS index 64083c6..aed5c40 100644 --- a/extensions/browser/DEPS +++ b/extensions/browser/DEPS @@ -1,11 +1,11 @@ include_rules = [ "+chromeos", "+components/keyed_service", - "+components/omaha_client", "+components/pref_registry", "+components/sessions", "+components/storage_monitor", "+components/ui/zoom", + "+components/update_client", "+components/web_cache", "+components/web_modal", "+content/public/browser", diff --git a/extensions/browser/updater/update_service.cc b/extensions/browser/updater/update_service.cc index d1b0cae..ece627a 100644 --- a/extensions/browser/updater/update_service.cc +++ b/extensions/browser/updater/update_service.cc @@ -4,14 +4,16 @@ #include "extensions/browser/updater/update_service.h" +#include <set> + #include "base/message_loop/message_loop.h" -#include "components/omaha_client/omaha_query_params.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/browser_context.h" #include "extensions/browser/updater/extension_downloader.h" #include "extensions/browser/updater/update_service_factory.h" #include "extensions/common/extension_urls.h" -using omaha_client::OmahaQueryParams; +using update_client::UpdateQueryParams; namespace extensions { @@ -34,7 +36,7 @@ UpdateService::UpdateService(content::BrowserContext* context) : browser_context_(context), downloader_(new ExtensionDownloader(this, context->GetRequestContext())) { downloader_->set_manifest_query_params( - OmahaQueryParams::Get(OmahaQueryParams::CRX)); + UpdateQueryParams::Get(UpdateQueryParams::CRX)); } UpdateService::~UpdateService() { diff --git a/extensions/browser/updater/update_service_browsertest.cc b/extensions/browser/updater/update_service_browsertest.cc index 78fe377..c4ff0ef 100644 --- a/extensions/browser/updater/update_service_browsertest.cc +++ b/extensions/browser/updater/update_service_browsertest.cc @@ -27,8 +27,9 @@ namespace { using FakeResponse = std::pair<std::string, net::HttpStatusCode>; // TODO(rockot): In general there's enough mock-Omaha-noise that this might be -// better placed into some test library code in //components/omaha_client. -FakeResponse CreateFakeOmahaResponse(const std::string& id, size_t crx_length) { +// better placed into some test library code in //components/update_client. +FakeResponse CreateFakeUpdateResponse(const std::string& id, + size_t crx_length) { std::string response_text = base::StringPrintf( "<gupdate xmlns=\"http://www.google.com/update2/response\" " " protocol=\"2.0\" server=\"prod\">\n" @@ -45,7 +46,7 @@ FakeResponse CreateFakeOmahaResponse(const std::string& id, size_t crx_length) { return std::make_pair(response_text, net::HTTP_OK); } -FakeResponse CreateFakeOmahaNotFoundResponse() { +FakeResponse CreateFakeUpdateNotFoundResponse() { return std::make_pair( std::string( "<gupdate xmlns=\"http://www.google.com/update2/response\" " @@ -76,7 +77,7 @@ bool ExtractKeyValueFromComponent(const std::string& component_str, // This function extracts the 'x' query parameter (e.g. "id%3Dabcdef...."), // unescapes its value (to become e.g., "id=abcdef...", and then extracts the // 'id' value from the result (e.g. "abcdef..."). -bool ExtractIdFromOmahaQuery(const std::string& query_str, std::string* id) { +bool ExtractIdFromUpdateQuery(const std::string& query_str, std::string* id) { std::string data_string; if (!ExtractKeyValueFromComponent(query_str, "x", &data_string)) return false; @@ -99,7 +100,7 @@ class FakeUpdateURLFetcherFactory : public net::URLFetcherFactory { void RegisterFakeExtension(const std::string& id, const std::string& contents) { - CHECK(id.size() == 32); + CHECK_EQ(32u, id.size()); fake_extensions_.insert(std::make_pair(id, contents)); } @@ -128,14 +129,14 @@ class FakeUpdateURLFetcherFactory : public net::URLFetcherFactory { // Otherwise return an invalid-ID response. FakeResponse response; std::string extension_id; - if (!ExtractIdFromOmahaQuery(url.query(), &extension_id)) { - response = CreateFakeOmahaNotFoundResponse(); + if (!ExtractIdFromUpdateQuery(url.query(), &extension_id)) { + response = CreateFakeUpdateNotFoundResponse(); } else { const auto& iter = fake_extensions_.find(extension_id); if (iter == fake_extensions_.end()) - response = CreateFakeOmahaNotFoundResponse(); + response = CreateFakeUpdateNotFoundResponse(); else - response = CreateFakeOmahaResponse(extension_id, iter->second.size()); + response = CreateFakeUpdateResponse(extension_id, iter->second.size()); } return new net::FakeURLFetcher(url, delegate, response.first, response.second, diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index 19dc451..e0b3261 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn @@ -28,8 +28,8 @@ source_set("app_shell_lib") { ":version_header", "//base", "//base:prefs", - "//components/omaha_client", "//components/pref_registry", + "//components/update_client", "//components/user_prefs", "//components/web_cache/renderer", "//content", @@ -110,8 +110,6 @@ source_set("app_shell_lib") { "browser/shell_network_delegate.h", "browser/shell_oauth2_token_service.cc", "browser/shell_oauth2_token_service.h", - "browser/shell_omaha_query_params_delegate.cc", - "browser/shell_omaha_query_params_delegate.h", "browser/shell_prefs.cc", "browser/shell_prefs.h", "browser/shell_runtime_api_delegate.cc", @@ -122,6 +120,8 @@ source_set("app_shell_lib") { "browser/shell_special_storage_policy.h", "browser/shell_speech_recognition_manager_delegate.cc", "browser/shell_speech_recognition_manager_delegate.h", + "browser/shell_update_query_params_delegate.cc", + "browser/shell_update_query_params_delegate.h", "browser/shell_url_request_context_getter.cc", "browser/shell_url_request_context_getter.h", "browser/shell_web_contents_modal_dialog_manager.cc", diff --git a/extensions/shell/app_shell.gyp b/extensions/shell/app_shell.gyp index 69581f2..600d656 100644 --- a/extensions/shell/app_shell.gyp +++ b/extensions/shell/app_shell.gyp @@ -19,8 +19,8 @@ 'app_shell_version_header', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_prefs', - '<(DEPTH)/components/components.gyp:omaha_client', '<(DEPTH)/components/components.gyp:pref_registry', + '<(DEPTH)/components/components.gyp:update_client', '<(DEPTH)/components/components.gyp:user_prefs', '<(DEPTH)/components/components.gyp:web_cache_renderer', '<(DEPTH)/content/content.gyp:content', @@ -111,8 +111,6 @@ 'browser/shell_network_delegate.h', 'browser/shell_oauth2_token_service.cc', 'browser/shell_oauth2_token_service.h', - 'browser/shell_omaha_query_params_delegate.cc', - 'browser/shell_omaha_query_params_delegate.h', 'browser/shell_prefs.cc', 'browser/shell_prefs.h', 'browser/shell_runtime_api_delegate.cc', @@ -121,6 +119,8 @@ 'browser/shell_special_storage_policy.h', 'browser/shell_speech_recognition_manager_delegate.cc', 'browser/shell_speech_recognition_manager_delegate.h', + 'browser/shell_update_query_params_delegate.cc', + 'browser/shell_update_query_params_delegate.h', 'browser/shell_url_request_context_getter.cc', 'browser/shell_url_request_context_getter.h', 'browser/shell_web_contents_modal_dialog_manager.cc', diff --git a/extensions/shell/browser/DEPS b/extensions/shell/browser/DEPS index 286e0c7..19d19e7 100644 --- a/extensions/shell/browser/DEPS +++ b/extensions/shell/browser/DEPS @@ -3,8 +3,8 @@ include_rules = [ "+components/keyed_service", "+components/nacl/browser", "+components/nacl/common", - "+components/omaha_client", "+components/pref_registry", + "+components/update_client", "+components/user_prefs", "+components/web_modal", "+content/public/browser", diff --git a/extensions/shell/browser/shell_browser_main_parts.cc b/extensions/shell/browser/shell_browser_main_parts.cc index 453474b..8b2133a 100644 --- a/extensions/shell/browser/shell_browser_main_parts.cc +++ b/extensions/shell/browser/shell_browser_main_parts.cc @@ -10,8 +10,8 @@ #include "base/prefs/pref_service.h" #include "base/run_loop.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "components/omaha_client/omaha_query_params.h" #include "components/storage_monitor/storage_monitor.h" +#include "components/update_client/update_query_params.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/context_factory.h" #include "content/public/browser/devtools_http_handler.h" @@ -32,8 +32,8 @@ #include "extensions/shell/browser/shell_extension_system_factory.h" #include "extensions/shell/browser/shell_extensions_browser_client.h" #include "extensions/shell/browser/shell_oauth2_token_service.h" -#include "extensions/shell/browser/shell_omaha_query_params_delegate.h" #include "extensions/shell/browser/shell_prefs.h" +#include "extensions/shell/browser/shell_update_query_params_delegate.h" #include "extensions/shell/common/shell_extensions_client.h" #include "extensions/shell/common/switches.h" #include "ui/base/ime/input_method_initializer.h" @@ -167,9 +167,9 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { browser_context_.get(), user_pref_service_.get())); ExtensionsBrowserClient::Set(extensions_browser_client_.get()); - omaha_query_params_delegate_.reset(new ShellOmahaQueryParamsDelegate); - omaha_client::OmahaQueryParams::SetDelegate( - omaha_query_params_delegate_.get()); + update_query_params_delegate_.reset(new ShellUpdateQueryParamsDelegate); + update_client::UpdateQueryParams::SetDelegate( + update_query_params_delegate_.get()); // Create our custom ExtensionSystem first because other // KeyedServices depend on it. diff --git a/extensions/shell/browser/shell_browser_main_parts.h b/extensions/shell/browser/shell_browser_main_parts.h index 36ff69c..0406d82 100644 --- a/extensions/shell/browser/shell_browser_main_parts.h +++ b/extensions/shell/browser/shell_browser_main_parts.h @@ -36,7 +36,7 @@ class ShellBrowserMainDelegate; class ShellDeviceClient; class ShellExtensionSystem; class ShellOAuth2TokenService; -class ShellOmahaQueryParamsDelegate; +class ShellUpdateQueryParamsDelegate; #if defined(OS_CHROMEOS) class ShellAudioController; @@ -89,7 +89,7 @@ class ShellBrowserMainParts : public content::BrowserMainParts { scoped_ptr<ExtensionsClient> extensions_client_; scoped_ptr<ExtensionsBrowserClient> extensions_browser_client_; scoped_ptr<content::DevToolsHttpHandler> devtools_http_handler_; - scoped_ptr<ShellOmahaQueryParamsDelegate> omaha_query_params_delegate_; + scoped_ptr<ShellUpdateQueryParamsDelegate> update_query_params_delegate_; scoped_ptr<ShellOAuth2TokenService> oauth2_token_service_; // Owned by the KeyedService system. diff --git a/extensions/shell/browser/shell_omaha_query_params_delegate.h b/extensions/shell/browser/shell_omaha_query_params_delegate.h deleted file mode 100644 index ad17a4c..0000000 --- a/extensions/shell/browser/shell_omaha_query_params_delegate.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_OMAHA_QUERY_PARAMS_DELEGATE_H_ -#define EXTENSIONS_SHELL_BROWSER_SHELL_OMAHA_QUERY_PARAMS_DELEGATE_H_ - -#include "components/omaha_client/omaha_query_params_delegate.h" - -namespace extensions { - -class ShellOmahaQueryParamsDelegate - : public omaha_client::OmahaQueryParamsDelegate { - public: - ShellOmahaQueryParamsDelegate(); - ~ShellOmahaQueryParamsDelegate() override; - - std::string GetExtraParams() override; - - private: - DISALLOW_COPY_AND_ASSIGN(ShellOmahaQueryParamsDelegate); -}; - -} // namespace extensions - -#endif // EXTENSIONS_SHELL_BROWSER_SHELL_OMAHA_QUERY_PARAMS_DELEGATE_H_ diff --git a/extensions/shell/browser/shell_omaha_query_params_delegate.cc b/extensions/shell/browser/shell_update_query_params_delegate.cc index cd37c718..462b1ff 100644 --- a/extensions/shell/browser/shell_omaha_query_params_delegate.cc +++ b/extensions/shell/browser/shell_update_query_params_delegate.cc @@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "extensions/shell/browser/shell_omaha_query_params_delegate.h" +#include "extensions/shell/browser/shell_update_query_params_delegate.h" + +#include <string> namespace extensions { -ShellOmahaQueryParamsDelegate::ShellOmahaQueryParamsDelegate() { +ShellUpdateQueryParamsDelegate::ShellUpdateQueryParamsDelegate() { } -ShellOmahaQueryParamsDelegate::~ShellOmahaQueryParamsDelegate() { +ShellUpdateQueryParamsDelegate::~ShellUpdateQueryParamsDelegate() { } -std::string ShellOmahaQueryParamsDelegate::GetExtraParams() { +std::string ShellUpdateQueryParamsDelegate::GetExtraParams() { // This version number is high enough to be supported by Omaha // (below 31 is unsupported), but it's fake enough to be obviously // not a Chrome release. diff --git a/extensions/shell/browser/shell_update_query_params_delegate.h b/extensions/shell/browser/shell_update_query_params_delegate.h new file mode 100644 index 0000000..39887e6 --- /dev/null +++ b/extensions/shell/browser/shell_update_query_params_delegate.h @@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_UPDATE_QUERY_PARAMS_DELEGATE_H_ +#define EXTENSIONS_SHELL_BROWSER_SHELL_UPDATE_QUERY_PARAMS_DELEGATE_H_ + +#include <string> + +#include "components/update_client/update_query_params_delegate.h" + +namespace extensions { + +class ShellUpdateQueryParamsDelegate + : public update_client::UpdateQueryParamsDelegate { + public: + ShellUpdateQueryParamsDelegate(); + ~ShellUpdateQueryParamsDelegate() override; + + std::string GetExtraParams() override; + + private: + DISALLOW_COPY_AND_ASSIGN(ShellUpdateQueryParamsDelegate); +}; + +} // namespace extensions + +#endif // EXTENSIONS_SHELL_BROWSER_SHELL_UPDATE_QUERY_PARAMS_DELEGATE_H_ |