| 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/extensions/api/history/history_api.h" | 5 #include "chrome/browser/extensions/api/history/history_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 EXTENSION_FUNCTION_VALIDATE(params.get()); | 294 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 295 | 295 |
| 296 GURL url; | 296 GURL url; |
| 297 if (!ValidateUrl(params->details.url, &url)) | 297 if (!ValidateUrl(params->details.url, &url)) |
| 298 return false; | 298 return false; |
| 299 | 299 |
| 300 HistoryService* hs = HistoryServiceFactory::GetForProfile( | 300 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
| 301 GetProfile(), Profile::EXPLICIT_ACCESS); | 301 GetProfile(), Profile::EXPLICIT_ACCESS); |
| 302 hs->QueryURL(url, | 302 hs->QueryURL(url, |
| 303 true, // Retrieve full history of a URL. | 303 true, // Retrieve full history of a URL. |
| 304 &cancelable_consumer_, | |
| 305 base::Bind(&HistoryGetVisitsFunction::QueryComplete, | 304 base::Bind(&HistoryGetVisitsFunction::QueryComplete, |
| 306 base::Unretained(this))); | 305 base::Unretained(this)), |
| 307 | 306 &task_tracker_); |
| 308 return true; | 307 return true; |
| 309 } | 308 } |
| 310 | 309 |
| 311 void HistoryGetVisitsFunction::QueryComplete( | 310 void HistoryGetVisitsFunction::QueryComplete( |
| 312 HistoryService::Handle request_service, | |
| 313 bool success, | 311 bool success, |
| 314 const history::URLRow* url_row, | 312 const history::URLRow& url_row, |
| 315 history::VisitVector* visits) { | 313 const history::VisitVector& visits) { |
| 316 VisitItemList visit_item_vec; | 314 VisitItemList visit_item_vec; |
| 317 if (visits && !visits->empty()) { | 315 if (success && !visits.empty()) { |
| 318 for (history::VisitVector::iterator iterator = visits->begin(); | 316 for (history::VisitVector::const_iterator iterator = visits.begin(); |
| 319 iterator != visits->end(); | 317 iterator != visits.end(); |
| 320 ++iterator) { | 318 ++iterator) { |
| 321 visit_item_vec.push_back(make_linked_ptr( | 319 visit_item_vec.push_back(make_linked_ptr( |
| 322 GetVisitItem(*iterator).release())); | 320 GetVisitItem(*iterator).release())); |
| 323 } | 321 } |
| 324 } | 322 } |
| 325 | 323 |
| 326 results_ = GetVisits::Results::Create(visit_item_vec); | 324 results_ = GetVisits::Results::Create(visit_item_vec); |
| 327 SendAsyncResponse(); | 325 SendAsyncResponse(); |
| 328 } | 326 } |
| 329 | 327 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 } | 473 } |
| 476 | 474 |
| 477 return true; | 475 return true; |
| 478 } | 476 } |
| 479 | 477 |
| 480 void HistoryDeleteAllFunction::DeleteComplete() { | 478 void HistoryDeleteAllFunction::DeleteComplete() { |
| 481 SendAsyncResponse(); | 479 SendAsyncResponse(); |
| 482 } | 480 } |
| 483 | 481 |
| 484 } // namespace extensions | 482 } // namespace extensions |
| OLD | NEW |