Commit 972010e4 authored by Keishi Hattori's avatar Keishi Hattori Committed by Commit Bot

Revert "desktop-pwas: Multi-profile support for pwa file registration."

This reverts commit e4b16bb5.

Reason for revert: Suspecting cause for ShellUtilRegistryTest.GetFileAssociationsAndAppName and WebAppFileHandlerRegistrationWinTest.* test failures

Original change's description:
> desktop-pwas: Multi-profile support for pwa file registration.
> 
> When the same app is installed in multiple profiles, the open with
> context menu needs to distinguish between the different profiles.
> We do this by adding the profile name in parentheses after the app name,
> e.g., "foo app (Profile1)". This CL detects when registering and
> unregistering an app changes the app from being installed in
> multiple profiles or just a single profile, and updates the app name.
> 
> This is similar to the way we badge/unbadge pinned taskbar icons when
> the user switches between having multiple profiles and
> having a single-profile.
> 
> Bug: 960245
> Change-Id: I4c2a50c55cd8ab45be05eb023b162afc4f634cd0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023283
> Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
> Reviewed-by: Alexey Baskakov <loyso@chromium.org>
> Reviewed-by: Greg Thompson <grt@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#738802}

TBR=loyso@chromium.org,grt@chromium.org,davidbienvenu@chromium.org

Change-Id: Ia7c5c0146c9dd481605c7205cb2bf3aff13bff74
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 960245
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2041050Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738852}
parent de92fbd7
......@@ -14,9 +14,8 @@
namespace web_app {
// Returns the Windows ProgId for the web app with the passed |app_id| in
// |profile_path|.
base::string16 GetProgIdForApp(const base::FilePath& profile_path,
const AppId& app_id);
// |profile|.
base::string16 GetProgIdForApp(Profile* profile, const AppId& app_id);
// The name of "Last Browser" file, where UpdateChromeExePath() stores the path
// of the last Chrome executable to use the containing user-data directory.
......
......@@ -1541,13 +1541,6 @@ ShellUtil::ShortcutProperties::ShortcutProperties(
ShellUtil::ShortcutProperties::~ShortcutProperties() {
}
ShellUtil::FileAssociationsAndAppName::FileAssociationsAndAppName() = default;
ShellUtil::FileAssociationsAndAppName::FileAssociationsAndAppName(
FileAssociationsAndAppName&& other) = default;
ShellUtil::FileAssociationsAndAppName::~FileAssociationsAndAppName() = default;
bool ShellUtil::QuickIsChromeRegisteredInHKLM(const base::FilePath& chrome_exe,
const base::string16& suffix) {
return QuickIsChromeRegistered(chrome_exe, suffix,
......@@ -2486,43 +2479,6 @@ bool ShellUtil::DeleteFileAssociations(const base::string16& prog_id) {
WorkItem::kWow64Default);
}
// static
ShellUtil::FileAssociationsAndAppName ShellUtil::GetFileAssociationsAndAppName(
const base::string16& prog_id) {
FileAssociationsAndAppName file_associations_and_app_name;
// Get list of handled file extensions from value FileExtensions at
// HKEY_CURRENT_USER\Software\Classes\|prog_id|.
base::string16 prog_id_path(kRegClasses);
prog_id_path.push_back(base::FilePath::kSeparators[0]);
prog_id_path.append(prog_id);
RegKey file_extensions_key(HKEY_CURRENT_USER, prog_id_path.c_str(),
KEY_QUERY_VALUE);
base::string16 handled_file_extensions;
if (file_extensions_key.ReadValue(
L"FileExtensions", &handled_file_extensions) != ERROR_SUCCESS) {
return FileAssociationsAndAppName();
}
std::vector<base::StringPiece16> file_associations_vec =
base::SplitStringPiece(base::StringPiece16(handled_file_extensions),
base::StringPiece16(L";"), base::TRIM_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
for (const auto& file_extension : file_associations_vec) {
// Skip over the leading '.' so that we return the same
// extensions as were passed to AddFileAssociations.
file_associations_and_app_name.file_associations.emplace(
file_extension.substr(1));
}
prog_id_path.append(kRegApplication);
RegKey prog_id_key(HKEY_CURRENT_USER, prog_id_path.c_str(), KEY_QUERY_VALUE);
if (prog_id_key.ReadValue(kRegApplicationName,
&file_associations_and_app_name.app_name) !=
ERROR_SUCCESS) {
return FileAssociationsAndAppName();
}
return file_associations_and_app_name;
}
// static
base::FilePath ShellUtil::GetApplicationPathForProgId(
const base::string16& prog_id) {
......
......@@ -222,15 +222,6 @@ class ShellUtil {
uint32_t options;
};
struct FileAssociationsAndAppName {
FileAssociationsAndAppName();
FileAssociationsAndAppName(FileAssociationsAndAppName&& other);
~FileAssociationsAndAppName();
std::set<base::string16> file_associations;
base::string16 app_name;
};
// Relative path of the URL Protocol registry entry (prefixed with '\').
static const wchar_t* kRegURLProtocol;
......@@ -660,12 +651,6 @@ class ShellUtil {
// with this name will be deleted.
static bool DeleteFileAssociations(const base::string16& prog_id);
// Returns the app name and file associations registered for a particular
// application in the Windows registry. If there is no entry in the registry
// for |prog_id|, nothing will be returned.
static FileAssociationsAndAppName GetFileAssociationsAndAppName(
const base::string16& prog_id);
// Retrieves the file path of the application registered as the
// shell->open->command for |prog_id|. This only queries the user's
// registered applications in HKCU. If |prog_id| is for an app that is
......
......@@ -940,22 +940,6 @@ TEST_F(ShellUtilRegistryTest, DeleteFileAssociations) {
EXPECT_EQ(L"SomeOtherApp", value);
}
TEST_F(ShellUtilRegistryTest, GetFileAssociationsAndAppName) {
ShellUtil::FileAssociationsAndAppName empty_file_associations_and_app_name(
ShellUtil::GetFileAssociationsAndAppName(kTestProgid));
EXPECT_TRUE(empty_file_associations_and_app_name.app_name.empty());
// Add file associations and test that GetFileAssociationsAndAppName returns
// the registered file associations and app name.
ASSERT_TRUE(ShellUtil::AddFileAssociations(
kTestProgid, OpenCommand(), kTestApplicationName, kTestFileTypeName,
base::FilePath(kTestIconPath), FileExtensions()));
ShellUtil::FileAssociationsAndAppName file_associations_and_app_name(
ShellUtil::GetFileAssociationsAndAppName(kTestProgid));
EXPECT_EQ(file_associations_and_app_name.app_name, kTestApplicationName);
EXPECT_EQ(file_associations_and_app_name.file_associations, FileExtensions());
}
TEST_F(ShellUtilRegistryTest, GetApplicationForProgId) {
// Create file associations.
ASSERT_TRUE(ShellUtil::AddFileAssociations(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment