| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 gurls.push_back(GURL(*it)); | 196 gurls.push_back(GURL(*it)); |
| 193 } | 197 } |
| 194 | 198 |
| 195 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); | 199 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); |
| 196 DCHECK(activity_log); | 200 DCHECK(activity_log); |
| 197 activity_log->RemoveURLs(gurls); | 201 activity_log->RemoveURLs(gurls); |
| 198 return true; | 202 return true; |
| 199 } | 203 } |
| 200 | 204 |
| 201 } // namespace extensions | 205 } // namespace extensions |
| OLD | NEW |