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/autocomplete/autocomplete_edit.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 // instance if the tab has been closed or on return from a sleep state | 1113 // instance if the tab has been closed or on return from a sleep state |
1114 // (http://crbug.com/105689) | 1114 // (http://crbug.com/105689) |
1115 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); | 1115 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); |
1116 if (!tab) | 1116 if (!tab) |
1117 return; | 1117 return; |
1118 prerender::PrerenderManager* prerender_manager = | 1118 prerender::PrerenderManager* prerender_manager = |
1119 prerender::PrerenderManagerFactory::GetForProfile(tab->profile()); | 1119 prerender::PrerenderManagerFactory::GetForProfile(tab->profile()); |
1120 if (prerender_manager) { | 1120 if (prerender_manager) { |
1121 RenderViewHost* current_host = tab->web_contents()->GetRenderViewHost(); | 1121 RenderViewHost* current_host = tab->web_contents()->GetRenderViewHost(); |
1122 prerender_manager->AddPrerenderFromOmnibox( | 1122 prerender_manager->AddPrerenderFromOmnibox( |
1123 match.destination_url, current_host->session_storage_namespace()); | 1123 match.destination_url, current_host->GetSessionStorageNamespace()); |
1124 } | 1124 } |
1125 } | 1125 } |
1126 | 1126 |
1127 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) { | 1127 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) { |
1128 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { | 1128 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { |
1129 // Warm up DNS Prefetch cache, or preconnect to a search service. | 1129 // Warm up DNS Prefetch cache, or preconnect to a search service. |
1130 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, | 1130 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, |
1131 AutocompleteMatch::NUM_TYPES); | 1131 AutocompleteMatch::NUM_TYPES); |
1132 if (profile_->GetNetworkPredictor()) { | 1132 if (profile_->GetNetworkPredictor()) { |
1133 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( | 1133 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( |
1134 match.destination_url, | 1134 match.destination_url, |
1135 NetworkActionPredictor::IsPreconnectable(match)); | 1135 NetworkActionPredictor::IsPreconnectable(match)); |
1136 } | 1136 } |
1137 // We could prefetch the alternate nav URL, if any, but because there | 1137 // We could prefetch the alternate nav URL, if any, but because there |
1138 // can be many of these as a user types an initial series of characters, | 1138 // can be many of these as a user types an initial series of characters, |
1139 // the OS DNS cache could suffer eviction problems for minimal gain. | 1139 // the OS DNS cache could suffer eviction problems for minimal gain. |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | 1142 |
1143 // static | 1143 // static |
1144 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { | 1144 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { |
1145 switch (c) { | 1145 switch (c) { |
1146 case 0x0020: // Space | 1146 case 0x0020: // Space |
1147 case 0x3000: // Ideographic Space | 1147 case 0x3000: // Ideographic Space |
1148 return true; | 1148 return true; |
1149 default: | 1149 default: |
1150 return false; | 1150 return false; |
1151 } | 1151 } |
1152 } | 1152 } |
OLD | NEW |