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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 !file_util::CreateDirectory(cache_root_directory.Append( | 105 !file_util::CreateDirectory(cache_root_directory.Append( |
106 kCacheFileDirectory)) || | 106 kCacheFileDirectory)) || |
107 !file_util::CreateDirectory(cache_root_directory.Append( | 107 !file_util::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 file_util::SetPosixFilePermissions( | 115 base::SetPosixFilePermissions( |
116 cache_root_directory.Append(kCacheFileDirectory), | 116 cache_root_directory.Append(kCacheFileDirectory), |
117 file_util::FILE_PERMISSION_USER_MASK | | 117 base::FILE_PERMISSION_USER_MASK | |
118 file_util::FILE_PERMISSION_EXECUTE_BY_GROUP | | 118 base::FILE_PERMISSION_EXECUTE_BY_GROUP | |
119 file_util::FILE_PERMISSION_EXECUTE_BY_OTHERS); | 119 base::FILE_PERMISSION_EXECUTE_BY_OTHERS); |
120 | 120 |
121 internal::ResourceMetadataStorage::UpgradeOldDB( | 121 internal::ResourceMetadataStorage::UpgradeOldDB( |
122 metadata_storage->directory_path(), id_canonicalizer); | 122 metadata_storage->directory_path(), id_canonicalizer); |
123 | 123 |
124 if (!metadata_storage->Initialize()) { | 124 if (!metadata_storage->Initialize()) { |
125 LOG(WARNING) << "Failed to initialize the metadata storage."; | 125 LOG(WARNING) << "Failed to initialize the metadata storage."; |
126 return FILE_ERROR_FAILED; | 126 return FILE_ERROR_FAILED; |
127 } | 127 } |
128 | 128 |
129 if (!cache->Initialize()) { | 129 if (!cache->Initialize()) { |
(...skipping 464 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 |