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/extensions/file_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 } | 101 } |
102 | 102 |
103 const DiskMountManager::Disk* GetVolumeAsDisk(const std::string& mount_path) { | 103 const DiskMountManager::Disk* GetVolumeAsDisk(const std::string& mount_path) { |
104 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); | 104 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
105 | 105 |
106 DiskMountManager::MountPointMap::const_iterator mount_point_it = | 106 DiskMountManager::MountPointMap::const_iterator mount_point_it = |
107 disk_mount_manager->mount_points().find(mount_path); | 107 disk_mount_manager->mount_points().find(mount_path); |
108 if (mount_point_it == disk_mount_manager->mount_points().end()) | 108 if (mount_point_it == disk_mount_manager->mount_points().end()) |
109 return NULL; | 109 return NULL; |
110 | 110 |
111 DiskMountManager::DiskMap::const_iterator disk_it = | 111 const DiskMountManager::Disk* disk = disk_mount_manager->FindDiskBySourcePath( |
112 disk_mount_manager->disks().find(mount_point_it->second.source_path); | 112 mount_point_it->second.source_path); |
113 | 113 |
114 if (disk_it == disk_mount_manager->disks().end() || | 114 return (disk && disk->is_hidden()) ? NULL : disk; |
tbarzic
2012/08/06 18:12:08
please make sure ExtensionFileBrowserPrivateApiTes
| |
115 disk_it->second->is_hidden()) { | |
116 return NULL; | |
117 } | |
118 | |
119 return disk_it->second; | |
120 } | 115 } |
121 | 116 |
122 base::DictionaryValue* CreateValueFromDisk( | 117 base::DictionaryValue* CreateValueFromDisk( |
123 Profile* profile, | 118 Profile* profile, |
124 const DiskMountManager::Disk* volume) { | 119 const DiskMountManager::Disk* volume) { |
125 base::DictionaryValue* volume_info = new base::DictionaryValue(); | 120 base::DictionaryValue* volume_info = new base::DictionaryValue(); |
126 | 121 |
127 std::string mount_path; | 122 std::string mount_path; |
128 if (!volume->mount_path().empty()) { | 123 if (!volume->mount_path().empty()) { |
129 FilePath relative_mount_path; | 124 FilePath relative_mount_path; |
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2426 gdata::GDataSystemService* system_service = | 2421 gdata::GDataSystemService* system_service = |
2427 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2422 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2428 if (!system_service || !system_service->file_system()) | 2423 if (!system_service || !system_service->file_system()) |
2429 return false; | 2424 return false; |
2430 | 2425 |
2431 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2426 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
2432 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2427 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
2433 | 2428 |
2434 return true; | 2429 return true; |
2435 } | 2430 } |
OLD | NEW |