OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 13 matching lines...) Expand all Loading... |
24 #include "chrome/common/thumbnail_score.h" | 24 #include "chrome/common/thumbnail_score.h" |
25 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
26 #include "content/browser/notification_service_impl.h" | 26 #include "content/browser/notification_service_impl.h" |
27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
28 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/base/ui_base_paths.h" | 30 #include "ui/base/ui_base_paths.h" |
31 #include "ui/gfx/codec/jpeg_codec.h" | 31 #include "ui/gfx/codec/jpeg_codec.h" |
32 | 32 |
33 using base::Time; | 33 using base::Time; |
| 34 using content::BrowserThread; |
34 | 35 |
35 // Addition types data can be generated for. By default only urls/visits are | 36 // Addition types data can be generated for. By default only urls/visits are |
36 // added. | 37 // added. |
37 enum Types { | 38 enum Types { |
38 TOP_SITES = 1 << 0, | 39 TOP_SITES = 1 << 0, |
39 FULL_TEXT = 1 << 1 | 40 FULL_TEXT = 1 << 1 |
40 }; | 41 }; |
41 | 42 |
42 // Probabilities of different word lengths, as measured from Darin's profile. | 43 // Probabilities of different word lengths, as measured from Darin's profile. |
43 // kWordLengthProbabilities[n-1] = P(word of length n) | 44 // kWordLengthProbabilities[n-1] = P(word of length n) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 ::GetLastError()); | 229 ::GetLastError()); |
229 } | 230 } |
230 | 231 |
231 icu_util::Initialize(); | 232 icu_util::Initialize(); |
232 | 233 |
233 chrome::RegisterPathProvider(); | 234 chrome::RegisterPathProvider(); |
234 ui::RegisterPathProvider(); | 235 ui::RegisterPathProvider(); |
235 ResourceBundle::InitSharedInstance("en-US"); | 236 ResourceBundle::InitSharedInstance("en-US"); |
236 NotificationServiceImpl notification_service; | 237 NotificationServiceImpl notification_service; |
237 MessageLoopForUI message_loop; | 238 MessageLoopForUI message_loop; |
238 DeprecatedBrowserThread ui_thread(BrowserThread::UI, &message_loop); | 239 content::DeprecatedBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
239 DeprecatedBrowserThread db_thread(BrowserThread::DB, &message_loop); | 240 content::DeprecatedBrowserThread db_thread(BrowserThread::DB, &message_loop); |
240 TestingProfile profile; | 241 TestingProfile profile; |
241 profile.CreateHistoryService(false, false); | 242 profile.CreateHistoryService(false, false); |
242 if (types & TOP_SITES) { | 243 if (types & TOP_SITES) { |
243 profile.CreateTopSites(); | 244 profile.CreateTopSites(); |
244 profile.BlockUntilTopSitesLoaded(); | 245 profile.BlockUntilTopSitesLoaded(); |
245 } | 246 } |
246 | 247 |
247 srand(static_cast<unsigned int>(Time::Now().ToInternalValue())); | 248 srand(static_cast<unsigned int>(Time::Now().ToInternalValue())); |
248 | 249 |
249 // The maximum number of URLs to insert into history in one batch. | 250 // The maximum number of URLs to insert into history in one batch. |
(...skipping 26 matching lines...) Expand all Loading... |
276 dst_file.value().c_str()); | 277 dst_file.value().c_str()); |
277 if (!file_util::CopyFile(path, dst_file)) { | 278 if (!file_util::CopyFile(path, dst_file)) { |
278 printf("Copying file failed: %d\n", ::GetLastError()); | 279 printf("Copying file failed: %d\n", ::GetLastError()); |
279 return -1; | 280 return -1; |
280 } | 281 } |
281 path = file_iterator.Next(); | 282 path = file_iterator.Next(); |
282 } | 283 } |
283 | 284 |
284 return 0; | 285 return 0; |
285 } | 286 } |
OLD | NEW |