| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/file_manager_util.h" | 4 #include "chrome/browser/extensions/file_manager_util.h" |
| 5 | 5 |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 GURL base_url = fileapi::GetFileSystemRootURI(origin_url, | 201 GURL base_url = fileapi::GetFileSystemRootURI(origin_url, |
| 202 fileapi::kFileSystemTypeExternal); | 202 fileapi::kFileSystemTypeExternal); |
| 203 *url = GURL(base_url.spec() + virtual_path.value()); | 203 *url = GURL(base_url.spec() + virtual_path.value()); |
| 204 return true; | 204 return true; |
| 205 } | 205 } |
| 206 | 206 |
| 207 bool ConvertFileToRelativeFileSystemPath( | 207 bool ConvertFileToRelativeFileSystemPath( |
| 208 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { | 208 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { |
| 209 fileapi::FileSystemPathManager* path_manager = | |
| 210 profile->GetFileSystemContext()->path_manager(); | |
| 211 fileapi::ExternalFileSystemMountPointProvider* provider = | 209 fileapi::ExternalFileSystemMountPointProvider* provider = |
| 212 path_manager->external_provider(); | 210 profile->GetFileSystemContext()->external_provider(); |
| 213 if (!provider) | 211 if (!provider) |
| 214 return false; | 212 return false; |
| 215 | 213 |
| 216 // Find if this file path is managed by the external provider. | 214 // Find if this file path is managed by the external provider. |
| 217 if (!provider->GetVirtualPath(full_file_path, virtual_path)) | 215 if (!provider->GetVirtualPath(full_file_path, virtual_path)) |
| 218 return false; | 216 return false; |
| 219 | 217 |
| 220 return true; | 218 return true; |
| 221 } | 219 } |
| 222 | 220 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 size_t extension_index = UMAExtensionIndex(ext.data(), | 341 size_t extension_index = UMAExtensionIndex(ext.data(), |
| 344 kUMATrackingExtensions, | 342 kUMATrackingExtensions, |
| 345 arraysize(kUMATrackingExtensions)); | 343 arraysize(kUMATrackingExtensions)); |
| 346 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType", | 344 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType", |
| 347 extension_index, | 345 extension_index, |
| 348 arraysize(kUMATrackingExtensions) - 1); | 346 arraysize(kUMATrackingExtensions) - 1); |
| 349 return false; | 347 return false; |
| 350 } | 348 } |
| 351 | 349 |
| 352 } // namespace file_manager_util | 350 } // namespace file_manager_util |
| 353 | |
| OLD | NEW |