| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/file_util.h" |
| 7 #include "base/time.h" | 8 #include "base/time.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "chrome/browser/history/url_database.h" | 10 #include "chrome/browser/history/url_database.h" |
| 10 #include "chrome/common/jpeg_codec.h" | 11 #include "chrome/common/jpeg_codec.h" |
| 11 #include "chrome/common/sqlite_utils.h" | 12 #include "chrome/common/sqlite_utils.h" |
| 12 #include "chrome/common/thumbnail_score.h" | 13 #include "chrome/common/thumbnail_score.h" |
| 13 #include "skia/include/SkBitmap.h" | 14 #include "skia/include/SkBitmap.h" |
| 14 | 15 |
| 15 namespace history { | 16 namespace history { |
| 16 | 17 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #if 0 | 98 #if 0 |
| 98 SQLStatement statement; | 99 SQLStatement statement; |
| 99 statement.prepare(db_, "SELECT id, image_data FROM favicons"); | 100 statement.prepare(db_, "SELECT id, image_data FROM favicons"); |
| 100 while (statement.step() == SQLITE_ROW) { | 101 while (statement.step() == SQLITE_ROW) { |
| 101 int idx = statement.column_int(0); | 102 int idx = statement.column_int(0); |
| 102 std::vector<unsigned char> data; | 103 std::vector<unsigned char> data; |
| 103 statement.column_blob_as_vector(1, &data); | 104 statement.column_blob_as_vector(1, &data); |
| 104 | 105 |
| 105 char filename[256]; | 106 char filename[256]; |
| 106 sprintf(filename, "<<< YOUR PATH HERE >>>\\%d.jpeg", idx); | 107 sprintf(filename, "<<< YOUR PATH HERE >>>\\%d.jpeg", idx); |
| 107 FILE* f; | 108 if (!data.empty()) { |
| 108 if (fopen_s(&f, filename, "wb") == 0) { | 109 file_util::WriteFile(ASCIIToWide(std::string(filename)), |
| 109 if (!data.empty()) | 110 reinterpret_cast<char*>(data.data()), |
| 110 fwrite(&data[0], 1, data.size(), f); | 111 data.size()); |
| 111 fclose(f); | |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 return INIT_OK; | 116 return INIT_OK; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool ThumbnailDatabase::InitThumbnailTable() { | 119 bool ThumbnailDatabase::InitThumbnailTable() { |
| 120 if (!DoesSqliteTableExist(db_, "thumbnails")) { | 120 if (!DoesSqliteTableExist(db_, "thumbnails")) { |
| 121 if (sqlite3_exec(db_, "CREATE TABLE thumbnails (" | 121 if (sqlite3_exec(db_, "CREATE TABLE thumbnails (" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 NULL, NULL, NULL) != SQLITE_OK) | 442 NULL, NULL, NULL) != SQLITE_OK) |
| 443 return false; | 443 return false; |
| 444 | 444 |
| 445 // The renamed table needs the index (the temporary table doesn't have one). | 445 // The renamed table needs the index (the temporary table doesn't have one). |
| 446 InitFavIconsIndex(); | 446 InitFavIconsIndex(); |
| 447 return true; | 447 return true; |
| 448 } | 448 } |
| 449 | 449 |
| 450 } // namespace history | 450 } // namespace history |
| 451 | 451 |
| OLD | NEW |