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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 void FileBrowserEventRouter::OnDeviceAdded( | 579 void FileBrowserEventRouter::OnDeviceAdded( |
580 const std::string& device_path) { | 580 const std::string& device_path) { |
581 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 581 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
582 | 582 |
583 VLOG(1) << "Device added : " << device_path; | 583 VLOG(1) << "Device added : " << device_path; |
584 | 584 |
585 notifications_->RegisterDevice(device_path); | 585 notifications_->RegisterDevice(device_path); |
586 notifications_->ShowNotificationDelayed(FileBrowserNotifications::DEVICE, | 586 notifications_->ShowNotificationDelayed(FileBrowserNotifications::DEVICE, |
587 device_path, | 587 device_path, |
588 5000); | 588 base::TimeDelta::FromSeconds(5)); |
589 } | 589 } |
590 | 590 |
591 void FileBrowserEventRouter::OnDeviceRemoved( | 591 void FileBrowserEventRouter::OnDeviceRemoved( |
592 const std::string& device_path) { | 592 const std::string& device_path) { |
593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
594 | 594 |
595 VLOG(1) << "Device removed : " << device_path; | 595 VLOG(1) << "Device removed : " << device_path; |
596 notifications_->HideNotification(FileBrowserNotifications::DEVICE, | 596 notifications_->HideNotification(FileBrowserNotifications::DEVICE, |
597 device_path); | 597 device_path); |
598 notifications_->HideNotification(FileBrowserNotifications::DEVICE_FAIL, | 598 notifications_->HideNotification(FileBrowserNotifications::DEVICE_FAIL, |
(...skipping 24 matching lines...) Expand all Loading... |
623 const std::string& device_path, bool success) { | 623 const std::string& device_path, bool success) { |
624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
625 | 625 |
626 if (success) { | 626 if (success) { |
627 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, | 627 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, |
628 device_path); | 628 device_path); |
629 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_SUCCESS, | 629 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_SUCCESS, |
630 device_path); | 630 device_path); |
631 // Hide it after a couple of seconds. | 631 // Hide it after a couple of seconds. |
632 notifications_->HideNotificationDelayed( | 632 notifications_->HideNotificationDelayed( |
633 FileBrowserNotifications::FORMAT_SUCCESS, device_path, 4000); | 633 FileBrowserNotifications::FORMAT_SUCCESS, |
| 634 device_path, |
| 635 base::TimeDelta::FromSeconds(4)); |
634 // MountPath auto-detects filesystem format if second argument is empty. | 636 // MountPath auto-detects filesystem format if second argument is empty. |
635 // The third argument (mount label) is not used in a disk mount operation. | 637 // The third argument (mount label) is not used in a disk mount operation. |
636 DiskMountManager::GetInstance()->MountPath(device_path, std::string(), | 638 DiskMountManager::GetInstance()->MountPath(device_path, std::string(), |
637 std::string(), | 639 std::string(), |
638 chromeos::MOUNT_TYPE_DEVICE); | 640 chromeos::MOUNT_TYPE_DEVICE); |
639 } else { | 641 } else { |
640 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, | 642 notifications_->HideNotification(FileBrowserNotifications::FORMAT_START, |
641 device_path); | 643 device_path); |
642 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_FAIL, | 644 notifications_->ShowNotification(FileBrowserNotifications::FORMAT_FAIL, |
643 device_path); | 645 device_path); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 return scoped_refptr<RefcountedProfileKeyedService>( | 777 return scoped_refptr<RefcountedProfileKeyedService>( |
776 new FileBrowserEventRouter(profile)); | 778 new FileBrowserEventRouter(profile)); |
777 } | 779 } |
778 | 780 |
779 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 781 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
780 // Explicitly and always allow this router in guest login mode. see | 782 // Explicitly and always allow this router in guest login mode. see |
781 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 783 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
782 // for the details. | 784 // for the details. |
783 return true; | 785 return true; |
784 } | 786 } |
OLD | NEW |