summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/aeropeek_manager.cc6
-rw-r--r--chrome/browser/browser.cc3
-rw-r--r--chrome/browser/shell_integration.h2
-rw-r--r--chrome/browser/shell_integration_unittest.cc11
-rw-r--r--chrome/browser/shell_integration_win.cc10
-rw-r--r--chrome/browser/web_applications/web_app.cc4
-rw-r--r--chrome/common/chrome_constants.cc5
-rw-r--r--chrome/common/chrome_constants.h1
-rw-r--r--chrome/installer/util/browser_distribution.cc4
-rw-r--r--chrome/installer/util/browser_distribution.h2
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc5
-rw-r--r--chrome/installer/util/google_chrome_distribution.h2
-rw-r--r--chrome/installer/util/google_chrome_sxs_distribution.cc5
-rw-r--r--chrome/installer/util/google_chrome_sxs_distribution.h1
-rw-r--r--chrome/installer/util/shell_util.cc34
15 files changed, 58 insertions, 37 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc
index e0296c8..b9e6b14 100644
--- a/chrome/browser/aeropeek_manager.cc
+++ b/chrome/browser/aeropeek_manager.cc
@@ -26,6 +26,7 @@
#include "chrome/browser/tab_contents/thumbnail_generator.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "gfx/gdi_util.h"
#include "gfx/icon_util.h"
#include "skia/ext/image_operations.h"
@@ -244,7 +245,10 @@ class RegisterThumbnailTask : public Task {
// that this window is a child of the browser application, i.e. to tell
// that this thumbnail window should be displayed when we hover the
// browser icon in the taskbar.
- win_util::SetAppIdForWindow(chrome::kBrowserAppID, window_);
+ // TODO(mattm): This should use ShellIntegration::GetChromiumAppId to work
+ // properly with multiple profiles.
+ win_util::SetAppIdForWindow(
+ BrowserDistribution::GetDistribution()->GetBrowserAppId(), window_);
// Register this place-holder window to the taskbar as a child of
// the browser window and add it to the end of its tab list.
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 9a2e9ad..63fbf03 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -337,8 +337,7 @@ void Browser::CreateBrowserWindow() {
// name. See http://crbug.com/7028.
win_util::SetAppIdForWindow(
type_ & TYPE_APP ?
- ShellIntegration::GetAppId(app_name_.c_str(),
- profile_->GetPath()) :
+ ShellIntegration::GetAppId(app_name_, profile_->GetPath()) :
ShellIntegration::GetChromiumAppId(profile_->GetPath()),
window()->GetNativeHandle());
#endif
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h
index 7465e11..670063e 100644
--- a/chrome/browser/shell_integration.h
+++ b/chrome/browser/shell_integration.h
@@ -97,7 +97,7 @@ class ShellIntegration {
// Generates Win7 app id for given app name and profile path. The returned app
// id is in the format of "|app_name|[.<profile_id>]". "profile_id" is
// appended when user override the default value.
- static std::wstring GetAppId(const wchar_t* app_name,
+ static std::wstring GetAppId(const std::wstring& app_name,
const FilePath& profile_path);
// Generates Win7 app id for Chromium by calling GetAppId with
diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc
index 4776d8d..f17680f 100644
--- a/chrome/browser/shell_integration_unittest.cc
+++ b/chrome/browser/shell_integration_unittest.cc
@@ -18,7 +18,9 @@
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if defined(OS_LINUX)
+#if defined(OS_WIN)
+#include "chrome/installer/util/browser_distribution.h"
+#elif defined(OS_LINUX)
#include "base/env_var.h"
#endif // defined(OS_LINUX)
@@ -285,7 +287,7 @@ TEST(ShellIntegrationTest, GetDesktopFileContents) {
TEST(ShellIntegrationTest, GetChromiumAppIdTest) {
// Empty profile path should get chrome::kBrowserAppID
FilePath empty_path;
- EXPECT_EQ(std::wstring(chrome::kBrowserAppID),
+ EXPECT_EQ(BrowserDistribution::GetDistribution()->GetBrowserAppId(),
ShellIntegration::GetChromiumAppId(empty_path));
// Default profile path should get chrome::kBrowserAppID
@@ -293,7 +295,7 @@ TEST(ShellIntegrationTest, GetChromiumAppIdTest) {
chrome::GetDefaultUserDataDirectory(&default_user_data_dir);
FilePath default_profile_path =
default_user_data_dir.Append(chrome::kNotSignedInProfile);
- EXPECT_EQ(std::wstring(chrome::kBrowserAppID),
+ EXPECT_EQ(BrowserDistribution::GetDistribution()->GetBrowserAppId(),
ShellIntegration::GetChromiumAppId(default_profile_path));
// Non-default profile path should get chrome::kBrowserAppID joined with
@@ -301,7 +303,8 @@ TEST(ShellIntegrationTest, GetChromiumAppIdTest) {
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(std::wstring(chrome::kBrowserAppID) + L".udd.UserDataTest",
+ EXPECT_EQ(BrowserDistribution::GetDistribution()->GetBrowserAppId() +
+ L".udd.UserDataTest",
ShellIntegration::GetChromiumAppId(profile_path));
}
#endif
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 8d3a67a..d7aa86e 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -227,11 +227,10 @@ bool MigrateChromiumShortcutsTask::GetExpectedAppId(
app_name = web_app::GenerateApplicationNameFromURL(
GURL(command_line.GetSwitchValueASCII(switches::kApp)));
} else {
- app_name = chrome::kBrowserAppID;
+ app_name = BrowserDistribution::GetDistribution()->GetBrowserAppId();
}
- expected_app_id->assign(ShellIntegration::GetAppId(app_name.c_str(),
- profile_path));
+ expected_app_id->assign(ShellIntegration::GetAppId(app_name, profile_path));
return true;
}
@@ -386,7 +385,7 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() {
return ff_default;
}
-std::wstring ShellIntegration::GetAppId(const wchar_t* app_name,
+std::wstring ShellIntegration::GetAppId(const std::wstring& app_name,
const FilePath& profile_path) {
std::wstring app_id(app_name);
@@ -402,7 +401,8 @@ std::wstring ShellIntegration::GetAppId(const wchar_t* app_name,
}
std::wstring ShellIntegration::GetChromiumAppId(const FilePath& profile_path) {
- return GetAppId(chrome::kBrowserAppID, profile_path);
+ return GetAppId(BrowserDistribution::GetDistribution()->GetBrowserAppId(),
+ profile_path);
}
void ShellIntegration::MigrateChromiumShortcuts() {
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
index 5b2ecac..e1dc105 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -375,7 +375,7 @@ bool CreateShortcutTask::CreateShortcut() {
// Generates app id from web app url and profile path.
std::wstring app_id = ShellIntegration::GetAppId(
- web_app::GenerateApplicationNameFromURL(shortcut_info_.url).c_str(),
+ web_app::GenerateApplicationNameFromURL(shortcut_info_.url),
profile_path_);
FilePath shortcut_to_pin;
@@ -632,7 +632,7 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() {
if (!shortcut_files_.empty()) {
// Generates app id from web app url and profile path.
std::wstring app_id = ShellIntegration::GetAppId(
- web_app::GenerateApplicationNameFromURL(shortcut_info_.url).c_str(),
+ web_app::GenerateApplicationNameFromURL(shortcut_info_.url),
profile_path_);
// Sanitize description
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 3fff399..930fc56 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -62,11 +62,6 @@ const char kStatsFilename[] = "ChromiumStats2";
#endif
#if defined(OS_WIN)
-#if defined(GOOGLE_CHROME_BUILD)
-const wchar_t kBrowserAppID[] = L"Chrome";
-#else
-const wchar_t kBrowserAppID[] = L"Chromium";
-#endif
const wchar_t kStatusTrayWindowClass[] = L"Chrome_StatusTrayWindow";
#endif // defined(OS_WIN)
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index 8ffe8a5..46649d2 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -22,7 +22,6 @@ extern const FilePath::CharType kFrameworkName[];
#endif
extern const wchar_t kBrowserAppName[];
#if defined(OS_WIN)
-extern const wchar_t kBrowserAppID[];
extern const wchar_t kStatusTrayWindowClass[];
#endif // defined(OS_WIN)
extern const wchar_t kMessageWindowClass[];
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index da35d7a..4220005 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -71,6 +71,10 @@ std::wstring BrowserDistribution::GetAlternateApplicationName() {
return L"The Internet";
}
+std::wstring BrowserDistribution::GetBrowserAppId() {
+ return L"Chromium";
+}
+
std::wstring BrowserDistribution::GetInstallSubDir() {
return L"Chromium";
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index c9be526..bedfee4 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -31,6 +31,8 @@ class BrowserDistribution {
virtual std::wstring GetAlternateApplicationName();
+ virtual std::wstring GetBrowserAppId();
+
virtual std::wstring GetInstallSubDir();
virtual std::wstring GetPublisherName();
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index b1b22df..bd085e0 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -37,6 +37,7 @@
namespace {
const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
+const wchar_t kBrowserAppId[] = L"Chrome";
// The following strings are the possible outcomes of the toast experiment
// as recorded in the |client| field. Previously the groups used "TSxx" but
@@ -357,6 +358,10 @@ std::wstring GoogleChromeDistribution::GetAlternateApplicationName() {
return alt_product_name;
}
+std::wstring GoogleChromeDistribution::GetBrowserAppId() {
+ return kBrowserAppId;
+}
+
std::wstring GoogleChromeDistribution::GetInstallSubDir() {
std::wstring sub_dir(installer_util::kGoogleChromeInstallSubDir1);
sub_dir.append(L"\\");
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index fec4df2..75999da 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -36,6 +36,8 @@ class GoogleChromeDistribution : public BrowserDistribution {
virtual std::wstring GetAlternateApplicationName();
+ virtual std::wstring GetBrowserAppId();
+
virtual std::wstring GetInstallSubDir();
// This method generates the new value for Google Update "ap" key for Chrome
diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc
index 381f171..b979405 100644
--- a/chrome/installer/util/google_chrome_sxs_distribution.cc
+++ b/chrome/installer/util/google_chrome_sxs_distribution.cc
@@ -12,6 +12,7 @@ namespace {
const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
const wchar_t kChannelName[] = L"canary";
+const wchar_t kBrowserAppId[] = L"ChromeCanary";
const int kSxSIconIndex = 4;
} // namespace
@@ -26,6 +27,10 @@ std::wstring GoogleChromeSxSDistribution::GetAppShortCutName() {
return shortcut_name;
}
+std::wstring GoogleChromeSxSDistribution::GetBrowserAppId() {
+ return kBrowserAppId;
+}
+
std::wstring GoogleChromeSxSDistribution::GetInstallSubDir() {
return GoogleChromeDistribution::GetInstallSubDir().append(
installer_util::kSxSSuffix);
diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h
index 0e8ce49..7b1d408 100644
--- a/chrome/installer/util/google_chrome_sxs_distribution.h
+++ b/chrome/installer/util/google_chrome_sxs_distribution.h
@@ -20,6 +20,7 @@
class GoogleChromeSxSDistribution : public GoogleChromeDistribution {
public:
virtual std::wstring GetAppShortCutName();
+ virtual std::wstring GetBrowserAppId();
virtual std::wstring GetInstallSubDir();
virtual std::wstring GetUninstallRegPath();
virtual std::wstring GetEnvVersionKey();
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 561f2e9..dda1d1e 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -778,22 +778,24 @@ bool ShellUtil::UpdateChromeShortcut(const std::wstring& chrome_exe,
installer_util::master_preferences::kChromeShortcutIconIndex,
&icon_index);
if (create_new) {
- return file_util::CreateShortcutLink(chrome_exe.c_str(), // target
- shortcut.c_str(), // shortcut
- chrome_path.c_str(), // working dir
- NULL, // arguments
- description.c_str(), // description
- chrome_exe.c_str(), // icon file
- icon_index, // icon index
- chrome::kBrowserAppID); // app id
+ return file_util::CreateShortcutLink(
+ chrome_exe.c_str(), // target
+ shortcut.c_str(), // shortcut
+ chrome_path.c_str(), // working dir
+ NULL, // arguments
+ description.c_str(), // description
+ chrome_exe.c_str(), // icon file
+ icon_index, // icon index
+ dist->GetBrowserAppId().c_str()); // app id
} else {
- return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target
- shortcut.c_str(), // shortcut
- chrome_path.c_str(), // working dir
- NULL, // arguments
- description.c_str(), // description
- chrome_exe.c_str(), // icon file
- icon_index, // icon index
- chrome::kBrowserAppID); // app id
+ return file_util::UpdateShortcutLink(
+ chrome_exe.c_str(), // target
+ shortcut.c_str(), // shortcut
+ chrome_path.c_str(), // working dir
+ NULL, // arguments
+ description.c_str(), // description
+ chrome_exe.c_str(), // icon file
+ icon_index, // icon index
+ dist->GetBrowserAppId().c_str()); // app id
}
}