Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: chrome/installer/mini_installer/mini_installer.cc

Issue 10665002: Implement installation of the Chrome App Host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A basic working app host installer/uninstaller. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/mini_installer/mini_installer.cc
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc
index ea3add30b6f5757ce3321e9b3c7738b29e6ae08e..3cd054fda674d6ea09a70b5df3c57a999199b2eb 100644
--- a/chrome/installer/mini_installer/mini_installer.cc
+++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -23,6 +23,7 @@
#include <windows.h>
#include <shellapi.h>
+#include <wchar.h>
tommi (sloooow) - chröme 2012/07/12 08:11:31 out of curiosity, why is this needed?
erikwright (departed) 2012/07/16 20:13:11 Extreme IWYU. Obviously too extreme. Done.
grt (UTC plus 2) 2012/07/23 11:31:12 If you added it because the type wchar_t is used i
#include "chrome/installer/mini_installer/appid.h"
#include "chrome/installer/mini_installer/configuration.h"
@@ -159,6 +160,7 @@ void SetInstallerFlags(const Configuration& configuration) {
const REGSAM key_access = KEY_QUERY_VALUE | KEY_SET_VALUE;
const HKEY root_key =
configuration.is_system_level() ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ // This is ignored if multi-install is true.
const wchar_t* app_guid =
configuration.has_chrome_frame() ?
google_update::kChromeFrameAppGuid :
@@ -228,34 +230,34 @@ bool GetSetupExePathFromRegistry(const Configuration& configuration,
const HKEY root_key =
configuration.is_system_level() ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
RegKey key;
- bool succeeded = false;
-
- // If this is a multi install, first try looking in the binaries for the path.
- if (configuration.is_multi_install() &&
- OpenClientStateKey(root_key, google_update::kMultiInstallAppGuid,
- KEY_QUERY_VALUE, &key)) {
- succeeded = (key.ReadValue(kUninstallRegistryValueName, path,
- size) == ERROR_SUCCESS);
- }
+ const int kMaxGuids = 10;
grt (UTC plus 2) 2012/07/12 18:37:10 why not 4?
erikwright (departed) 2012/07/16 20:13:11 Done.
+ const wchar_t* app_guids[kMaxGuids] = {0};
grt (UTC plus 2) 2012/07/12 18:37:10 {0} -> {}
erikwright (departed) 2012/07/16 20:13:11 Done.
+ size_t guid_count = 0;
+
+ // If this is a multi install, first try looking in the binaries for the path
grt (UTC plus 2) 2012/07/12 18:37:10 "path" -> "path."
erikwright (departed) 2012/07/16 20:13:11 Done.
+ if (configuration.is_multi_install())
+ app_guids[guid_count++] = google_update::kMultiInstallAppGuid;
// Failing that, look in Chrome Frame's client state key --chrome-frame was
grt (UTC plus 2) 2012/07/12 18:37:10 "state key" -> "state key if"
erikwright (departed) 2012/07/16 20:13:11 Done.
// specified.
- if (!succeeded && configuration.has_chrome_frame() &&
- OpenClientStateKey(root_key, google_update::kChromeFrameAppGuid,
- KEY_QUERY_VALUE, &key)) {
- succeeded = (key.ReadValue(kUninstallRegistryValueName, path,
- size) == ERROR_SUCCESS);
+ if (guid_count < kMaxGuids && configuration.has_chrome_frame())
+ app_guids[guid_count++] = google_update::kChromeFrameAppGuid;
+ // Make a last-ditch effort to look in the Chrome and App Host client state
+ // keys.
+ if (guid_count < kMaxGuids)
+ app_guids[guid_count++] = configuration.chrome_app_guid();
+ if (guid_count < kMaxGuids && configuration.has_app_host())
+ app_guids[guid_count++] = google_update::kChromeAppHostAppGuid;
+
+ for (size_t i = 0; i < guid_count; ++i) {
+ if (!OpenClientStateKey(root_key, app_guids[i], KEY_QUERY_VALUE, &key))
+ continue;
+
+ if (key.ReadValue(kUninstallRegistryValueName, path, size) == ERROR_SUCCESS)
+ return true;
}
- // Make a last-ditch effort to look in Chrome's client state key.
- if (!succeeded &&
- OpenClientStateKey(root_key, configuration.chrome_app_guid(),
- KEY_QUERY_VALUE, &key)) {
- succeeded = (key.ReadValue(kUninstallRegistryValueName, path,
- size) == ERROR_SUCCESS);
- }
-
- return succeeded;
+ return false;
}
// Calls CreateProcess with good default parameters and waits for the process

Powered by Google App Engine
This is Rietveld 408576698