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

Unified Diff: chrome/installer/util/google_update_settings.cc

Issue 316103002: Read multi-install chrome's channel from the binaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: robertshield comments Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/installer/util/google_update_settings_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/google_update_settings.cc
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index feac280afb50d454c4e4530bb0af129b95af1f52..546c5a9fe2d1a3293ec725683ddd2c6590974d2f 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -134,29 +134,41 @@ bool GetChromeChannelInternal(bool system_install,
bool add_multi_modifier,
base::string16* channel) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- if (dist->GetChromeChannel(channel)) {
- return true;
- }
- HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
- base::string16 reg_path = dist->GetStateKey();
- RegKey key(root_key, reg_path.c_str(), KEY_READ | KEY_WOW64_32KEY);
+ // Shortcut in case this distribution knows what channel it is (canary).
+ if (dist->GetChromeChannel(channel))
+ return true;
+ // Determine whether or not chrome is multi-install. If so, updates are
+ // delivered under the binaries' app guid, so that's where the relevant
+ // channel is found.
+ installer::ProductState state;
installer::ChannelInfo channel_info;
- if (!channel_info.Initialize(key)) {
- channel->assign(installer::kChromeChannelUnknown);
- return false;
+ ignore_result(state.Initialize(system_install, dist));
+ if (!state.is_multi_install()) {
+ // Use the channel info that was just read for this single-install chrome.
+ channel_info = state.channel();
+ } else {
+ // Read the channel info from the binaries' state key.
+ HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ dist = BrowserDistribution::GetSpecificDistribution(
+ BrowserDistribution::CHROME_BINARIES);
+ RegKey key(root_key, dist->GetStateKey().c_str(),
+ KEY_READ | KEY_WOW64_32KEY);
+
+ if (!channel_info.Initialize(key)) {
+ channel->assign(installer::kChromeChannelUnknown);
+ return false;
+ }
}
- if (!channel_info.GetChannelName(channel)) {
+ if (!channel_info.GetChannelName(channel))
channel->assign(installer::kChromeChannelUnknown);
- }
// Tag the channel name if this is a multi-install.
- if (add_multi_modifier && channel_info.IsMultiInstall()) {
- if (!channel->empty()) {
+ if (add_multi_modifier && state.is_multi_install()) {
+ if (!channel->empty())
channel->push_back(L'-');
- }
channel->push_back(L'm');
}
« no previous file with comments | « no previous file | chrome/installer/util/google_update_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698