diff options
author | huangs <huangs@chromium.org> | 2014-12-16 09:23:03 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-16 17:23:35 +0000 |
commit | 4ccde74724cf8fe366181cee3513b87b69765413 (patch) | |
tree | b930bf2340fb3bb8e67b860deeb90c3548a741fc /chrome/installer | |
parent | f00a4d422dc72459c292693e557a8229318b5b36 (diff) | |
download | chromium_src-4ccde74724cf8fe366181cee3513b87b69765413.zip chromium_src-4ccde74724cf8fe366181cee3513b87b69765413.tar.gz chromium_src-4ccde74724cf8fe366181cee3513b87b69765413.tar.bz2 |
[Installer] Moving GetRegistrationDataCommandKey() to setup_util.
This is a small refactoring that's needed for removal of legacy App Launcher
installer code (will need to use GetRegistrationDataCommandKey outside of
install_workers.cc).
Review URL: https://codereview.chromium.org/800353002
Cr-Commit-Position: refs/heads/master@{#308604}
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/setup/install_worker.cc | 11 | ||||
-rw-r--r-- | chrome/installer/setup/setup_util.cc | 12 | ||||
-rw-r--r-- | chrome/installer/setup/setup_util.h | 7 | ||||
-rw-r--r-- | chrome/installer/setup/setup_util_unittest.cc | 10 |
4 files changed, 29 insertions, 11 deletions
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index e76a5dd..2b544b6 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -187,17 +187,6 @@ void AddInstallerCopyTasks(const InstallerState& installer_state, } } -base::string16 GetRegistrationDataCommandKey( - const AppRegistrationData& reg_data, - const wchar_t* name) { - base::string16 cmd_key(reg_data.GetVersionKey()); - cmd_key.append(1, base::FilePath::kSeparators[0]) - .append(google_update::kRegCommandsKey) - .append(1, base::FilePath::kSeparators[0]) - .append(name); - return cmd_key; -} - base::string16 GetRegCommandKey(BrowserDistribution* dist, const wchar_t* name) { return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name); diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index f121fbf..d671097 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -23,6 +23,7 @@ #include "base/win/registry.h" #include "base/win/windows_version.h" #include "chrome/installer/setup/setup_constants.h" +#include "chrome/installer/util/app_registration_data.h" #include "chrome/installer/util/copy_tree_work_item.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/installation_state.h" @@ -455,6 +456,17 @@ bool IsProcessorSupported() { return base::CPU().has_sse2(); } +base::string16 GetRegistrationDataCommandKey( + const AppRegistrationData& reg_data, + const wchar_t* name) { + base::string16 cmd_key(reg_data.GetVersionKey()); + cmd_key.append(1, base::FilePath::kSeparators[0]) + .append(google_update::kRegCommandsKey) + .append(1, base::FilePath::kSeparators[0]) + .append(name); + return cmd_key; +} + ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) : is_enabled_(false) { HANDLE temp_handle; diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h index 1d91cb8..0e8dfa3 100644 --- a/chrome/installer/setup/setup_util.h +++ b/chrome/installer/setup/setup_util.h @@ -17,6 +17,8 @@ #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/util_constants.h" +class AppRegistrationData; + namespace base { class CommandLine; class FilePath; @@ -115,6 +117,11 @@ bool ContainsUnsupportedSwitch(const base::CommandLine& cmd_line); // Returns true if the processor is supported by chrome. bool IsProcessorSupported(); +// Returns the "...\\Commands\\|name|" registry key for a product's |reg_data|. +base::string16 GetRegistrationDataCommandKey( + const AppRegistrationData& reg_data, + const wchar_t* name); + // This class will enable the privilege defined by |privilege_name| on the // current process' token. The privilege will be disabled upon the // ScopedTokenPrivilege's destruction (unless it was already enabled when the diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index 6c3430c..e11f33a 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -15,6 +15,7 @@ #include "base/process/kill.h" #include "base/process/launch.h" #include "base/process/process_handle.h" +#include "base/strings/string_util.h" #include "base/test/test_reg_util_win.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" @@ -26,6 +27,7 @@ #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/installer_state.h" +#include "chrome/installer/util/updating_app_registration_data.h" #include "chrome/installer/util/util_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -494,3 +496,11 @@ TEST(SetupUtilTest, ContainsUnsupportedSwitch) { EXPECT_TRUE(installer::ContainsUnsupportedSwitch( CommandLine::FromString(L"foo.exe --chrome-frame"))); } + +TEST(SetupUtilTest, GetRegistrationDataCommandKey) { + base::string16 app_guid = L"{AAAAAAAA-BBBB-1111-0123-456789ABCDEF}"; + UpdatingAppRegistrationData reg_data(app_guid); + base::string16 key = + installer::GetRegistrationDataCommandKey(reg_data, L"test_name"); + EXPECT_TRUE(EndsWith(key, app_guid + L"\\Commands\\test_name", true)); +} |