summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/shell_integration_win.cc19
-rw-r--r--chrome/browser/shell_integration_win_unittest.cc27
2 files changed, 38 insertions, 8 deletions
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index f133469..5dd8083 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -41,11 +41,7 @@ using content::BrowserThread;
namespace {
-#if defined(GOOGLE_CHROME_BUILD)
-const wchar_t kAppListAppName[] = L"ChromeAppList";
-#else
-const wchar_t kAppListAppName[] = L"ChromiumAppList";
-#endif
+const wchar_t kAppListAppNameSuffix[] = L"AppList";
// Helper function for ShellIntegration::GetAppId to generates profile id
// from profile path. "profile_id" is composed of sanitized basenames of
@@ -83,6 +79,13 @@ string16 GetProfileIdFromPath(const base::FilePath& profile_path) {
return profile_id;
}
+string16 GetAppListAppName() {
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ string16 app_name(dist->GetBaseAppId());
+ app_name.append(kAppListAppNameSuffix);
+ return app_name;
+}
+
// Gets expected app id for given Chrome (based on |command_line| and
// |is_per_user_install|).
string16 GetExpectedAppId(const CommandLine& command_line,
@@ -102,7 +105,7 @@ string16 GetExpectedAppId(const CommandLine& command_line,
app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromExtensionId(
command_line.GetSwitchValueASCII(switches::kAppId)));
} else if (command_line.HasSwitch(switches::kShowAppList)) {
- app_name = kAppListAppName;
+ app_name = GetAppListAppName();
} else {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
app_name = ShellUtil::GetBrowserModelId(dist, is_per_user_install);
@@ -339,8 +342,8 @@ string16 ShellIntegration::GetChromiumModelIdForProfile(
string16 ShellIntegration::GetAppListAppModelIdForProfile(
const base::FilePath& profile_path) {
- return ShellIntegration::GetAppModelIdForProfile(kAppListAppName,
- profile_path);
+ return ShellIntegration::GetAppModelIdForProfile(
+ GetAppListAppName(), profile_path);
}
string16 ShellIntegration::GetChromiumIconLocation() {
diff --git a/chrome/browser/shell_integration_win_unittest.cc b/chrome/browser/shell_integration_win_unittest.cc
index 4a17e90..56b7ae2 100644
--- a/chrome/browser/shell_integration_win_unittest.cc
+++ b/chrome/browser/shell_integration_win_unittest.cc
@@ -195,3 +195,30 @@ TEST(ShellIntegrationWinTest, GetAppModelIdForProfileTest) {
ShellIntegration::GetAppModelIdForProfile(base_app_id,
profile_path));
}
+
+TEST(ShellIntegrationWinTest, GetAppListAppModelIdForProfileTest) {
+ string16 base_app_id(BrowserDistribution::GetDistribution()->GetBaseAppId());
+ base_app_id.append(L"AppList");
+
+ // Empty profile path should get chrome::kBrowserAppID + AppList
+ base::FilePath empty_path;
+ EXPECT_EQ(base_app_id,
+ ShellIntegration::GetAppListAppModelIdForProfile(empty_path));
+
+ // Default profile path should get chrome::kBrowserAppID + AppList
+ base::FilePath default_user_data_dir;
+ chrome::GetDefaultUserDataDirectory(&default_user_data_dir);
+ base::FilePath default_profile_path =
+ default_user_data_dir.AppendASCII(chrome::kInitialProfile);
+ EXPECT_EQ(base_app_id,
+ ShellIntegration::GetAppListAppModelIdForProfile(
+ default_profile_path));
+
+ // Non-default profile path should get chrome::kBrowserAppID + AppList joined
+ // with profile info.
+ base::FilePath profile_path(FILE_PATH_LITERAL("root"));
+ profile_path = profile_path.Append(FILE_PATH_LITERAL("udd"));
+ profile_path = profile_path.Append(FILE_PATH_LITERAL("User Data - Test"));
+ EXPECT_EQ(base_app_id + L".udd.UserDataTest",
+ ShellIntegration::GetAppListAppModelIdForProfile(profile_path));
+}