| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 action_type = Action::ACTION_ANY; | 127 action_type = Action::ACTION_ANY; |
| 128 } | 128 } |
| 129 std::string extension_id = | 129 std::string extension_id = |
| 130 filter->extension_id.get() ? *filter->extension_id : std::string(); | 130 filter->extension_id.get() ? *filter->extension_id : std::string(); |
| 131 std::string api_call = | 131 std::string api_call = |
| 132 filter->api_call.get() ? *filter->api_call : std::string(); | 132 filter->api_call.get() ? *filter->api_call : std::string(); |
| 133 std::string page_url = | 133 std::string page_url = |
| 134 filter->page_url.get() ? *filter->page_url : std::string(); | 134 filter->page_url.get() ? *filter->page_url : std::string(); |
| 135 std::string arg_url = | 135 std::string arg_url = |
| 136 filter->arg_url.get() ? *filter->arg_url : std::string(); | 136 filter->arg_url.get() ? *filter->arg_url : std::string(); |
| 137 int days_ago = -1; |
| 138 if (filter->days_ago.get()) |
| 139 days_ago = *filter->days_ago; |
| 137 | 140 |
| 138 // Call the ActivityLog. | 141 // Call the ActivityLog. |
| 139 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); | 142 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); |
| 140 DCHECK(activity_log); | 143 DCHECK(activity_log); |
| 141 activity_log->GetFilteredActions( | 144 activity_log->GetFilteredActions( |
| 142 extension_id, | 145 extension_id, |
| 143 action_type, | 146 action_type, |
| 144 api_call, | 147 api_call, |
| 145 page_url, | 148 page_url, |
| 146 arg_url, | 149 arg_url, |
| 150 days_ago, |
| 147 base::Bind( | 151 base::Bind( |
| 148 &ActivityLogPrivateGetExtensionActivitiesFunction::OnLookupCompleted, | 152 &ActivityLogPrivateGetExtensionActivitiesFunction::OnLookupCompleted, |
| 149 this)); | 153 this)); |
| 150 | 154 |
| 151 return true; | 155 return true; |
| 152 } | 156 } |
| 153 | 157 |
| 154 void ActivityLogPrivateGetExtensionActivitiesFunction::OnLookupCompleted( | 158 void ActivityLogPrivateGetExtensionActivitiesFunction::OnLookupCompleted( |
| 155 scoped_ptr<std::vector<scoped_refptr<Action> > > activities) { | 159 scoped_ptr<std::vector<scoped_refptr<Action> > > activities) { |
| 156 // Convert Actions to ExtensionActivities. | 160 // Convert Actions to ExtensionActivities. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 169 result_set->activities = result_arr; | 173 result_set->activities = result_arr; |
| 170 result_set->max_time = scoped_ptr<int>(new int(0)); | 174 result_set->max_time = scoped_ptr<int>(new int(0)); |
| 171 result_set->more_results = false; | 175 result_set->more_results = false; |
| 172 results_ = activity_log_private::GetExtensionActivities::Results::Create( | 176 results_ = activity_log_private::GetExtensionActivities::Results::Create( |
| 173 *result_set); | 177 *result_set); |
| 174 | 178 |
| 175 SendResponse(true); | 179 SendResponse(true); |
| 176 } | 180 } |
| 177 | 181 |
| 178 } // namespace extensions | 182 } // namespace extensions |
| OLD | NEW |