| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/api/activity_log_private/activity_log_privat
e_api.h" | 5 #include "chrome/browser/extensions/api/activity_log_private/activity_log_privat
e_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 void ActivityLogAPI::OnListenerRemoved(const EventListenerInfo& details) { | 88 void ActivityLogAPI::OnListenerRemoved(const EventListenerInfo& details) { |
| 89 // TODO(felt): Only observe activity_log_ events when we have a customer. | 89 // TODO(felt): Only observe activity_log_ events when we have a customer. |
| 90 } | 90 } |
| 91 | 91 |
| 92 void ActivityLogAPI::OnExtensionActivity(scoped_refptr<Action> activity) { | 92 void ActivityLogAPI::OnExtensionActivity(scoped_refptr<Action> activity) { |
| 93 std::unique_ptr<base::ListValue> value(new base::ListValue()); | 93 std::unique_ptr<base::ListValue> value(new base::ListValue()); |
| 94 ExtensionActivity activity_arg = activity->ConvertToExtensionActivity(); | 94 ExtensionActivity activity_arg = activity->ConvertToExtensionActivity(); |
| 95 value->Append(activity_arg.ToValue()); | 95 value->Append(activity_arg.ToValue()); |
| 96 std::unique_ptr<Event> event(new Event( | 96 auto event = base::MakeUnique<Event>( |
| 97 events::ACTIVITY_LOG_PRIVATE_ON_EXTENSION_ACTIVITY, | 97 events::ACTIVITY_LOG_PRIVATE_ON_EXTENSION_ACTIVITY, |
| 98 activity_log_private::OnExtensionActivity::kEventName, std::move(value))); | 98 activity_log_private::OnExtensionActivity::kEventName, std::move(value), |
| 99 event->restrict_to_browser_context = browser_context_; | 99 browser_context_); |
| 100 EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); | 100 EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool ActivityLogPrivateGetExtensionActivitiesFunction::RunAsync() { | 103 bool ActivityLogPrivateGetExtensionActivitiesFunction::RunAsync() { |
| 104 std::unique_ptr<activity_log_private::GetExtensionActivities::Params> params( | 104 std::unique_ptr<activity_log_private::GetExtensionActivities::Params> params( |
| 105 activity_log_private::GetExtensionActivities::Params::Create(*args_)); | 105 activity_log_private::GetExtensionActivities::Params::Create(*args_)); |
| 106 EXTENSION_FUNCTION_VALIDATE(params.get()); | 106 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 107 | 107 |
| 108 // Get the arguments in the right format. | 108 // Get the arguments in the right format. |
| 109 Filter filter = std::move(params->filter); | 109 Filter filter = std::move(params->filter); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 for (const std::string& url : urls) | 212 for (const std::string& url : urls) |
| 213 gurls.push_back(GURL(url)); | 213 gurls.push_back(GURL(url)); |
| 214 | 214 |
| 215 ActivityLog* activity_log = ActivityLog::GetInstance(browser_context()); | 215 ActivityLog* activity_log = ActivityLog::GetInstance(browser_context()); |
| 216 DCHECK(activity_log); | 216 DCHECK(activity_log); |
| 217 activity_log->RemoveURLs(gurls); | 217 activity_log->RemoveURLs(gurls); |
| 218 return RespondNow(NoArguments()); | 218 return RespondNow(NoArguments()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace extensions | 221 } // namespace extensions |
| OLD | NEW |