Commit f6646249 authored by Bernhard Bauer's avatar Bernhard Bauer Committed by Commit Bot

Disable profile shortcuts if the user data directory is overridden in any way.

Previously the profile shortcut manager was only disabled if the user
data directory was overridden via the --user-data-dir command line flag.
Some (unit) tests use ScopedPathOverride however, which bypasses the
command line flag.

We now compare the value of the USER_DATA_DIR path to the
programmatically-defined default value instead.

Bug: 733861
Change-Id: I85854ba0821a0e41d28abfd8d5ec2f0873941aab
Reviewed-on: https://chromium-review.googlesource.com/539342Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#480851}
parent 90dc367f
......@@ -31,6 +31,8 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/shell_integration_win.h"
#include "chrome/browser/win/app_icon.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/chrome_unscaled_resources.h"
......@@ -779,8 +781,16 @@ base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path) {
// static
bool ProfileShortcutManager::IsFeatureEnabled() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kEnableProfileShortcutManager) ||
!command_line->HasSwitch(switches::kUserDataDir);
if (command_line->HasSwitch(switches::kEnableProfileShortcutManager))
return true;
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;
}
// 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