| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 GURL base_url = fileapi::GetFileSystemRootURI(origin_url, | 199 GURL base_url = fileapi::GetFileSystemRootURI(origin_url, |
| 200 fileapi::kFileSystemTypeExternal); | 200 fileapi::kFileSystemTypeExternal); |
| 201 *url = GURL(base_url.spec() + virtual_path.value()); | 201 *url = GURL(base_url.spec() + virtual_path.value()); |
| 202 return true; | 202 return true; |
| 203 } | 203 } |
| 204 | 204 |
| 205 bool ConvertFileToRelativeFileSystemPath( | 205 bool ConvertFileToRelativeFileSystemPath( |
| 206 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { | 206 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { |
| 207 fileapi::FileSystemPathManager* path_manager = | |
| 208 profile->GetFileSystemContext()->path_manager(); | |
| 209 fileapi::ExternalFileSystemMountPointProvider* provider = | 207 fileapi::ExternalFileSystemMountPointProvider* provider = |
| 210 path_manager->external_provider(); | 208 profile->GetFileSystemContext()->external_provider(); |
| 211 if (!provider) | 209 if (!provider) |
| 212 return false; | 210 return false; |
| 213 | 211 |
| 214 // Find if this file path is managed by the external provider. | 212 // Find if this file path is managed by the external provider. |
| 215 if (!provider->GetVirtualPath(full_file_path, virtual_path)) | 213 if (!provider->GetVirtualPath(full_file_path, virtual_path)) |
| 216 return false; | 214 return false; |
| 217 | 215 |
| 218 return true; | 216 return true; |
| 219 } | 217 } |
| 220 | 218 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 size_t extension_index = UMAExtensionIndex(ext.data(), | 339 size_t extension_index = UMAExtensionIndex(ext.data(), |
| 342 kUMATrackingExtensions, | 340 kUMATrackingExtensions, |
| 343 arraysize(kUMATrackingExtensions)); | 341 arraysize(kUMATrackingExtensions)); |
| 344 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType", | 342 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType", |
| 345 extension_index, | 343 extension_index, |
| 346 arraysize(kUMATrackingExtensions) - 1); | 344 arraysize(kUMATrackingExtensions) - 1); |
| 347 return false; | 345 return false; |
| 348 } | 346 } |
| 349 | 347 |
| 350 } // namespace file_manager_util | 348 } // namespace file_manager_util |
| 351 | |
| OLD | NEW |