OLD | NEW |
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 "chrome/browser/chromeos/drive/drive_integration_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/prefs/pref_change_registrar.h" | 9 #include "base/prefs/pref_change_registrar.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 // Initializes FileCache and ResourceMetadata. | 94 // Initializes FileCache and ResourceMetadata. |
95 // Must be run on the same task runner used by |cache| and |resource_metadata|. | 95 // Must be run on the same task runner used by |cache| and |resource_metadata|. |
96 FileError InitializeMetadata( | 96 FileError InitializeMetadata( |
97 const base::FilePath& cache_root_directory, | 97 const base::FilePath& cache_root_directory, |
98 internal::ResourceMetadataStorage* metadata_storage, | 98 internal::ResourceMetadataStorage* metadata_storage, |
99 internal::FileCache* cache, | 99 internal::FileCache* cache, |
100 internal::ResourceMetadata* resource_metadata, | 100 internal::ResourceMetadata* resource_metadata, |
101 const ResourceIdCanonicalizer& id_canonicalizer, | 101 const ResourceIdCanonicalizer& id_canonicalizer, |
102 const base::FilePath& downloads_directory) { | 102 const base::FilePath& downloads_directory) { |
103 if (!file_util::CreateDirectory(cache_root_directory.Append( | 103 if (!base::CreateDirectory(cache_root_directory.Append( |
104 kMetadataDirectory)) || | 104 kMetadataDirectory)) || |
105 !file_util::CreateDirectory(cache_root_directory.Append( | 105 !base::CreateDirectory(cache_root_directory.Append( |
106 kCacheFileDirectory)) || | 106 kCacheFileDirectory)) || |
107 !file_util::CreateDirectory(cache_root_directory.Append( | 107 !base::CreateDirectory(cache_root_directory.Append( |
108 kTemporaryFileDirectory))) { | 108 kTemporaryFileDirectory))) { |
109 LOG(WARNING) << "Failed to create directories."; | 109 LOG(WARNING) << "Failed to create directories."; |
110 return FILE_ERROR_FAILED; | 110 return FILE_ERROR_FAILED; |
111 } | 111 } |
112 | 112 |
113 // Change permissions of cache file directory to u+rwx,og+x (711) in order to | 113 // Change permissions of cache file directory to u+rwx,og+x (711) in order to |
114 // allow archive files in that directory to be mounted by cros-disks. | 114 // allow archive files in that directory to be mounted by cros-disks. |
115 base::SetPosixFilePermissions( | 115 base::SetPosixFilePermissions( |
116 cache_root_directory.Append(kCacheFileDirectory), | 116 cache_root_directory.Append(kCacheFileDirectory), |
117 base::FILE_PERMISSION_USER_MASK | | 117 base::FILE_PERMISSION_USER_MASK | |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 NULL, base::FilePath(), NULL); | 594 NULL, base::FilePath(), NULL); |
595 } else { | 595 } else { |
596 service = factory_for_test_.Run(profile); | 596 service = factory_for_test_.Run(profile); |
597 } | 597 } |
598 | 598 |
599 service->SetEnabled(drive::util::IsDriveEnabledForProfile(profile)); | 599 service->SetEnabled(drive::util::IsDriveEnabledForProfile(profile)); |
600 return service; | 600 return service; |
601 } | 601 } |
602 | 602 |
603 } // namespace drive | 603 } // namespace drive |
OLD | NEW |