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" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 scoped_ptr<SkBitmap> google_bitmap( | 133 scoped_ptr<SkBitmap> google_bitmap( |
134 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); | 134 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); |
135 scoped_ptr<SkBitmap> weewar_bitmap( | 135 scoped_ptr<SkBitmap> weewar_bitmap( |
136 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); | 136 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); |
137 | 137 |
138 printf("Inserting %d URLs...\n", batch_size); | 138 printf("Inserting %d URLs...\n", batch_size); |
139 GURL previous_url; | 139 GURL previous_url; |
140 PageTransition::Type transition = PageTransition::TYPED; | 140 PageTransition::Type transition = PageTransition::TYPED; |
141 const int end_page_id = page_id + batch_size; | 141 const int end_page_id = page_id + batch_size; |
142 history::TopSites* top_sites = | 142 history::TopSites* top_sites = profile->GetTopSites(); |
143 history::TopSites::IsEnabled() ? profile->GetTopSites() : NULL; | |
144 for (; page_id < end_page_id; ++page_id) { | 143 for (; page_id < end_page_id; ++page_id) { |
145 // Randomly decide whether this new URL simulates following a link or | 144 // Randomly decide whether this new URL simulates following a link or |
146 // whether it's a jump to a new URL. | 145 // whether it's a jump to a new URL. |
147 if (!previous_url.is_empty() && RandomFloat() < kFollowLinkProbability) { | 146 if (!previous_url.is_empty() && RandomFloat() < kFollowLinkProbability) { |
148 transition = PageTransition::LINK; | 147 transition = PageTransition::LINK; |
149 } else { | 148 } else { |
150 previous_url = GURL(); | 149 previous_url = GURL(); |
151 transition = PageTransition::TYPED; | 150 transition = PageTransition::TYPED; |
152 } | 151 } |
153 | 152 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 dst_file.value().c_str()); | 277 dst_file.value().c_str()); |
279 if (!file_util::CopyFile(path, dst_file)) { | 278 if (!file_util::CopyFile(path, dst_file)) { |
280 printf("Copying file failed: %d\n", ::GetLastError()); | 279 printf("Copying file failed: %d\n", ::GetLastError()); |
281 return -1; | 280 return -1; |
282 } | 281 } |
283 path = file_iterator.Next(); | 282 path = file_iterator.Next(); |
284 } | 283 } |
285 | 284 |
286 return 0; | 285 return 0; |
287 } | 286 } |
OLD | NEW |