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_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/file_util.h" | 8 #include "base/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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 profile_, | 556 profile_, |
557 file_browser_private::OnFileTransfersUpdated::kEventName, | 557 file_browser_private::OnFileTransfersUpdated::kEventName, |
558 file_browser_private::OnFileTransfersUpdated::Create(status_list)); | 558 file_browser_private::OnFileTransfersUpdated::Create(status_list)); |
559 last_file_transfer_event_ = now; | 559 last_file_transfer_event_ = now; |
560 } | 560 } |
561 | 561 |
562 void EventRouter::OnDirectoryChanged(const base::FilePath& directory_path) { | 562 void EventRouter::OnDirectoryChanged(const base::FilePath& directory_path) { |
563 HandleFileWatchNotification(directory_path, false); | 563 HandleFileWatchNotification(directory_path, false); |
564 } | 564 } |
565 | 565 |
| 566 void EventRouter::OnDriveSyncError( |
| 567 drive::file_system::DriveSyncErrorType type) { |
| 568 file_browser_private::DriveSyncErrorEvent event; |
| 569 event.type = file_browser_private::DRIVE_SYNC_ERROR_TYPE_NONE; |
| 570 switch (type) { |
| 571 case drive::file_system::DELETE_WITHOUT_PERMISSION: |
| 572 event.type = |
| 573 file_browser_private::DRIVE_SYNC_ERROR_TYPE_DELETE_WITHOUT_PERMISSION; |
| 574 break; |
| 575 } |
| 576 DCHECK_NE(file_browser_private::DRIVE_SYNC_ERROR_TYPE_NONE, event.type); |
| 577 BroadcastEvent( |
| 578 profile_, |
| 579 file_browser_private::OnDriveSyncError::kEventName, |
| 580 file_browser_private::OnDriveSyncError::Create(event)); |
| 581 } |
| 582 |
566 void EventRouter::OnRefreshTokenInvalid() { | 583 void EventRouter::OnRefreshTokenInvalid() { |
567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
568 | 585 |
569 // Raise a DriveConnectionStatusChanged event to notify the status offline. | 586 // Raise a DriveConnectionStatusChanged event to notify the status offline. |
570 BroadcastEvent( | 587 BroadcastEvent( |
571 profile_, | 588 profile_, |
572 file_browser_private::OnDriveConnectionStatusChanged::kEventName, | 589 file_browser_private::OnDriveConnectionStatusChanged::kEventName, |
573 file_browser_private::OnDriveConnectionStatusChanged::Create()); | 590 file_browser_private::OnDriveConnectionStatusChanged::Create()); |
574 } | 591 } |
575 | 592 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 void EventRouter::OnFormatCompleted(const std::string& device_path, | 770 void EventRouter::OnFormatCompleted(const std::string& device_path, |
754 bool success) { | 771 bool success) { |
755 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 772 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
756 DispatchDeviceEvent(success ? | 773 DispatchDeviceEvent(success ? |
757 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_SUCCESS : | 774 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_SUCCESS : |
758 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_FAIL, | 775 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_FAIL, |
759 device_path); | 776 device_path); |
760 } | 777 } |
761 | 778 |
762 } // namespace file_manager | 779 } // namespace file_manager |
OLD | NEW |