| 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 base::Bind( | 726 base::Bind( |
| 727 &EventRouter::DispatchDirectoryChangeEventWithEntryDefinition, | 727 &EventRouter::DispatchDirectoryChangeEventWithEntryDefinition, |
| 728 weak_factory_.GetWeakPtr(), | 728 weak_factory_.GetWeakPtr(), |
| 729 got_error)); | 729 got_error)); |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 | 732 |
| 733 void EventRouter::DispatchDirectoryChangeEventWithEntryDefinition( | 733 void EventRouter::DispatchDirectoryChangeEventWithEntryDefinition( |
| 734 bool watcher_error, | 734 bool watcher_error, |
| 735 const EntryDefinition& entry_definition) { | 735 const EntryDefinition& entry_definition) { |
| 736 if (entry_definition.error != base::File::FILE_OK) { | 736 if (entry_definition.error != base::File::FILE_OK || |
| 737 DVLOG(1) << "Unable to dispatch event because resolving the entry " | 737 !entry_definition.is_directory) { |
| 738 << "definition failed."; | 738 DVLOG(1) << "Unable to dispatch event because resolving the directory " |
| 739 << "entry definition failed."; |
| 739 return; | 740 return; |
| 740 } | 741 } |
| 741 | 742 |
| 742 file_browser_private::FileWatchEvent event; | 743 file_browser_private::FileWatchEvent event; |
| 743 event.event_type = watcher_error | 744 event.event_type = watcher_error |
| 744 ? file_browser_private::FILE_WATCH_EVENT_TYPE_ERROR | 745 ? file_browser_private::FILE_WATCH_EVENT_TYPE_ERROR |
| 745 : file_browser_private::FILE_WATCH_EVENT_TYPE_CHANGED; | 746 : file_browser_private::FILE_WATCH_EVENT_TYPE_CHANGED; |
| 746 | 747 |
| 747 event.entry.additional_properties.SetString( | 748 event.entry.additional_properties.SetString( |
| 748 "fileSystemName", entry_definition.file_system_name); | 749 "fileSystemName", entry_definition.file_system_name); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 } | 942 } |
| 942 } | 943 } |
| 943 | 944 |
| 944 void EventRouter::OnOwnerEntryChanged(aura::Window* window) { | 945 void EventRouter::OnOwnerEntryChanged(aura::Window* window) { |
| 945 BroadcastEvent(profile_, | 946 BroadcastEvent(profile_, |
| 946 file_browser_private::OnDesktopChanged::kEventName, | 947 file_browser_private::OnDesktopChanged::kEventName, |
| 947 file_browser_private::OnDesktopChanged::Create()); | 948 file_browser_private::OnDesktopChanged::Create()); |
| 948 } | 949 } |
| 949 | 950 |
| 950 } // namespace file_manager | 951 } // namespace file_manager |
| OLD | NEW |