| 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 // This program generates a user profile and history by randomly generating | 5 // This program generates a user profile and history by randomly generating |
| 6 // data and feeding it to the history service. | 6 // data and feeding it to the history service. |
| 7 | 7 |
| 8 #include "chrome/tools/profiles/thumbnail-inl.h" | 8 #include "chrome/tools/profiles/thumbnail-inl.h" |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Randomly construct a redirect chain. | 166 // Randomly construct a redirect chain. |
| 167 history::RedirectList redirects; | 167 history::RedirectList redirects; |
| 168 if (RandomFloat() < kRedirectProbability) { | 168 if (RandomFloat() < kRedirectProbability) { |
| 169 const int redir_count = RandomInt(1, 4); | 169 const int redir_count = RandomInt(1, 4); |
| 170 for (int i = 0; i < redir_count; ++i) | 170 for (int i = 0; i < redir_count; ++i) |
| 171 redirects.push_back(ConstructRandomURL()); | 171 redirects.push_back(ConstructRandomURL()); |
| 172 redirects.push_back(url); | 172 redirects.push_back(url); |
| 173 } | 173 } |
| 174 | 174 |
| 175 // Add all of this information to the history service. | 175 // Add all of this information to the history service. |
| 176 history_service->AddPage(url, | 176 history_service->AddPage(url, base::Time::Now(), |
| 177 id_scope, page_id, | 177 id_scope, page_id, |
| 178 previous_url, transition, | 178 previous_url, redirects, |
| 179 redirects, history::SOURCE_BROWSED, true); | 179 transition, history::SOURCE_BROWSED, true); |
| 180 ThumbnailScore score(0.75, false, false); | 180 ThumbnailScore score(0.75, false, false); |
| 181 history_service->SetPageTitle(url, ConstructRandomTitle()); | 181 history_service->SetPageTitle(url, ConstructRandomTitle()); |
| 182 if (types & FULL_TEXT) | 182 if (types & FULL_TEXT) |
| 183 history_service->SetPageContents(url, ConstructRandomPage()); | 183 history_service->SetPageContents(url, ConstructRandomPage()); |
| 184 if (types & TOP_SITES && top_sites) { | 184 if (types & TOP_SITES && top_sites) { |
| 185 const SkBitmap& bitmap = (RandomInt(0, 2) == 0) ? *google_bitmap : | 185 const SkBitmap& bitmap = (RandomInt(0, 2) == 0) ? *google_bitmap : |
| 186 *weewar_bitmap; | 186 *weewar_bitmap; |
| 187 gfx::Image image(bitmap); | 187 gfx::Image image(bitmap); |
| 188 top_sites->SetPageThumbnail(url, &image, score); | 188 top_sites->SetPageThumbnail(url, &image, score); |
| 189 } | 189 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 dst_file.value().c_str()); | 278 dst_file.value().c_str()); |
| 279 if (!file_util::CopyFile(path, dst_file)) { | 279 if (!file_util::CopyFile(path, dst_file)) { |
| 280 printf("Copying file failed: %d\n", ::GetLastError()); | 280 printf("Copying file failed: %d\n", ::GetLastError()); |
| 281 return -1; | 281 return -1; |
| 282 } | 282 } |
| 283 path = file_iterator.Next(); | 283 path = file_iterator.Next(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 return 0; | 286 return 0; |
| 287 } | 287 } |
| OLD | NEW |