| 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 "components/history/core/browser/android/visit_sql_handler.h" | 5 #include "components/history/core/browser/android/visit_sql_handler.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" |
| 8 #include "components/history/core/browser/url_database.h" | 11 #include "components/history/core/browser/url_database.h" |
| 9 #include "components/history/core/browser/visit_database.h" | 12 #include "components/history/core/browser/visit_database.h" |
| 10 | 13 |
| 11 using base::Time; | 14 using base::Time; |
| 12 | 15 |
| 13 namespace history { | 16 namespace history { |
| 14 | 17 |
| 15 namespace { | 18 namespace { |
| 16 | 19 |
| 17 // The interesting columns of this handler. | 20 // The interesting columns of this handler. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // TODO : Is 'ui::PAGE_TRANSITION_AUTO_BOOKMARK' proper? | 121 // TODO : Is 'ui::PAGE_TRANSITION_AUTO_BOOKMARK' proper? |
| 119 // if not, a new ui::PageTransition type will need. | 122 // if not, a new ui::PageTransition type will need. |
| 120 VisitRow visit_row(url_id, visit_time, 0, | 123 VisitRow visit_row(url_id, visit_time, 0, |
| 121 ui::PAGE_TRANSITION_AUTO_BOOKMARK, 0); | 124 ui::PAGE_TRANSITION_AUTO_BOOKMARK, 0); |
| 122 return visit_db_->AddVisit(&visit_row, SOURCE_BROWSED); | 125 return visit_db_->AddVisit(&visit_row, SOURCE_BROWSED); |
| 123 } | 126 } |
| 124 | 127 |
| 125 bool VisitSQLHandler::AddVisitRows(URLID url_id, | 128 bool VisitSQLHandler::AddVisitRows(URLID url_id, |
| 126 int visit_count, | 129 int visit_count, |
| 127 const Time& last_visit_time) { | 130 const Time& last_visit_time) { |
| 128 int64 last_update_value = last_visit_time.ToInternalValue(); | 131 int64_t last_update_value = last_visit_time.ToInternalValue(); |
| 129 for (int i = 0; i < visit_count; i++) { | 132 for (int i = 0; i < visit_count; i++) { |
| 130 if (!AddVisit(url_id, Time::FromInternalValue(last_update_value - i))) | 133 if (!AddVisit(url_id, Time::FromInternalValue(last_update_value - i))) |
| 131 return false; | 134 return false; |
| 132 } | 135 } |
| 133 return true; | 136 return true; |
| 134 } | 137 } |
| 135 | 138 |
| 136 bool VisitSQLHandler::DeleteVisitsForURL(URLID url_id) { | 139 bool VisitSQLHandler::DeleteVisitsForURL(URLID url_id) { |
| 137 VisitVector visits; | 140 VisitVector visits; |
| 138 if (!visit_db_->GetVisitsForURL(url_id, &visits)) | 141 if (!visit_db_->GetVisitsForURL(url_id, &visits)) |
| 139 return false; | 142 return false; |
| 140 | 143 |
| 141 for (VisitVector::const_iterator v = visits.begin(); v != visits.end(); ++v) { | 144 for (VisitVector::const_iterator v = visits.begin(); v != visits.end(); ++v) { |
| 142 visit_db_->DeleteVisit(*v); | 145 visit_db_->DeleteVisit(*v); |
| 143 } | 146 } |
| 144 return true; | 147 return true; |
| 145 } | 148 } |
| 146 | 149 |
| 147 } // namespace history. | 150 } // namespace history. |
| OLD | NEW |