Allow user data dir to be specified in the environment.

This allows us to address one of the top user-reported problems with
Chrome Remote Desktop on Linux; namely that when users run Chrome
inside their virtual desktop, it simply opens a new window in their
existing Chrome instance (or, worse, if the first run of Chrome is in
their virtual session, then it prevents them running Chrome on the
console).

Once this change hits Stable, we will be able to update our
virtual session start-up scripts to set the environment variable,
letting the user run Chrome on both their console and virtual
desktops. They can then use Chrome Sync to keep bookmarks etc.
synchronized.

BUG=253614

Review URL: https://chromiumcodereview.appspot.com/23651006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222160 0039d316-1c4b-4281-b951-d872f2087c98
parent 1525185a
......@@ -5,6 +5,7 @@
#include "chrome/app/chrome_main_delegate.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
......@@ -608,6 +609,19 @@ void ChromeMainDelegate::PreSandboxStartup() {
// Notice a user data directory override if any
base::FilePath user_data_dir =
command_line.GetSwitchValuePath(switches::kUserDataDir);
#if defined(OS_LINUX)
// On Linux, Chrome does not support running multiple copies under different
// DISPLAYs, so the profile directory can be specified in the environment to
// support the virtual desktop use-case.
if (user_data_dir.empty()) {
std::string user_data_dir_string;
scoped_ptr<base::Environment> environment(base::Environment::Create());
if (environment->GetVar("CHROME_USER_DATA_DIR", &user_data_dir_string) &&
IsStringUTF8(user_data_dir_string)) {
user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string);
}
}
#endif
#if defined(OS_MACOSX) || defined(OS_WIN)
policy::path_parser::CheckUserDataDirPolicy(&user_data_dir);
#endif
......
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