Commit be2a23f2 authored by Anton Ohontsev's avatar Anton Ohontsev Committed by Commit Bot

Fix taskbar context menu icon for UserDataDir policy.

Back in 2012, we had a problem with the state of the created
shortcuts on the desktop: crbug.com/133585

As a fix, we create full-fledged shortcuts and icons only if
the profile with which the browser is launched is in the
DefaultUserFolder.
If the UserDataDir policy is used, a shortcut is created in
"%AppData%\Roaming\Microsoft\Internet Explorer\Quick Launch\
User Pinned\ImplicitAppShortcuts" with the path to the icon
%ProfilePath%\Default\Yandex Profile.ico, but the icon itself
is not created in the profile.

To fix this problem, we need to subscribe to create shortcuts
and enable the feature of creating shortcuts for a profile
from a policy, if such exists.

When using --user-data-dir, a different mechanism is used,
in this case the shortcut is not created, but the crhome.exe
icon is used.

BUG=1108485

Change-Id: I21d914d5a4d8b18960bda248a90bf320b649e323
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314516Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792243}
parent 885cf1f6
......@@ -29,6 +29,7 @@
#include "base/threading/scoped_blocking_call.h"
#include "base/win/shortcut.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/policy/policy_path_parser.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
......@@ -714,13 +715,17 @@ bool ProfileShortcutManager::IsFeatureEnabled() {
if (command_line->HasSwitch(switches::kEnableProfileShortcutManager))
return true;
base::FilePath policy_user_data_dir;
policy::path_parser::CheckUserDataDirPolicy(&policy_user_data_dir);
base::FilePath user_data_dir;
bool success = base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
DCHECK(success);
base::FilePath default_user_data_dir;
success = chrome::GetDefaultUserDataDirectory(&default_user_data_dir);
DCHECK(success);
return user_data_dir == default_user_data_dir;
return user_data_dir == default_user_data_dir ||
user_data_dir == policy_user_data_dir;
}
// static
......
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