Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 10829160: Created a helper function "FindDiskBySourcePath" in DiskMountManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 const DiskMountManager::Disk* GetVolumeAsDisk(const std::string& mount_path) { 104 const DiskMountManager::Disk* GetVolumeAsDisk(const std::string& mount_path) {
105 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); 105 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance();
106 106
107 DiskMountManager::MountPointMap::const_iterator mount_point_it = 107 DiskMountManager::MountPointMap::const_iterator mount_point_it =
108 disk_mount_manager->mount_points().find(mount_path); 108 disk_mount_manager->mount_points().find(mount_path);
109 if (mount_point_it == disk_mount_manager->mount_points().end()) 109 if (mount_point_it == disk_mount_manager->mount_points().end())
110 return NULL; 110 return NULL;
111 111
112 DiskMountManager::DiskMap::const_iterator disk_it = 112 const DiskMountManager::Disk* disk = disk_mount_manager->FindDiskBySourcePath(
113 disk_mount_manager->disks().find(mount_point_it->second.source_path); 113 mount_point_it->second.source_path);
114 114
115 if (disk_it == disk_mount_manager->disks().end() || 115 return disk && disk->is_hidden() ? NULL : disk;
Ben Chan 2012/08/03 15:04:55 return (disk && disk->is_hidden()) ? NULL : disk;
kmadhusu 2012/08/03 18:13:52 Done.
116 disk_it->second->is_hidden()) {
117 return NULL;
118 }
119
120 return disk_it->second;
121 } 116 }
122 117
123 base::DictionaryValue* CreateValueFromDisk( 118 base::DictionaryValue* CreateValueFromDisk(
124 Profile* profile, 119 Profile* profile,
125 const DiskMountManager::Disk* volume) { 120 const DiskMountManager::Disk* volume) {
126 base::DictionaryValue* volume_info = new base::DictionaryValue(); 121 base::DictionaryValue* volume_info = new base::DictionaryValue();
127 122
128 std::string mount_path; 123 std::string mount_path;
129 if (!volume->mount_path().empty()) { 124 if (!volume->mount_path().empty()) {
130 FilePath relative_mount_path; 125 FilePath relative_mount_path;
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 gdata::GDataSystemService* system_service = 2409 gdata::GDataSystemService* system_service =
2415 gdata::GDataSystemServiceFactory::GetForProfile(profile_); 2410 gdata::GDataSystemServiceFactory::GetForProfile(profile_);
2416 if (!system_service || !system_service->file_system()) 2411 if (!system_service || !system_service->file_system())
2417 return false; 2412 return false;
2418 2413
2419 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); 2414 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string));
2420 system_service->file_system()->RequestDirectoryRefresh(directory_path); 2415 system_service->file_system()->RequestDirectoryRefresh(directory_path);
2421 2416
2422 return true; 2417 return true;
2423 } 2418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698