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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 // Populate the return object. | 165 // Populate the return object. |
166 scoped_ptr<ActivityResultSet> result_set(new ActivityResultSet); | 166 scoped_ptr<ActivityResultSet> result_set(new ActivityResultSet); |
167 result_set->activities = result_arr; | 167 result_set->activities = result_arr; |
168 results_ = activity_log_private::GetExtensionActivities::Results::Create( | 168 results_ = activity_log_private::GetExtensionActivities::Results::Create( |
169 *result_set); | 169 *result_set); |
170 | 170 |
171 SendResponse(true); | 171 SendResponse(true); |
172 } | 172 } |
173 | 173 |
| 174 bool ActivityLogPrivateDeleteDatabaseFunction::RunImpl() { |
| 175 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); |
| 176 DCHECK(activity_log); |
| 177 activity_log->DeleteDatabase(); |
| 178 return true; |
| 179 } |
| 180 |
| 181 bool ActivityLogPrivateDeleteUrlsFunction::RunImpl() { |
| 182 scoped_ptr<activity_log_private::DeleteUrls::Params> params( |
| 183 activity_log_private::DeleteUrls::Params::Create(*args_)); |
| 184 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 185 |
| 186 // Put the arguments in the right format. |
| 187 std::vector<GURL> gurls; |
| 188 std::vector<std::string> urls = *params->urls.get(); |
| 189 for (std::vector<std::string>::iterator it = urls.begin(); |
| 190 it != urls.end(); |
| 191 ++it) { |
| 192 gurls.push_back(GURL(*it)); |
| 193 } |
| 194 |
| 195 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); |
| 196 DCHECK(activity_log); |
| 197 activity_log->RemoveURLs(gurls); |
| 198 return true; |
| 199 } |
| 200 |
174 } // namespace extensions | 201 } // namespace extensions |
OLD | NEW |