| 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/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Sends an event named |event_name| with arguments |event_args| to extensions. | 96 // Sends an event named |event_name| with arguments |event_args| to extensions. |
| 97 void BroadcastEvent(Profile* profile, | 97 void BroadcastEvent(Profile* profile, |
| 98 const std::string& event_name, | 98 const std::string& event_name, |
| 99 scoped_ptr<base::ListValue> event_args) { | 99 scoped_ptr<base::ListValue> event_args) { |
| 100 extensions::EventRouter::Get(profile)->BroadcastEvent( | 100 extensions::EventRouter::Get(profile) |
| 101 make_scoped_ptr(new extensions::Event(event_name, event_args.Pass()))); | 101 ->BroadcastEvent(make_scoped_ptr(new extensions::Event( |
| 102 extensions::events::UNKNOWN, event_name, event_args.Pass()))); |
| 102 } | 103 } |
| 103 | 104 |
| 104 // Sends an event named |event_name| with arguments |event_args| to an extension | 105 // Sends an event named |event_name| with arguments |event_args| to an extension |
| 105 // of |extention_id|. | 106 // of |extention_id|. |
| 106 void DispatchEventToExtension(Profile* profile, | 107 void DispatchEventToExtension(Profile* profile, |
| 107 const std::string& extension_id, | 108 const std::string& extension_id, |
| 108 const std::string& event_name, | 109 const std::string& event_name, |
| 109 scoped_ptr<base::ListValue> event_args) { | 110 scoped_ptr<base::ListValue> event_args) { |
| 110 extensions::EventRouter::Get(profile)->DispatchEventToExtension( | 111 extensions::EventRouter::Get(profile)->DispatchEventToExtension( |
| 111 extension_id, | 112 extension_id, |
| 112 make_scoped_ptr(new extensions::Event(event_name, event_args.Pass()))); | 113 make_scoped_ptr(new extensions::Event(extensions::events::UNKNOWN, |
| 114 event_name, event_args.Pass()))); |
| 113 } | 115 } |
| 114 | 116 |
| 115 file_manager_private::MountCompletedStatus | 117 file_manager_private::MountCompletedStatus |
| 116 MountErrorToMountCompletedStatus(chromeos::MountError error) { | 118 MountErrorToMountCompletedStatus(chromeos::MountError error) { |
| 117 switch (error) { | 119 switch (error) { |
| 118 case chromeos::MOUNT_ERROR_NONE: | 120 case chromeos::MOUNT_ERROR_NONE: |
| 119 return file_manager_private::MOUNT_COMPLETED_STATUS_SUCCESS; | 121 return file_manager_private::MOUNT_COMPLETED_STATUS_SUCCESS; |
| 120 case chromeos::MOUNT_ERROR_UNKNOWN: | 122 case chromeos::MOUNT_ERROR_UNKNOWN: |
| 121 return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN; | 123 return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN; |
| 122 case chromeos::MOUNT_ERROR_INTERNAL: | 124 case chromeos::MOUNT_ERROR_INTERNAL: |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( | 920 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( |
| 919 const DispatchDirectoryChangeEventImplCallback& callback) { | 921 const DispatchDirectoryChangeEventImplCallback& callback) { |
| 920 dispatch_directory_change_event_impl_ = callback; | 922 dispatch_directory_change_event_impl_ = callback; |
| 921 } | 923 } |
| 922 | 924 |
| 923 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { | 925 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { |
| 924 return weak_factory_.GetWeakPtr(); | 926 return weak_factory_.GetWeakPtr(); |
| 925 } | 927 } |
| 926 | 928 |
| 927 } // namespace file_manager | 929 } // namespace file_manager |
| OLD | NEW |