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

Unified Diff: chrome/browser/shell_integration_win.cc

Issue 10542031: Suffix Chrome's appid on user-level installs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove install logic order changes and modify naming/comments Created 8 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
Index: chrome/browser/shell_integration_win.cc
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 93f1f2f082444dbec59cb155c432f618a0947800..aec37d8b2b309165e4152393bf7169cc1801f700 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -293,10 +293,12 @@ bool GetExpectedAppId(const FilePath& chrome_exe,
app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromExtensionId(
command_line.GetSwitchValueASCII(switches::kAppId)));
} else {
- app_name = BrowserDistribution::GetDistribution()->GetBrowserAppId();
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ app_name = ShellUtil::GetAppId(dist, chrome_exe.value());
}
- expected_app_id->assign(ShellIntegration::GetAppId(app_name, profile_path));
+ expected_app_id->assign(
+ ShellIntegration::GetAppModelId(app_name, profile_path));
return true;
}
@@ -550,8 +552,8 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() {
return ff_default;
}
-string16 ShellIntegration::GetAppId(const string16& app_name,
- const FilePath& profile_path) {
+string16 ShellIntegration::GetAppModelId(const string16& app_name,
+ const FilePath& profile_path) {
string16 app_id(app_name);
string16 profile_id(GetProfileIdFromPath(profile_path));
@@ -560,14 +562,20 @@ string16 ShellIntegration::GetAppId(const string16& app_name,
app_id += profile_id;
}
- // App id should be less than 128 chars.
- DCHECK(app_id.length() < 128);
+ // App id should be less than 64 chars.
+ DCHECK_LT(app_id.length(), 64U);
return app_id;
}
-string16 ShellIntegration::GetChromiumAppId(const FilePath& profile_path) {
- return GetAppId(BrowserDistribution::GetDistribution()->GetBrowserAppId(),
- profile_path);
+string16 ShellIntegration::GetChromiumModelId(const FilePath& profile_path) {
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ FilePath chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+ NOTREACHED();
+ return dist->GetBaseAppId();
+ }
+ return GetAppModelId(
+ ShellUtil::GetAppId(dist, chrome_exe.value()), profile_path);
}
string16 ShellIntegration::GetChromiumIconPath() {
@@ -597,6 +605,11 @@ void ShellIntegration::MigrateChromiumShortcuts() {
bool ShellIntegration::ActivateMetroChrome() {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- const string16 app_id(dist->GetBrowserAppId());
+ FilePath chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+ NOTREACHED();
+ return false;
+ }
+ const string16 app_id(ShellUtil::GetAppId(dist, chrome_exe.value()));
return ActivateApplication(app_id);
}

Powered by Google App Engine
This is Rietveld 408576698