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/ui/omnibox/omnibox_edit_model.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 // It's possible the tab strip does not have an active tab contents, for | 1137 // It's possible the tab strip does not have an active tab contents, for |
1138 // instance if the tab has been closed or on return from a sleep state | 1138 // instance if the tab has been closed or on return from a sleep state |
1139 // (http://crbug.com/105689) | 1139 // (http://crbug.com/105689) |
1140 TabContents* tab = controller_->GetTabContents(); | 1140 TabContents* tab = controller_->GetTabContents(); |
1141 if (!tab) | 1141 if (!tab) |
1142 return; | 1142 return; |
1143 gfx::Rect container_bounds; | 1143 gfx::Rect container_bounds; |
1144 tab->web_contents()->GetView()->GetContainerBounds(&container_bounds); | 1144 tab->web_contents()->GetView()->GetContainerBounds(&container_bounds); |
1145 AutocompleteActionPredictorFactory::GetForProfile(profile_)-> | 1145 AutocompleteActionPredictorFactory::GetForProfile(profile_)-> |
1146 StartPrerendering(match.destination_url, | 1146 StartPrerendering(match.destination_url, |
1147 tab->web_contents()->GetRenderViewHost()-> | 1147 tab->web_contents()->GetController() |
1148 GetSessionStorageNamespace(), | 1148 .GetSessionStorageNamespaceMap(), |
1149 container_bounds.size()); | 1149 container_bounds.size()); |
1150 } | 1150 } |
1151 | 1151 |
1152 void OmniboxEditModel::DoPreconnect(const AutocompleteMatch& match) { | 1152 void OmniboxEditModel::DoPreconnect(const AutocompleteMatch& match) { |
1153 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { | 1153 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { |
1154 // Warm up DNS Prefetch cache, or preconnect to a search service. | 1154 // Warm up DNS Prefetch cache, or preconnect to a search service. |
1155 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, | 1155 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, |
1156 AutocompleteMatch::NUM_TYPES); | 1156 AutocompleteMatch::NUM_TYPES); |
1157 if (profile_->GetNetworkPredictor()) { | 1157 if (profile_->GetNetworkPredictor()) { |
1158 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( | 1158 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 } | 1191 } |
1192 | 1192 |
1193 void OmniboxEditModel::ClassifyStringForPasteAndGo( | 1193 void OmniboxEditModel::ClassifyStringForPasteAndGo( |
1194 const string16& text, | 1194 const string16& text, |
1195 AutocompleteMatch* match, | 1195 AutocompleteMatch* match, |
1196 GURL* alternate_nav_url) const { | 1196 GURL* alternate_nav_url) const { |
1197 DCHECK(match); | 1197 DCHECK(match); |
1198 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, | 1198 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, |
1199 string16(), false, false, match, alternate_nav_url); | 1199 string16(), false, false, match, alternate_nav_url); |
1200 } | 1200 } |
OLD | NEW |