OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/codec/jpeg_codec.h" |
5 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
7 #include "base/file_path.h" | 8 #include "base/file_path.h" |
8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
9 #include "base/gfx/jpeg_codec.h" | |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 #include "chrome/browser/history/archived_database.h" | 13 #include "chrome/browser/history/archived_database.h" |
14 #include "chrome/browser/history/expire_history_backend.h" | 14 #include "chrome/browser/history/expire_history_backend.h" |
15 #include "chrome/browser/history/history_database.h" | 15 #include "chrome/browser/history/history_database.h" |
16 #include "chrome/browser/history/text_database_manager.h" | 16 #include "chrome/browser/history/text_database_manager.h" |
17 #include "chrome/browser/history/thumbnail_database.h" | 17 #include "chrome/browser/history/thumbnail_database.h" |
18 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
19 #include "chrome/common/thumbnail_score.h" | 19 #include "chrome/common/thumbnail_score.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 url_ids[1] = main_db_->AddURL(url_row2); | 198 url_ids[1] = main_db_->AddURL(url_row2); |
199 | 199 |
200 URLRow url_row3(GURL("http://www.google.com/3")); | 200 URLRow url_row3(GURL("http://www.google.com/3")); |
201 url_row3.set_last_visit(visit_times[3]); | 201 url_row3.set_last_visit(visit_times[3]); |
202 url_row3.set_favicon_id(favicon2); | 202 url_row3.set_favicon_id(favicon2); |
203 url_row3.set_visit_count(1); | 203 url_row3.set_visit_count(1); |
204 url_ids[2] = main_db_->AddURL(url_row3); | 204 url_ids[2] = main_db_->AddURL(url_row3); |
205 | 205 |
206 // Thumbnails for each URL. | 206 // Thumbnails for each URL. |
207 scoped_ptr<SkBitmap> thumbnail( | 207 scoped_ptr<SkBitmap> thumbnail( |
208 JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); | 208 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); |
209 ThumbnailScore score(0.25, true, true, Time::Now()); | 209 ThumbnailScore score(0.25, true, true, Time::Now()); |
210 | 210 |
211 Time time; | 211 Time time; |
212 GURL gurl; | 212 GURL gurl; |
213 thumb_db_->SetPageThumbnail(gurl, url_ids[0], *thumbnail, score, time); | 213 thumb_db_->SetPageThumbnail(gurl, url_ids[0], *thumbnail, score, time); |
214 thumb_db_->SetPageThumbnail(gurl, url_ids[1], *thumbnail, score, time); | 214 thumb_db_->SetPageThumbnail(gurl, url_ids[1], *thumbnail, score, time); |
215 thumb_db_->SetPageThumbnail(gurl, url_ids[2], *thumbnail, score, time); | 215 thumb_db_->SetPageThumbnail(gurl, url_ids[2], *thumbnail, score, time); |
216 | 216 |
217 // Four visits. | 217 // Four visits. |
218 VisitRow visit_row1; | 218 VisitRow visit_row1; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); | 739 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); |
740 EXPECT_EQ(1U, visits.size()); | 740 EXPECT_EQ(1U, visits.size()); |
741 } | 741 } |
742 | 742 |
743 // TODO(brettw) add some visits with no URL to make sure everything is updated | 743 // TODO(brettw) add some visits with no URL to make sure everything is updated |
744 // properly. Have the visits also refer to nonexistant FTS rows. | 744 // properly. Have the visits also refer to nonexistant FTS rows. |
745 // | 745 // |
746 // Maybe also refer to invalid favicons. | 746 // Maybe also refer to invalid favicons. |
747 | 747 |
748 } // namespace history | 748 } // namespace history |
OLD | NEW |