OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/file_manager/private_api_util.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 | 122 |
123 void VolumeInfoToVolumeMetadata( | 123 void VolumeInfoToVolumeMetadata( |
124 Profile* profile, | 124 Profile* profile, |
125 const VolumeInfo& volume_info, | 125 const VolumeInfo& volume_info, |
126 file_browser_private::VolumeMetadata* volume_metadata) { | 126 file_browser_private::VolumeMetadata* volume_metadata) { |
127 DCHECK(volume_metadata); | 127 DCHECK(volume_metadata); |
128 DCHECK(!volume_info.mount_path.empty()); | 128 DCHECK(!volume_info.mount_path.empty()); |
129 | 129 |
130 // Convert mount point path to relative path with the external file system | |
131 // exposed within File API. | |
132 base::FilePath relative_mount_path; | |
133 if (ConvertAbsoluteFilePathToRelativeFileSystemPath( | |
134 profile, kFileManagerAppId, base::FilePath(volume_info.mount_path), | |
135 &relative_mount_path)) { | |
136 volume_metadata->mount_path = "/" + relative_mount_path.AsUTF8Unsafe(); | |
137 } | |
138 | |
139 volume_metadata->volume_id = volume_info.volume_id; | 130 volume_metadata->volume_id = volume_info.volume_id; |
140 | 131 |
141 // TODO(kinaba): fill appropriate information once multi-profile support is | 132 // TODO(kinaba): fill appropriate information once multi-profile support is |
142 // implemented. | 133 // implemented. |
143 volume_metadata->profile.display_name = profile->GetProfileName(); | 134 volume_metadata->profile.display_name = profile->GetProfileName(); |
144 volume_metadata->profile.is_current_profile = true; | 135 volume_metadata->profile.is_current_profile = true; |
145 | 136 |
146 if (!volume_info.source_path.empty()) { | 137 if (!volume_info.source_path.empty()) { |
147 volume_metadata->source_path.reset( | 138 volume_metadata->source_path.reset( |
148 new std::string(volume_info.source_path.AsUTF8Unsafe())); | 139 new std::string(volume_info.source_path.AsUTF8Unsafe())); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 274 |
284 drive::EventLogger* GetLogger(Profile* profile) { | 275 drive::EventLogger* GetLogger(Profile* profile) { |
285 drive::DriveIntegrationService* service = | 276 drive::DriveIntegrationService* service = |
286 drive::DriveIntegrationServiceFactory::FindForProfileRegardlessOfStates( | 277 drive::DriveIntegrationServiceFactory::FindForProfileRegardlessOfStates( |
287 profile); | 278 profile); |
288 return service ? service->event_logger() : NULL; | 279 return service ? service->event_logger() : NULL; |
289 } | 280 } |
290 | 281 |
291 } // namespace util | 282 } // namespace util |
292 } // namespace file_manager | 283 } // namespace file_manager |
OLD | NEW |