summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer/util')
-rw-r--r--chrome/installer/util/google_update_settings.cc22
-rw-r--r--chrome/installer/util/install_util.cc24
-rw-r--r--chrome/installer/util/install_util.h7
-rw-r--r--chrome/installer/util/shell_util.cc25
-rw-r--r--chrome/installer/util/shell_util.h2
-rw-r--r--chrome/installer/util/util_constants.cc4
-rw-r--r--chrome/installer/util/util_constants.h2
7 files changed, 54 insertions, 32 deletions
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index 27e2cc7..1520577 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -38,14 +38,6 @@ const GoogleUpdateSettings::UpdatePolicy kGoogleUpdateDefaultUpdatePolicy =
GoogleUpdateSettings::UPDATES_DISABLED;
#endif
-// An list of search results in increasing order of desirability.
-enum EulaSearchResult {
- NO_SETTING,
- FOUND_CLIENT_STATE,
- FOUND_OPPOSITE_SETTING,
- FOUND_SAME_SETTING
-};
-
bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) {
// The registry functions below will end up going to disk. Do this on another
// thread to avoid slowing the IO thread. http://crbug.com/62121
@@ -108,20 +100,6 @@ bool RemoveGoogleUpdateStrKey(const wchar_t* const name) {
return (key.DeleteValue(name) == ERROR_SUCCESS);
}
-EulaSearchResult HasEULASetting(HKEY root, const std::wstring& state_key,
- bool setting) {
- RegKey key;
- DWORD previous_value = setting ? 1 : 0;
- if (key.Open(root, state_key.c_str(), KEY_QUERY_VALUE) != ERROR_SUCCESS)
- return NO_SETTING;
- if (key.ReadValueDW(google_update::kRegEULAAceptedField,
- &previous_value) != ERROR_SUCCESS)
- return FOUND_CLIENT_STATE;
-
- return ((previous_value != 0) == setting) ?
- FOUND_SAME_SETTING : FOUND_OPPOSITE_SETTING;
-}
-
bool GetChromeChannelInternal(bool system_install,
bool add_multi_modifier,
string16* channel) {
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 6b327f8..0c1dd99 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -26,6 +26,7 @@
#include "base/win/windows_version.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
+#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/l10n_string_util.h"
#include "chrome/installer/util/installation_state.h"
#include "chrome/installer/util/util_constants.h"
@@ -358,6 +359,29 @@ bool InstallUtil::HasDelegateExecuteHandler(BrowserDistribution* dist,
return found;
}
+bool InstallUtil::GetSentinelFilePath(const char* file,
+ BrowserDistribution* dist,
+ FilePath* path) {
+ FilePath exe_path;
+ if (!PathService::Get(base::DIR_EXE, &exe_path))
+ return false;
+
+ if (IsPerUserInstall(exe_path.value().c_str())) {
+ *path = exe_path;
+ } else {
+ std::vector<FilePath> user_data_dir_paths;
+ installer::GetChromeUserDataPaths(dist, &user_data_dir_paths);
+
+ if (!user_data_dir_paths.empty())
+ *path = user_data_dir_paths[0];
+ else
+ return false;
+ }
+
+ *path = path->AppendASCII(file);
+ return true;
+}
+
// This method tries to delete a registry key and logs an error message
// in case of failure. It returns true if deletion is successful (or the key did
// not exist), otherwise false.
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index fe2db2b..e10025c 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -98,6 +98,13 @@ class InstallUtil {
static bool HasDelegateExecuteHandler(BrowserDistribution* dist,
const string16& chrome_exe);
+ // Populates |path| with the path to |file| in the sentinel directory. This is
+ // the application directory for user-level installs, and the default user
+ // data dir for system-level installs. Returns false on error.
+ static bool GetSentinelFilePath(const char* file,
+ BrowserDistribution* dist,
+ FilePath* path);
+
// Deletes the registry key at path key_path under the key given by root_key.
static bool DeleteRegistryKey(HKEY root_key, const string16& key_path);
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 73aeabe..113b479 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -216,7 +216,9 @@ class RegistryEntry {
string16 delegate_command(ShellUtil::GetChromeDelegateCommand(chrome_exe));
// For user-level installs: entries for the app id and DelegateExecute verb
// handler will be in HKCU; thus we do not need a suffix on those entries.
- string16 app_id(ShellUtil::GetBrowserModelId(dist, chrome_exe));
+ string16 app_id(
+ ShellUtil::GetBrowserModelId(
+ dist, InstallUtil::IsPerUserInstall(chrome_exe.c_str())));
string16 delegate_guid;
// TODO(grt): remove HasDelegateExecuteHandler when the exe is ever-present;
// see also install_worker.cc's AddDelegateExecuteWorkItems.
@@ -752,13 +754,16 @@ void RemoveBadWindows8RegistrationIfNeeded(
!IsChromeMetroSupported())) {
// There's no need to rollback, so forgo the usual work item lists and just
// remove the values from the registry.
- const HKEY root_key = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ?
- HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
+ bool is_per_user_install =
+ InstallUtil::IsPerUserInstall(chrome_exe.c_str());
+ const HKEY root_key = is_per_user_install ? HKEY_CURRENT_USER :
+ HKEY_LOCAL_MACHINE;
// Use the current installation's suffix, not the about-to-be-installed
// suffix.
const string16 installation_suffix(
ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe));
- const string16 app_id(ShellUtil::GetBrowserModelId(dist, chrome_exe));
+ const string16 app_id(ShellUtil::GetBrowserModelId(dist,
+ is_per_user_install));
// <root hkey>\Software\Classes\<app_id>
string16 key(ShellUtil::kRegClasses);
@@ -1206,11 +1211,10 @@ string16 ShellUtil::GetApplicationName(BrowserDistribution* dist,
}
string16 ShellUtil::GetBrowserModelId(BrowserDistribution* dist,
- const string16& chrome_exe) {
+ bool is_per_user_install) {
string16 app_id(dist->GetBaseAppId());
string16 suffix;
- if (InstallUtil::IsPerUserInstall(chrome_exe.c_str()) &&
- !GetUserSpecificRegistrySuffix(&suffix)) {
+ if (is_per_user_install && !GetUserSpecificRegistrySuffix(&suffix)) {
NOTREACHED();
}
// There is only one component (i.e. the suffixed appid) in this case, but it
@@ -1644,7 +1648,8 @@ void ShellUtil::RemoveChromeStartScreenShortcuts(BrowserDistribution* dist,
}
app_shortcuts_path = app_shortcuts_path.Append(
- GetBrowserModelId(dist, chrome_exe));
+ GetBrowserModelId(dist,
+ InstallUtil::IsPerUserInstall(chrome_exe.c_str())));
if (!file_util::DirectoryExists(app_shortcuts_path)) {
VLOG(1) << "No start screen shortcuts to delete.";
return;
@@ -1675,7 +1680,9 @@ bool ShellUtil::UpdateChromeShortcut(BrowserDistribution* dist,
&icon_index);
}
- const string16 app_id(GetBrowserModelId(dist, chrome_exe));
+ const string16 app_id(
+ GetBrowserModelId(dist,
+ InstallUtil::IsPerUserInstall(chrome_exe.c_str())));
const bool is_dual_mode = ((options & ShellUtil::SHORTCUT_DUAL_MODE) != 0);
const base::win::ShortcutOperation operation =
(options & ShellUtil::SHORTCUT_CREATE_ALWAYS) != 0 ?
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index b6afc95..538a42e 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -260,7 +260,7 @@ class ShellUtil {
// to other registration entries which are suffixed as described in
// GetCurrentInstallationSuffix() above).
static string16 GetBrowserModelId(BrowserDistribution* dist,
- const string16& chrome_exe);
+ bool is_per_user_install);
// Returns an AppUserModelId composed of each member of |components| separated
// by dots.
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc
index d370fc3..b27f61c 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -155,6 +155,9 @@ const char kVerboseLogging[] = "verbose-logging";
// Show the embedded EULA dialog.
const char kShowEula[] = "show-eula";
+// Show the embedded EULA dialog, relaunch metro Chrome on acceptance.
+const char kShowEulaForMetro[] = "show-eula-for-metro";
+
// Use the alternate desktop shortcut name.
const char kAltDesktopShortcut[] = "alt-desktop-shortcut";
@@ -189,6 +192,7 @@ const wchar_t kCmdQuickEnableApplicationHost[] =
L"quick-enable-application-host";
const wchar_t kCmdQuickEnableCf[] = L"quick-enable-cf";
const wchar_t kDelegateExecuteExe[] = L"delegate_execute.exe";
+const char kEULASentinelFile[] = "EULA Accepted";
const wchar_t kGoogleChromeInstallSubDir1[] = L"Google";
const wchar_t kGoogleChromeInstallSubDir2[] = L"Chrome";
const wchar_t kInstallBinaryDir[] = L"Application";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index 2ed6c4f..03dd059 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -162,6 +162,7 @@ extern const char kUninstall[];
extern const char kUpdateSetupExe[];
extern const char kVerboseLogging[];
extern const char kShowEula[];
+extern const char kShowEulaForMetro[];
extern const char kAltDesktopShortcut[];
extern const char kInactiveUserToast[];
extern const char kSystemLevelToast[];
@@ -184,6 +185,7 @@ extern const wchar_t kCmdOnOsUpgrade[];
extern const wchar_t kCmdQuickEnableApplicationHost[];
extern const wchar_t kCmdQuickEnableCf[];
extern const wchar_t kDelegateExecuteExe[];
+extern const char kEULASentinelFile[];
extern const wchar_t kGoogleChromeInstallSubDir1[];
extern const wchar_t kGoogleChromeInstallSubDir2[];
extern const wchar_t kInstallBinaryDir[];