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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 DiskMountManager::MountEvent event_type, | 333 DiskMountManager::MountEvent event_type, |
334 chromeos::MountError error_code, | 334 chromeos::MountError error_code, |
335 const DiskMountManager::MountPointInfo& mount_info) { | 335 const DiskMountManager::MountPointInfo& mount_info) { |
336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
337 | 337 |
338 DispatchMountCompletedEvent(event_type, error_code, mount_info); | 338 DispatchMountCompletedEvent(event_type, error_code, mount_info); |
339 | 339 |
340 if (mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE && | 340 if (mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE && |
341 event_type == DiskMountManager::MOUNTING) { | 341 event_type == DiskMountManager::MOUNTING) { |
342 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); | 342 DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
343 DiskMountManager::DiskMap::const_iterator disk_it = | 343 const DiskMountManager::Disk* disk = |
344 disk_mount_manager->disks().find(mount_info.source_path); | 344 disk_mount_manager->FindDiskBySourcePath(mount_info.source_path); |
345 if (disk_it == disk_mount_manager->disks().end()) { | 345 if (!disk) |
346 return; | 346 return; |
347 } | |
348 DiskMountManager::Disk* disk = disk_it->second; | |
349 | 347 |
350 notifications_->ManageNotificationsOnMountCompleted( | 348 notifications_->ManageNotificationsOnMountCompleted( |
351 disk->system_path_prefix(), disk->drive_label(), disk->is_parent(), | 349 disk->system_path_prefix(), disk->drive_label(), disk->is_parent(), |
352 error_code == chromeos::MOUNT_ERROR_NONE, | 350 error_code == chromeos::MOUNT_ERROR_NONE, |
353 error_code == chromeos::MOUNT_ERROR_UNSUPPORTED_FILESYSTEM); | 351 error_code == chromeos::MOUNT_ERROR_UNSUPPORTED_FILESYSTEM); |
354 } else if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { | 352 } else if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { |
355 // Clear the "mounted" state for archive files in gdata cache | 353 // Clear the "mounted" state for archive files in gdata cache |
356 // when mounting failed or unmounting succeeded. | 354 // when mounting failed or unmounting succeeded. |
357 if ((event_type == DiskMountManager::MOUNTING) != | 355 if ((event_type == DiskMountManager::MOUNTING) != |
358 (error_code == chromeos::MOUNT_ERROR_NONE)) { | 356 (error_code == chromeos::MOUNT_ERROR_NONE)) { |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 return scoped_refptr<RefcountedProfileKeyedService>( | 872 return scoped_refptr<RefcountedProfileKeyedService>( |
875 new FileBrowserEventRouter(profile)); | 873 new FileBrowserEventRouter(profile)); |
876 } | 874 } |
877 | 875 |
878 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 876 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
879 // Explicitly and always allow this router in guest login mode. see | 877 // Explicitly and always allow this router in guest login mode. see |
880 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 878 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
881 // for the details. | 879 // for the details. |
882 return true; | 880 return true; |
883 } | 881 } |
OLD | NEW |