From 72f582938721f2ad69e3eb034d0562938ae1c4f7 Mon Sep 17 00:00:00 2001 From: "pastarmovj@chromium.org" Date: Fri, 4 May 2012 15:14:59 +0000 Subject: Revert 135321 - Make sure only the main browser process and service proceses are allowed to create the profile directory. This patch lets Chrome start with profile located on a network share on Windows Vista and newer. BUG=120388 TEST=Start Chrome with --user-data-dir pointing to a network share location and try to navigate to a web page. This should not lead to a hang of the renderer. Review URL: http://codereview.chromium.org/10306009 TBR=pastarmovj@chromium.org Review URL: https://chromiumcodereview.appspot.com/10382012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135347 0039d316-1c4b-4281-b951-d872f2087c98 --- base/path_service.cc | 25 +++++++------------------ base/path_service.h | 9 +-------- 2 files changed, 8 insertions(+), 26 deletions(-) (limited to 'base') diff --git a/base/path_service.cc b/base/path_service.cc index a3b882c..46f394c 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -222,29 +222,18 @@ bool PathService::Get(int key, FilePath* result) { } bool PathService::Override(int key, const FilePath& path) { - // Just call the full function with true for the value of |create|. - return OverrideAndCreateIfNeeded(key, path, true); -} - -bool PathService::OverrideAndCreateIfNeeded(int key, - const FilePath& path, - bool create) { PathData* path_data = GetPathData(); DCHECK(path_data); DCHECK_GT(key, base::DIR_CURRENT) << "invalid path key"; FilePath file_path = path; - // For some locations this will fail if called from inside the sandbox there- - // fore we protect this call with a flag. - if (create) { - // Make sure the directory exists. We need to do this before we translate - // this to the absolute path because on POSIX, AbsolutePath fails if called - // on a non-existent path. - if (!file_util::PathExists(file_path) && - !file_util::CreateDirectory(file_path)) - return false; - } + // Make sure the directory exists. We need to do this before we translate + // this to the absolute path because on POSIX, AbsolutePath fails if called + // on a non-existent path. + if (!file_util::PathExists(file_path) && + !file_util::CreateDirectory(file_path)) + return false; // We need to have an absolute path, as extensions and plugins don't like // relative paths, and will gladly crash the browser in CHECK()s if they get a diff --git a/base/path_service.h b/base/path_service.h index 03e4b44..4b29738 100644 --- a/base/path_service.h +++ b/base/path_service.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -40,13 +40,6 @@ class BASE_EXPORT PathService { // over the lifetime of the app, so this method should be used with caution. static bool Override(int key, const FilePath& path); - // This function does the same as PathService::Override but it takes an extra - // parameter |create| which guides whether the directory to be overriden must - // be created in case it doesn't exist already. - static bool OverrideAndCreateIfNeeded(int key, - const FilePath& path, - bool create); - // To extend the set of supported keys, you can register a path provider, // which is just a function mirroring PathService::Get. The ProviderFunc // returns false if it cannot provide a non-empty path for the given key. -- cgit v1.1