diff options
author | sorin <sorin@chromium.org> | 2015-01-05 17:09:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-06 01:10:07 +0000 |
commit | 39eab2f9d3d0435422f65c6664276fdd72326f89 (patch) | |
tree | 83a3b3e4a880f6928cc59eeb0a04b6dae4fcc317 /components | |
parent | d5f87c03637894f86fa9565c86d9dac6160c3616 (diff) | |
download | chromium_src-39eab2f9d3d0435422f65c6664276fdd72326f89.zip chromium_src-39eab2f9d3d0435422f65c6664276fdd72326f89.tar.gz chromium_src-39eab2f9d3d0435422f65c6664276fdd72326f89.tar.bz2 |
Rename omaha_client and similar tokens to update_client in all contexts.
This is a mechanical change.
The idea here is to refactor the common code involved in installing
components and extensions in a common module. In the future, we want
more update-related Chrome stuff to go in this module.
Therefore, it is desirable that this module have a name that describes
its purpose.
BUG=445949
Review URL: https://codereview.chromium.org/803313003
Cr-Commit-Position: refs/heads/master@{#310022}
Diffstat (limited to 'components')
18 files changed, 134 insertions, 137 deletions
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 |