Chromium Code Reviews| 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/extensions/event_router.h" | 5 #include "chrome/browser/extensions/event_router.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 FROM_HERE, | 102 FROM_HERE, |
| 103 base::Bind(&LogExtensionEventMessage, | 103 base::Bind(&LogExtensionEventMessage, |
| 104 profile_id, | 104 profile_id, |
| 105 extension_id, | 105 extension_id, |
| 106 event_name, | 106 event_name, |
| 107 base::Passed(&event_args))); | 107 base::Passed(&event_args))); |
| 108 } else { | 108 } else { |
| 109 Profile* profile = reinterpret_cast<Profile*>(profile_id); | 109 Profile* profile = reinterpret_cast<Profile*>(profile_id); |
| 110 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 110 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
| 111 return; | 111 return; |
| 112 ActivityLog::GetInstance(profile)->LogEventAction( | 112 ActivityLog* activity_log = ActivityLog::GetInstance(profile); |
| 113 if (!activity_log->IsLogEnabled()) return; | |
| 114 activity_log->LogEventAction( | |
| 113 extension_id, event_name, event_args.get(), std::string()); | 115 extension_id, event_name, event_args.get(), std::string()); |
| 114 } | 116 } |
| 115 } | 117 } |
| 116 | 118 |
| 117 // static | 119 // static |
| 118 void EventRouter::DispatchExtensionMessage(IPC::Sender* ipc_sender, | 120 void EventRouter::DispatchExtensionMessage(IPC::Sender* ipc_sender, |
| 119 void* profile_id, | 121 void* profile_id, |
| 120 const std::string& extension_id, | 122 const std::string& extension_id, |
| 121 const std::string& event_name, | 123 const std::string& event_name, |
| 122 ListValue* event_args, | 124 ListValue* event_args, |
| 123 UserGestureState user_gesture, | 125 UserGestureState user_gesture, |
| 124 const EventFilteringInfo& info) { | 126 const EventFilteringInfo& info) { |
| 125 if (ActivityLog::IsLogEnabledOnAnyProfile()) { | 127 LogExtensionEventMessage(profile_id, extension_id, event_name, |
|
felt
2013/07/23 06:37:34
Something I forgot about until now, and you should
pmarch
2013/07/29 17:36:47
Here, we need to check for command line switch and
| |
| 126 LogExtensionEventMessage(profile_id, extension_id, event_name, | 128 scoped_ptr<ListValue>(event_args->DeepCopy())); |
| 127 scoped_ptr<ListValue>(event_args->DeepCopy())); | |
| 128 } | |
| 129 | 129 |
| 130 ListValue args; | 130 ListValue args; |
| 131 args.Set(0, Value::CreateStringValue(event_name)); | 131 args.Set(0, Value::CreateStringValue(event_name)); |
| 132 args.Set(1, event_args); | 132 args.Set(1, event_args); |
| 133 args.Set(2, info.AsValue().release()); | 133 args.Set(2, info.AsValue().release()); |
| 134 ipc_sender->Send(new ExtensionMsg_MessageInvoke( | 134 ipc_sender->Send(new ExtensionMsg_MessageInvoke( |
| 135 MSG_ROUTING_CONTROL, | 135 MSG_ROUTING_CONTROL, |
| 136 extension_id, | 136 extension_id, |
| 137 "event_bindings", | 137 "event_bindings", |
| 138 "dispatchEvent", | 138 "dispatchEvent", |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 copy->will_dispatch_callback = will_dispatch_callback; | 846 copy->will_dispatch_callback = will_dispatch_callback; |
| 847 return copy; | 847 return copy; |
| 848 } | 848 } |
| 849 | 849 |
| 850 EventListenerInfo::EventListenerInfo(const std::string& event_name, | 850 EventListenerInfo::EventListenerInfo(const std::string& event_name, |
| 851 const std::string& extension_id) | 851 const std::string& extension_id) |
| 852 : event_name(event_name), | 852 : event_name(event_name), |
| 853 extension_id(extension_id) {} | 853 extension_id(extension_id) {} |
| 854 | 854 |
| 855 } // namespace extensions | 855 } // namespace extensions |
| OLD | NEW |