OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/history/web_history_service.h" | 5 #include "chrome/browser/history/web_history_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 const QueryOptions& options, | 313 const QueryOptions& options, |
314 const WebHistoryService::QueryWebHistoryCallback& callback) { | 314 const WebHistoryService::QueryWebHistoryCallback& callback) { |
315 // Wrap the original callback into a generic completion callback. | 315 // Wrap the original callback into a generic completion callback. |
316 RequestImpl::CompletionCallback completion_callback = base::Bind( | 316 RequestImpl::CompletionCallback completion_callback = base::Bind( |
317 &WebHistoryService::QueryHistoryCompletionCallback, callback); | 317 &WebHistoryService::QueryHistoryCompletionCallback, callback); |
318 | 318 |
319 GURL url = GetQueryUrl(text_query, options, server_version_info_); | 319 GURL url = GetQueryUrl(text_query, options, server_version_info_); |
320 scoped_ptr<RequestImpl> request( | 320 scoped_ptr<RequestImpl> request( |
321 new RequestImpl(profile_, url, completion_callback)); | 321 new RequestImpl(profile_, url, completion_callback)); |
322 request->Start(); | 322 request->Start(); |
323 return request.PassAs<Request>(); | 323 return request.Pass(); |
324 } | 324 } |
325 | 325 |
326 void WebHistoryService::ExpireHistory( | 326 void WebHistoryService::ExpireHistory( |
327 const std::vector<ExpireHistoryArgs>& expire_list, | 327 const std::vector<ExpireHistoryArgs>& expire_list, |
328 const ExpireWebHistoryCallback& callback) { | 328 const ExpireWebHistoryCallback& callback) { |
329 base::DictionaryValue delete_request; | 329 base::DictionaryValue delete_request; |
330 scoped_ptr<base::ListValue> deletions(new base::ListValue); | 330 scoped_ptr<base::ListValue> deletions(new base::ListValue); |
331 base::Time now = base::Time::Now(); | 331 base::Time now = base::Time::Now(); |
332 | 332 |
333 for (std::vector<ExpireHistoryArgs>::const_iterator it = expire_list.begin(); | 333 for (std::vector<ExpireHistoryArgs>::const_iterator it = expire_list.begin(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 if (response_value) | 406 if (response_value) |
407 response_value->GetString("version_info", &server_version_info_); | 407 response_value->GetString("version_info", &server_version_info_); |
408 } | 408 } |
409 callback.Run(response_value.get() && success); | 409 callback.Run(response_value.get() && success); |
410 // Clean up from pending requests. | 410 // Clean up from pending requests. |
411 pending_expire_requests_.erase(request); | 411 pending_expire_requests_.erase(request); |
412 delete request; | 412 delete request; |
413 } | 413 } |
414 | 414 |
415 } // namespace history | 415 } // namespace history |
OLD | NEW |