Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/tools/profiles/generate_profile.cc

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | content/browser/download/download_create_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // Scoping value for page IDs (required by the history service). 130 // Scoping value for page IDs (required by the history service).
131 void* id_scope = reinterpret_cast<void*>(1); 131 void* id_scope = reinterpret_cast<void*>(1);
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 content::PageTransition transition = content::PAGE_TRANSITION_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 = profile->GetTopSites(); 142 history::TopSites* top_sites = profile->GetTopSites();
143 for (; page_id < end_page_id; ++page_id) { 143 for (; page_id < end_page_id; ++page_id) {
144 // Randomly decide whether this new URL simulates following a link or 144 // Randomly decide whether this new URL simulates following a link or
145 // whether it's a jump to a new URL. 145 // whether it's a jump to a new URL.
146 if (!previous_url.is_empty() && RandomFloat() < kFollowLinkProbability) { 146 if (!previous_url.is_empty() && RandomFloat() < kFollowLinkProbability) {
147 transition = PageTransition::LINK; 147 transition = content::PAGE_TRANSITION_LINK;
148 } else { 148 } else {
149 previous_url = GURL(); 149 previous_url = GURL();
150 transition = PageTransition::TYPED; 150 transition = content::PAGE_TRANSITION_TYPED;
151 } 151 }
152 152
153 // Pick a URL, either newly at random or from our list of previously 153 // Pick a URL, either newly at random or from our list of previously
154 // visited URLs. 154 // visited URLs.
155 GURL url; 155 GURL url;
156 if (!revisit_urls.empty() && RandomFloat() < kRevisitLinkProbability) { 156 if (!revisit_urls.empty() && RandomFloat() < kRevisitLinkProbability) {
157 // Draw a URL from revisit_urls at random. 157 // Draw a URL from revisit_urls at random.
158 url = revisit_urls[RandomInt(0, static_cast<int>(revisit_urls.size()))]; 158 url = revisit_urls[RandomInt(0, static_cast<int>(revisit_urls.size()))];
159 } else { 159 } else {
160 url = ConstructRandomURL(); 160 url = ConstructRandomURL();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | content/browser/download/download_create_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698