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/thumbnail_database.h" | 5 #include "chrome/browser/history/thumbnail_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 double current_boring_score = select_statement.ColumnDouble(0); | 358 double current_boring_score = select_statement.ColumnDouble(0); |
359 bool current_clipping = select_statement.ColumnBool(1); | 359 bool current_clipping = select_statement.ColumnBool(1); |
360 bool current_at_top = select_statement.ColumnBool(2); | 360 bool current_at_top = select_statement.ColumnBool(2); |
361 base::Time last_updated = | 361 base::Time last_updated = |
362 base::Time::FromTimeT(select_statement.ColumnInt64(3)); | 362 base::Time::FromTimeT(select_statement.ColumnInt64(3)); |
363 *score = ThumbnailScore(current_boring_score, current_clipping, | 363 *score = ThumbnailScore(current_boring_score, current_clipping, |
364 current_at_top, last_updated); | 364 current_at_top, last_updated); |
365 return true; | 365 return true; |
366 } | 366 } |
367 | 367 |
368 bool ThumbnailDatabase::SetFavicon(URLID icon_id, | 368 bool ThumbnailDatabase::SetFavicon( |
369 scoped_refptr<RefCountedMemory> icon_data, | 369 URLID icon_id, |
370 base::Time time) { | 370 scoped_refptr<base::RefCountedMemory> icon_data, |
| 371 base::Time time) { |
371 DCHECK(icon_id); | 372 DCHECK(icon_id); |
372 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, | 373 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, |
373 "UPDATE favicons SET image_data=?, last_updated=? WHERE id=?")); | 374 "UPDATE favicons SET image_data=?, last_updated=? WHERE id=?")); |
374 if (icon_data->size()) { | 375 if (icon_data->size()) { |
375 statement.BindBlob(0, icon_data->front(), | 376 statement.BindBlob(0, icon_data->front(), |
376 static_cast<int>(icon_data->size())); | 377 static_cast<int>(icon_data->size())); |
377 } else { | 378 } else { |
378 statement.BindNull(0); | 379 statement.BindNull(0); |
379 } | 380 } |
380 statement.BindInt64(1, time.ToTimeT()); | 381 statement.BindInt64(1, time.ToTimeT()); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 bool ThumbnailDatabase::UpgradeToVersion5() { | 780 bool ThumbnailDatabase::UpgradeToVersion5() { |
780 if (!db_.Execute("ALTER TABLE favicons ADD sizes LONGVARCHAR")) { | 781 if (!db_.Execute("ALTER TABLE favicons ADD sizes LONGVARCHAR")) { |
781 return false; | 782 return false; |
782 } | 783 } |
783 meta_table_.SetVersionNumber(5); | 784 meta_table_.SetVersionNumber(5); |
784 meta_table_.SetCompatibleVersionNumber(std::min(5, kCompatibleVersionNumber)); | 785 meta_table_.SetCompatibleVersionNumber(std::min(5, kCompatibleVersionNumber)); |
785 return true; | 786 return true; |
786 } | 787 } |
787 | 788 |
788 } // namespace history | 789 } // namespace history |
OLD | NEW |