| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 void EventRouter::OnRefreshTokenInvalid() { | 820 void EventRouter::OnRefreshTokenInvalid() { |
| 821 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 821 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 822 | 822 |
| 823 // Raise a DriveConnectionStatusChanged event to notify the status offline. | 823 // Raise a DriveConnectionStatusChanged event to notify the status offline. |
| 824 BroadcastEvent( | 824 BroadcastEvent( |
| 825 profile_, | 825 profile_, |
| 826 file_manager_private::OnDriveConnectionStatusChanged::kEventName, | 826 file_manager_private::OnDriveConnectionStatusChanged::kEventName, |
| 827 file_manager_private::OnDriveConnectionStatusChanged::Create()); | 827 file_manager_private::OnDriveConnectionStatusChanged::Create()); |
| 828 } | 828 } |
| 829 | 829 |
| 830 void EventRouter::OnReadyToSendRequests() { |
| 831 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 832 |
| 833 // Raise a DriveConnectionStatusChanged event to notify the status online. |
| 834 BroadcastEvent( |
| 835 profile_, |
| 836 file_manager_private::OnDriveConnectionStatusChanged::kEventName, |
| 837 file_manager_private::OnDriveConnectionStatusChanged::Create()); |
| 838 } |
| 839 |
| 830 void EventRouter::HandleFileWatchNotification(const drive::FileChange* list, | 840 void EventRouter::HandleFileWatchNotification(const drive::FileChange* list, |
| 831 const base::FilePath& local_path, | 841 const base::FilePath& local_path, |
| 832 bool got_error) { | 842 bool got_error) { |
| 833 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 843 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 834 | 844 |
| 835 WatcherMap::const_iterator iter = file_watchers_.find(local_path); | 845 WatcherMap::const_iterator iter = file_watchers_.find(local_path); |
| 836 if (iter == file_watchers_.end()) { | 846 if (iter == file_watchers_.end()) { |
| 837 return; | 847 return; |
| 838 } | 848 } |
| 839 | 849 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( | 1057 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( |
| 1048 const DispatchDirectoryChangeEventImplCallback& callback) { | 1058 const DispatchDirectoryChangeEventImplCallback& callback) { |
| 1049 dispatch_directory_change_event_impl_ = callback; | 1059 dispatch_directory_change_event_impl_ = callback; |
| 1050 } | 1060 } |
| 1051 | 1061 |
| 1052 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { | 1062 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { |
| 1053 return weak_factory_.GetWeakPtr(); | 1063 return weak_factory_.GetWeakPtr(); |
| 1054 } | 1064 } |
| 1055 | 1065 |
| 1056 } // namespace file_manager | 1066 } // namespace file_manager |
| OLD | NEW |