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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/i18n/icu_util.h" | 14 #include "base/i18n/icu_util.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
19 #include "base/time.h" | 19 #include "base/time.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "chrome/browser/history/history.h" | 21 #include "chrome/browser/history/history.h" |
22 #include "chrome/browser/history/top_sites.h" | 22 #include "chrome/browser/history/top_sites.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
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/browser_thread.h" | 26 #include "content/browser/browser_thread.h" |
27 #include "content/common/notification_service.h" | 27 #include "content/browser/notification_service_impl.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 | 34 |
35 // Addition types data can be generated for. By default only urls/visits are | 35 // Addition types data can be generated for. By default only urls/visits are |
36 // added. | 36 // added. |
37 enum Types { | 37 enum Types { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 printf("Unable to create directory %ls: %d\n", | 226 printf("Unable to create directory %ls: %d\n", |
227 dst_dir.value().c_str(), | 227 dst_dir.value().c_str(), |
228 ::GetLastError()); | 228 ::GetLastError()); |
229 } | 229 } |
230 | 230 |
231 icu_util::Initialize(); | 231 icu_util::Initialize(); |
232 | 232 |
233 chrome::RegisterPathProvider(); | 233 chrome::RegisterPathProvider(); |
234 ui::RegisterPathProvider(); | 234 ui::RegisterPathProvider(); |
235 ResourceBundle::InitSharedInstance("en-US"); | 235 ResourceBundle::InitSharedInstance("en-US"); |
236 NotificationService notification_service; | 236 NotificationServiceImpl notification_service; |
237 MessageLoopForUI message_loop; | 237 MessageLoopForUI message_loop; |
238 BrowserThread ui_thread(BrowserThread::UI, &message_loop); | 238 BrowserThread ui_thread(BrowserThread::UI, &message_loop); |
239 BrowserThread db_thread(BrowserThread::DB, &message_loop); | 239 BrowserThread db_thread(BrowserThread::DB, &message_loop); |
240 TestingProfile profile; | 240 TestingProfile profile; |
241 profile.CreateHistoryService(false, false); | 241 profile.CreateHistoryService(false, false); |
242 if (types & TOP_SITES) { | 242 if (types & TOP_SITES) { |
243 profile.CreateTopSites(); | 243 profile.CreateTopSites(); |
244 profile.BlockUntilTopSitesLoaded(); | 244 profile.BlockUntilTopSitesLoaded(); |
245 } | 245 } |
246 | 246 |
(...skipping 29 matching lines...) Expand all Loading... |
276 dst_file.value().c_str()); | 276 dst_file.value().c_str()); |
277 if (!file_util::CopyFile(path, dst_file)) { | 277 if (!file_util::CopyFile(path, dst_file)) { |
278 printf("Copying file failed: %d\n", ::GetLastError()); | 278 printf("Copying file failed: %d\n", ::GetLastError()); |
279 return -1; | 279 return -1; |
280 } | 280 } |
281 path = file_iterator.Next(); | 281 path = file_iterator.Next(); |
282 } | 282 } |
283 | 283 |
284 return 0; | 284 return 0; |
285 } | 285 } |
OLD | NEW |