| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 void ActivityLogAPI::OnListenerRemoved(const EventListenerInfo& details) { | 81 void ActivityLogAPI::OnListenerRemoved(const EventListenerInfo& details) { |
| 82 // TODO(felt): Only observe activity_log_ events when we have a customer. | 82 // TODO(felt): Only observe activity_log_ events when we have a customer. |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ActivityLogAPI::OnExtensionActivity(scoped_refptr<Action> activity) { | 85 void ActivityLogAPI::OnExtensionActivity(scoped_refptr<Action> activity) { |
| 86 scoped_ptr<base::ListValue> value(new base::ListValue()); | 86 scoped_ptr<base::ListValue> value(new base::ListValue()); |
| 87 scoped_ptr<ExtensionActivity> activity_arg = | 87 scoped_ptr<ExtensionActivity> activity_arg = |
| 88 activity->ConvertToExtensionActivity(); | 88 activity->ConvertToExtensionActivity(); |
| 89 value->Append(activity_arg->ToValue().release()); | 89 value->Append(activity_arg->ToValue().release()); |
| 90 scoped_ptr<Event> event( | 90 scoped_ptr<Event> event(new Event( |
| 91 new Event(activity_log_private::OnExtensionActivity::kEventName, | 91 events::UNKNOWN, activity_log_private::OnExtensionActivity::kEventName, |
| 92 value.Pass())); | 92 value.Pass())); |
| 93 event->restrict_to_browser_context = browser_context_; | 93 event->restrict_to_browser_context = browser_context_; |
| 94 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); | 94 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool ActivityLogPrivateGetExtensionActivitiesFunction::RunAsync() { | 97 bool ActivityLogPrivateGetExtensionActivitiesFunction::RunAsync() { |
| 98 scoped_ptr<activity_log_private::GetExtensionActivities::Params> params( | 98 scoped_ptr<activity_log_private::GetExtensionActivities::Params> params( |
| 99 activity_log_private::GetExtensionActivities::Params::Create(*args_)); | 99 activity_log_private::GetExtensionActivities::Params::Create(*args_)); |
| 100 EXTENSION_FUNCTION_VALIDATE(params.get()); | 100 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 101 | 101 |
| 102 // Get the arguments in the right format. | 102 // Get the arguments in the right format. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 gurls.push_back(GURL(*it)); | 215 gurls.push_back(GURL(*it)); |
| 216 } | 216 } |
| 217 | 217 |
| 218 ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile()); | 218 ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile()); |
| 219 DCHECK(activity_log); | 219 DCHECK(activity_log); |
| 220 activity_log->RemoveURLs(gurls); | 220 activity_log->RemoveURLs(gurls); |
| 221 return true; | 221 return true; |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace extensions | 224 } // namespace extensions |
| OLD | NEW |