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_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 DiskMountManager::MountEvent event_type, | 291 DiskMountManager::MountEvent event_type, |
292 chromeos::MountError error_code, | 292 chromeos::MountError error_code, |
293 const DiskMountManager::MountPointInfo& mount_info) { | 293 const DiskMountManager::MountPointInfo& mount_info) { |
294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
295 | 295 |
296 DispatchMountCompletedEvent(event_type, error_code, mount_info); | 296 DispatchMountCompletedEvent(event_type, error_code, mount_info); |
297 | 297 |
298 if (mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE && | 298 if (mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE && |
299 event_type == DiskMountManager::MOUNTING) { | 299 event_type == DiskMountManager::MOUNTING) { |
300 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); | 300 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
301 DiskMountManager::DiskMap::const_iterator disk_it = | 301 DiskMountManager::Disk* disk = |
302 disk_mount_manager->disks().find(mount_info.source_path); | 302 disk_mount_manager->FindDiskBySourcePath(mount_info.source_path); |
303 if (disk_it == disk_mount_manager->disks().end()) { | 303 if (!disk) |
304 return; | 304 return; |
305 } | |
306 DiskMountManager::Disk* disk = disk_it->second; | |
307 | 305 |
308 notifications_->ManageNotificationsOnMountCompleted( | 306 notifications_->ManageNotificationsOnMountCompleted( |
309 disk->system_path_prefix(), disk->drive_label(), disk->is_parent(), | 307 disk->system_path_prefix(), disk->drive_label(), disk->is_parent(), |
310 error_code == chromeos::MOUNT_ERROR_NONE, | 308 error_code == chromeos::MOUNT_ERROR_NONE, |
311 error_code == chromeos::MOUNT_ERROR_UNSUPPORTED_FILESYSTEM); | 309 error_code == chromeos::MOUNT_ERROR_UNSUPPORTED_FILESYSTEM); |
312 } else if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { | 310 } else if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { |
313 // Clear the "mounted" state for archive files in gdata cache | 311 // Clear the "mounted" state for archive files in gdata cache |
314 // when mounting failed or unmounting succeeded. | 312 // when mounting failed or unmounting succeeded. |
315 if ((event_type == DiskMountManager::MOUNTING) != | 313 if ((event_type == DiskMountManager::MOUNTING) != |
316 (error_code == chromeos::MOUNT_ERROR_NONE)) { | 314 (error_code == chromeos::MOUNT_ERROR_NONE)) { |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 return scoped_refptr<RefcountedProfileKeyedService>( | 810 return scoped_refptr<RefcountedProfileKeyedService>( |
813 new FileBrowserEventRouter(profile)); | 811 new FileBrowserEventRouter(profile)); |
814 } | 812 } |
815 | 813 |
816 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 814 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
817 // Explicitly and always allow this router in guest login mode. see | 815 // Explicitly and always allow this router in guest login mode. see |
818 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 816 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
819 // for the details. | 817 // for the details. |
820 return true; | 818 return true; |
821 } | 819 } |
OLD | NEW |