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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 VLOG(1) << "Disk added: " << disk->device_path(); | 409 VLOG(1) << "Disk added: " << disk->device_path(); |
410 if (disk->device_path().empty()) { | 410 if (disk->device_path().empty()) { |
411 VLOG(1) << "Empty system path for " << disk->device_path(); | 411 VLOG(1) << "Empty system path for " << disk->device_path(); |
412 return; | 412 return; |
413 } | 413 } |
414 | 414 |
415 // If disk is not mounted yet and it has media, give it a try. | 415 // If disk is not mounted yet and it has media, give it a try. |
416 if (disk->mount_path().empty() && disk->has_media()) { | 416 if (disk->mount_path().empty() && disk->has_media()) { |
417 // Initiate disk mount operation. | 417 // Initiate disk mount operation. |
418 DiskMountManager::GetInstance()->MountPath( | 418 DiskMountManager::GetInstance()->MountPath( |
419 disk->device_path(), chromeos::MOUNT_TYPE_DEVICE); | 419 disk->device_path(), std::string(), chromeos::MOUNT_TYPE_DEVICE); |
Ben Chan
2012/04/17 20:57:53
nit: perhaps add a comment here to indicate that i
| |
420 } else { | 420 } else { |
421 // Either the disk was mounted or it has no media. In both cases we don't | 421 // Either the disk was mounted or it has no media. In both cases we don't |
422 // want the Scanning notification to persist. | 422 // want the Scanning notification to persist. |
423 notifications_->HideNotification(FileBrowserNotifications::DEVICE, | 423 notifications_->HideNotification(FileBrowserNotifications::DEVICE, |
424 disk->system_path_prefix()); | 424 disk->system_path_prefix()); |
425 } | 425 } |
426 DispatchDiskEvent(disk, true); | 426 DispatchDiskEvent(disk, true); |
427 } | 427 } |
428 | 428 |
429 void FileBrowserEventRouter::OnDiskRemoved( | 429 void FileBrowserEventRouter::OnDiskRemoved( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 const std::string& device_path, bool success) { | 476 const std::string& device_path, bool success) { |
477 if (success) { | 477 if (success) { |
478 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, | 478 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, |
479 device_path); | 479 device_path); |
480 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_SUCCESS, | 480 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_SUCCESS, |
481 device_path); | 481 device_path); |
482 // Hide it after a couple of seconds. | 482 // Hide it after a couple of seconds. |
483 notifications_->HideNotificationDelayed( | 483 notifications_->HideNotificationDelayed( |
484 FileBrowserNotifications::FORMAT_SUCCESS, device_path, 4000); | 484 FileBrowserNotifications::FORMAT_SUCCESS, device_path, 4000); |
485 | 485 |
486 DiskMountManager::GetInstance()->MountPath(device_path, | 486 DiskMountManager::GetInstance()->MountPath(device_path, std::string(), |
Ben Chan
2012/04/17 20:57:53
ditto
| |
487 chromeos::MOUNT_TYPE_DEVICE); | 487 chromeos::MOUNT_TYPE_DEVICE); |
488 } else { | 488 } else { |
489 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, | 489 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, |
490 device_path); | 490 device_path); |
491 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_FAIL, | 491 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_FAIL, |
492 device_path); | 492 device_path); |
493 } | 493 } |
494 } | 494 } |
495 | 495 |
496 // FileBrowserEventRouter::WatcherDelegate methods. | 496 // FileBrowserEventRouter::WatcherDelegate methods. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 return scoped_refptr<RefcountedProfileKeyedService>( | 617 return scoped_refptr<RefcountedProfileKeyedService>( |
618 new FileBrowserEventRouter(profile)); | 618 new FileBrowserEventRouter(profile)); |
619 } | 619 } |
620 | 620 |
621 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 621 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
622 // Explicitly and always allow this router in guest login mode. see | 622 // Explicitly and always allow this router in guest login mode. see |
623 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 623 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
624 // for the details. | 624 // for the details. |
625 return true; | 625 return true; |
626 } | 626 } |
OLD | NEW |