Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: webkit/chromeos/fileapi/cros_mount_point_provider.cc

Issue 10843041: Add OS_CHROMEOS case in file_util::GetHomeDir() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove unnecessary code. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h"
6 6
7 #include "base/chromeos/chromeos_version.h" 7 #include "base/chromeos/chromeos_version.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 12 matching lines...) Expand all
23 #include "webkit/fileapi/file_system_url.h" 23 #include "webkit/fileapi/file_system_url.h"
24 #include "webkit/fileapi/file_system_util.h" 24 #include "webkit/fileapi/file_system_util.h"
25 #include "webkit/fileapi/local_file_stream_writer.h" 25 #include "webkit/fileapi/local_file_stream_writer.h"
26 #include "webkit/fileapi/local_file_system_operation.h" 26 #include "webkit/fileapi/local_file_system_operation.h"
27 #include "webkit/glue/webkit_glue.h" 27 #include "webkit/glue/webkit_glue.h"
28 28
29 namespace { 29 namespace {
30 30
31 const char kChromeUIScheme[] = "chrome"; 31 const char kChromeUIScheme[] = "chrome";
32 32
33 // Returns the home directory path, or an empty string if the home directory
34 // is not found.
35 std::string GetHomeDirectory() {
36 if (base::chromeos::IsRunningOnChromeOS())
37 return "/home/chronos/user";
38
39 const char* home = getenv("HOME");
40 if (home)
41 return home;
42 return "";
43 }
44
45 } // namespace 33 } // namespace
46 34
47 namespace chromeos { 35 namespace chromeos {
48 36
49 CrosMountPointProvider::MountPoint::MountPoint( 37 CrosMountPointProvider::MountPoint::MountPoint(
50 const FilePath& in_web_root_path, 38 const FilePath& in_web_root_path,
51 const FilePath& in_local_root_path, 39 const FilePath& in_local_root_path,
52 FileSystemLocation in_location, 40 FileSystemLocation in_location,
53 fileapi::RemoteFileSystemProxyInterface* in_proxy) 41 fileapi::RemoteFileSystemProxyInterface* in_proxy)
54 : web_root_path(in_web_root_path), local_root_path(in_local_root_path), 42 : web_root_path(in_web_root_path), local_root_path(in_local_root_path),
55 location(in_location), remote_proxy(in_proxy) { 43 location(in_location), remote_proxy(in_proxy) {
56 } 44 }
57 45
58 CrosMountPointProvider::MountPoint::~MountPoint() { 46 CrosMountPointProvider::MountPoint::~MountPoint() {
59 } 47 }
60 48
61 CrosMountPointProvider::CrosMountPointProvider( 49 CrosMountPointProvider::CrosMountPointProvider(
62 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) 50 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy)
63 : special_storage_policy_(special_storage_policy), 51 : special_storage_policy_(special_storage_policy),
64 file_access_permissions_(new FileAccessPermissions()), 52 file_access_permissions_(new FileAccessPermissions()),
65 local_file_util_(new fileapi::LocalFileUtil()) { 53 local_file_util_(new fileapi::LocalFileUtil()) {
66 const std::string home = GetHomeDirectory(); 54 const std::string home = base::chromeos::GetHomeDirectory();
67 if (!home.empty()) { 55 if (!home.empty()) {
68 AddLocalMountPoint( 56 AddLocalMountPoint(
69 FilePath::FromUTF8Unsafe(home).AppendASCII("Downloads")); 57 FilePath::FromUTF8Unsafe(home).AppendASCII("Downloads"));
70 } 58 }
71 AddLocalMountPoint(FilePath(FILE_PATH_LITERAL("/media/archive"))); 59 AddLocalMountPoint(FilePath(FILE_PATH_LITERAL("/media/archive")));
72 AddLocalMountPoint(FilePath(FILE_PATH_LITERAL("/media/removable"))); 60 AddLocalMountPoint(FilePath(FILE_PATH_LITERAL("/media/removable")));
73 } 61 }
74 62
75 CrosMountPointProvider::~CrosMountPointProvider() { 63 CrosMountPointProvider::~CrosMountPointProvider() {
76 } 64 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 if (mount_prefix == filesystem_path) { 287 if (mount_prefix == filesystem_path) {
300 return true; 288 return true;
301 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { 289 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) {
302 return true; 290 return true;
303 } 291 }
304 } 292 }
305 return false; 293 return false;
306 } 294 }
307 295
308 } // namespace chromeos 296 } // namespace chromeos
OLDNEW
« base/chromeos/chromeos_version.h ('K') | « chrome/browser/chromeos/gdata/gdata_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698