OLD | NEW |
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Only cancel the old prerender after starting the new one, so if the URLs | 143 // Only cancel the old prerender after starting the new one, so if the URLs |
144 // are the same, the underlying prerender will be reused. | 144 // are the same, the underlying prerender will be reused. |
145 scoped_ptr<prerender::PrerenderHandle> old_prerender_handle( | 145 scoped_ptr<prerender::PrerenderHandle> old_prerender_handle( |
146 prerender_handle_.release()); | 146 prerender_handle_.release()); |
147 if (prerender::PrerenderManager* prerender_manager = | 147 if (prerender::PrerenderManager* prerender_manager = |
148 prerender::PrerenderManagerFactory::GetForProfile(profile_)) { | 148 prerender::PrerenderManagerFactory::GetForProfile(profile_)) { |
149 content::SessionStorageNamespace* session_storage_namespace = NULL; | 149 content::SessionStorageNamespace* session_storage_namespace = NULL; |
150 content::SessionStorageNamespaceMap::const_iterator it = | 150 content::SessionStorageNamespaceMap::const_iterator it = |
151 session_storage_namespace_map.find(std::string()); | 151 session_storage_namespace_map.find(std::string()); |
152 if (it != session_storage_namespace_map.end()) | 152 if (it != session_storage_namespace_map.end()) |
153 session_storage_namespace = it->second; | 153 session_storage_namespace = it->second.get(); |
154 prerender_handle_.reset( | 154 prerender_handle_.reset(prerender_manager->AddPrerenderFromOmnibox( |
155 prerender_manager->AddPrerenderFromOmnibox( | 155 url, session_storage_namespace, size)); |
156 url, session_storage_namespace, size)); | |
157 } | 156 } |
158 if (old_prerender_handle) | 157 if (old_prerender_handle) |
159 old_prerender_handle->OnCancel(); | 158 old_prerender_handle->OnCancel(); |
160 } | 159 } |
161 | 160 |
162 // Given a match, return a recommended action. | 161 // Given a match, return a recommended action. |
163 AutocompleteActionPredictor::Action | 162 AutocompleteActionPredictor::Action |
164 AutocompleteActionPredictor::RecommendAction( | 163 AutocompleteActionPredictor::RecommendAction( |
165 const string16& user_text, | 164 const string16& user_text, |
166 const AutocompleteMatch& match) const { | 165 const AutocompleteMatch& match) const { |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 return number_of_hits / (number_of_hits + value.number_of_misses); | 575 return number_of_hits / (number_of_hits + value.number_of_misses); |
577 } | 576 } |
578 | 577 |
579 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { | 578 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { |
580 } | 579 } |
581 | 580 |
582 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { | 581 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { |
583 } | 582 } |
584 | 583 |
585 } // namespace predictors | 584 } // namespace predictors |
OLD | NEW |