diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-15 21:22:56 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-15 21:22:56 +0000 |
commit | da1ffc39431cad3ee0ca22f81179bfcaebf814b4 (patch) | |
tree | 05aec358c19d08cfa9d4d6d66dc986db52918a82 | |
parent | ada8d715379d1dcde5e62f36284f4df3c98c8c53 (diff) | |
download | chromium_src-da1ffc39431cad3ee0ca22f81179bfcaebf814b4.zip chromium_src-da1ffc39431cad3ee0ca22f81179bfcaebf814b4.tar.gz chromium_src-da1ffc39431cad3ee0ca22f81179bfcaebf814b4.tar.bz2 |
[win] Ensure canary app launcher shortcut has a different app model id to the official one.
This change uses the browser distribution to create the app model id. It does not change
the app model id used for chrome or chromium official channel builds, but does change
the app model id for canary distribution.
BUG=176456
Review URL: https://chromiumcodereview.appspot.com/12252064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182830 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/shell_integration_win.cc | 19 | ||||
-rw-r--r-- | chrome/browser/shell_integration_win_unittest.cc | 27 |
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)); +} |