| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager/event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 base::Bind(&EventRouter::SendDriveFileTransferEvent, | 664 base::Bind(&EventRouter::SendDriveFileTransferEvent, |
| 665 weak_factory_.GetWeakPtr()), | 665 weak_factory_.GetWeakPtr()), |
| 666 delay); | 666 delay); |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 | 669 |
| 670 void EventRouter::SendDriveFileTransferEvent() { | 670 void EventRouter::SendDriveFileTransferEvent() { |
| 671 if (!drive_job_info_for_scheduled_event_) | 671 if (!drive_job_info_for_scheduled_event_) |
| 672 return; | 672 return; |
| 673 | 673 |
| 674 // Convert the drive_job_info_for_scheduled_event_ to IDL type. | 674 file_browser_private::FileTransferStatus status; |
| 675 std::vector<linked_ptr<file_browser_private::FileTransferStatus> > | |
| 676 status_list; | |
| 677 | |
| 678 linked_ptr<file_browser_private::FileTransferStatus> status( | |
| 679 new file_browser_private::FileTransferStatus()); | |
| 680 JobInfoToTransferStatus(profile_, | 675 JobInfoToTransferStatus(profile_, |
| 681 kFileManagerAppId, | 676 kFileManagerAppId, |
| 682 drive_job_info_for_scheduled_event_->status, | 677 drive_job_info_for_scheduled_event_->status, |
| 683 drive_job_info_for_scheduled_event_->job_info, | 678 drive_job_info_for_scheduled_event_->job_info, |
| 684 status.get()); | 679 &status); |
| 685 status_list.push_back(status); | |
| 686 | 680 |
| 687 drive_job_info_for_scheduled_event_.reset(); | 681 drive_job_info_for_scheduled_event_.reset(); |
| 688 | 682 |
| 689 BroadcastEvent( | 683 BroadcastEvent(profile_, |
| 690 profile_, | 684 file_browser_private::OnFileTransfersUpdated::kEventName, |
| 691 file_browser_private::OnFileTransfersUpdated::kEventName, | 685 file_browser_private::OnFileTransfersUpdated::Create(status)); |
| 692 file_browser_private::OnFileTransfersUpdated::Create(status_list)); | |
| 693 } | 686 } |
| 694 | 687 |
| 695 void EventRouter::OnDirectoryChanged(const base::FilePath& drive_path) { | 688 void EventRouter::OnDirectoryChanged(const base::FilePath& drive_path) { |
| 696 HandleFileWatchNotification(NULL, drive_path, false); | 689 HandleFileWatchNotification(NULL, drive_path, false); |
| 697 } | 690 } |
| 698 | 691 |
| 699 void EventRouter::OnFileChanged(const drive::FileChange& changed_files) { | 692 void EventRouter::OnFileChanged(const drive::FileChange& changed_files) { |
| 700 typedef std::map<base::FilePath, drive::FileChange> FileChangeMap; | 693 typedef std::map<base::FilePath, drive::FileChange> FileChangeMap; |
| 701 | 694 |
| 702 FileChangeMap map; | 695 FileChangeMap map; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 // Do nothing. | 930 // Do nothing. |
| 938 } | 931 } |
| 939 | 932 |
| 940 void EventRouter::OnFormatCompleted(const std::string& device_path, | 933 void EventRouter::OnFormatCompleted(const std::string& device_path, |
| 941 bool success) { | 934 bool success) { |
| 942 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 935 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 943 // Do nothing. | 936 // Do nothing. |
| 944 } | 937 } |
| 945 | 938 |
| 946 } // namespace file_manager | 939 } // namespace file_manager |
| OLD | NEW |