OLD | NEW |
1 // Copyright (c) 2009 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 // 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 "app/app_paths.h" | 10 #include "app/app_paths.h" |
11 #include "app/resource_bundle.h" | |
12 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
14 #include "base/file_path.h" | 13 #include "base/file_path.h" |
15 #include "base/file_util.h" | 14 #include "base/file_util.h" |
16 #include "base/i18n/icu_util.h" | 15 #include "base/i18n/icu_util.h" |
17 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
18 #include "base/path_service.h" | 17 #include "base/path_service.h" |
19 #include "base/process_util.h" | 18 #include "base/process_util.h" |
20 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
21 #include "base/time.h" | 20 #include "base/time.h" |
22 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
23 #include "chrome/browser/browser_thread.h" | 22 #include "chrome/browser/browser_thread.h" |
24 #include "chrome/browser/history/history.h" | 23 #include "chrome/browser/history/history.h" |
25 #include "chrome/browser/history/top_sites.h" | 24 #include "chrome/browser/history/top_sites.h" |
26 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/test/testing_profile.h" | 26 #include "chrome/test/testing_profile.h" |
28 #include "chrome/common/thumbnail_score.h" | 27 #include "chrome/common/thumbnail_score.h" |
29 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
30 #include "gfx/codec/jpeg_codec.h" | 29 #include "gfx/codec/jpeg_codec.h" |
31 #include "third_party/skia/include/core/SkBitmap.h" | 30 #include "third_party/skia/include/core/SkBitmap.h" |
| 31 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/base/ui_base_paths.h" |
32 | 33 |
33 using base::Time; | 34 using base::Time; |
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 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 if (!file_util::CreateDirectory(dst_dir)) { | 227 if (!file_util::CreateDirectory(dst_dir)) { |
227 printf("Unable to create directory %ls: %d\n", | 228 printf("Unable to create directory %ls: %d\n", |
228 dst_dir.value().c_str(), | 229 dst_dir.value().c_str(), |
229 ::GetLastError()); | 230 ::GetLastError()); |
230 } | 231 } |
231 | 232 |
232 icu_util::Initialize(); | 233 icu_util::Initialize(); |
233 | 234 |
234 chrome::RegisterPathProvider(); | 235 chrome::RegisterPathProvider(); |
235 app::RegisterPathProvider(); | 236 app::RegisterPathProvider(); |
| 237 ui::RegisterPathProvider(); |
236 ResourceBundle::InitSharedInstance("en-US"); | 238 ResourceBundle::InitSharedInstance("en-US"); |
237 NotificationService notification_service; | 239 NotificationService notification_service; |
238 MessageLoopForUI message_loop; | 240 MessageLoopForUI message_loop; |
239 BrowserThread ui_thread(BrowserThread::UI, &message_loop); | 241 BrowserThread ui_thread(BrowserThread::UI, &message_loop); |
240 BrowserThread db_thread(BrowserThread::DB, &message_loop); | 242 BrowserThread db_thread(BrowserThread::DB, &message_loop); |
241 TestingProfile profile; | 243 TestingProfile profile; |
242 profile.CreateHistoryService(false, false); | 244 profile.CreateHistoryService(false, false); |
243 if (types & TOP_SITES) { | 245 if (types & TOP_SITES) { |
244 profile.CreateTopSites(); | 246 profile.CreateTopSites(); |
245 profile.BlockUntilTopSitesLoaded(); | 247 profile.BlockUntilTopSitesLoaded(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 dst_file.value().c_str()); | 279 dst_file.value().c_str()); |
278 if (!file_util::CopyFile(path, dst_file)) { | 280 if (!file_util::CopyFile(path, dst_file)) { |
279 printf("Copying file failed: %d\n", ::GetLastError()); | 281 printf("Copying file failed: %d\n", ::GetLastError()); |
280 return -1; | 282 return -1; |
281 } | 283 } |
282 path = file_iterator.Next(); | 284 path = file_iterator.Next(); |
283 } | 285 } |
284 | 286 |
285 return 0; | 287 return 0; |
286 } | 288 } |
OLD | NEW |