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

Side by Side Diff: chrome/browser/predictors/autocomplete_action_predictor.cc

Issue 10553029: Handle interface to prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more standard code, simpler handle, no class explosion Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/predictors/autocomplete_action_predictor.h" 5 #include "chrome/browser/predictors/autocomplete_action_predictor.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 UMA_HISTOGRAM_BOOLEAN( 304 UMA_HISTOGRAM_BOOLEAN(
305 StringPrintf("Prerender.OmniboxNavigationsCouldPrerender%s", 305 StringPrintf("Prerender.OmniboxNavigationsCouldPrerender%s",
306 prerender::PrerenderManager::GetModeString()).c_str(), 306 prerender::PrerenderManager::GetModeString()).c_str(),
307 prerender::IsOmniboxEnabled(profile_)); 307 prerender::IsOmniboxEnabled(profile_));
308 308
309 const GURL& opened_url = match.destination_url; 309 const GURL& opened_url = match.destination_url;
310 310
311 // If the Omnibox triggered a prerender but the URL doesn't match the one the 311 // If the Omnibox triggered a prerender but the URL doesn't match the one the
312 // user is navigating to, cancel the prerender. 312 // user is navigating to, cancel the prerender.
313 prerender::PrerenderManager* prerender_manager = 313 // prerender::PrerenderManager* prerender_manager =
314 prerender::PrerenderManagerFactory::GetForProfile(profile_); 314 // prerender::PrerenderManagerFactory::GetForProfile(profile_);
315 // |prerender_manager| can be NULL in incognito mode or if prerendering is 315 // |prerender_manager| can be NULL in incognito mode or if prerendering is
316 // otherwise disabled. 316 // otherwise disabled.
317 if (prerender_manager && !prerender_manager->IsPrerendering(opened_url)) 317 // if (prerender_manager && !prerender_manager->IsPrerendering(opened_url))
318 prerender_manager->CancelOmniboxPrerenders(); 318 // prerender_manager->CancelOmniboxPrerenders();
dominich 2012/06/22 15:36:16 will this come back in some form?
319 319
320 const string16 lower_user_text(base::i18n::ToLower(log.text)); 320 const string16 lower_user_text(base::i18n::ToLower(log.text));
321 321
322 // Traverse transitional matches for those that have a user_text that is a 322 // Traverse transitional matches for those that have a user_text that is a
323 // prefix of |lower_user_text|. 323 // prefix of |lower_user_text|.
324 std::vector<AutocompleteActionPredictorTable::Row> rows_to_add; 324 std::vector<AutocompleteActionPredictorTable::Row> rows_to_add;
325 std::vector<AutocompleteActionPredictorTable::Row> rows_to_update; 325 std::vector<AutocompleteActionPredictorTable::Row> rows_to_update;
326 326
327 for (std::vector<TransitionalMatch>::const_iterator it = 327 for (std::vector<TransitionalMatch>::const_iterator it =
328 transitional_matches_.begin(); it != transitional_matches_.end(); 328 transitional_matches_.begin(); it != transitional_matches_.end();
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 return number_of_hits / (number_of_hits + value.number_of_misses); 559 return number_of_hits / (number_of_hits + value.number_of_misses);
560 } 560 }
561 561
562 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { 562 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() {
563 } 563 }
564 564
565 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { 565 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() {
566 } 566 }
567 567
568 } // namespace predictors 568 } // namespace predictors
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_browsertest.cc » ('j') | chrome/browser/prerender/prerender_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698