OLD | NEW |
---|---|
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 #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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1029 return false; | 1029 return false; |
1030 | 1030 |
1031 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); | 1031 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); |
1032 | 1032 |
1033 if (!tab) | 1033 if (!tab) |
1034 return false; | 1034 return false; |
1035 | 1035 |
1036 if (user_input_in_progress() && popup_->IsOpen()) { | 1036 if (user_input_in_progress() && popup_->IsOpen()) { |
1037 return instant->Update(tab, match, view_->GetText(), UseVerbatimInstant(), | 1037 return instant->Update(tab, match, view_->GetText(), UseVerbatimInstant(), |
1038 suggested_text); | 1038 suggested_text); |
1039 } else { | 1039 } else { |
Peter Kasting
2011/12/01 21:03:38
Nit: While here... no else after return.
dominich
2011/12/02 00:30:41
Done.
| |
1040 instant->Hide(); | 1040 instant->Hide(); |
1041 return false; | 1041 return false; |
1042 } | 1042 } |
1043 } | 1043 } |
1044 | 1044 |
1045 void AutocompleteEditModel::DoPrerender(const AutocompleteMatch& match) { | 1045 void AutocompleteEditModel::DoPrerender(const AutocompleteMatch& match) { |
1046 // Do not prerender if the destination URL is the same as the current URL. | 1046 // Do not prerender if the destination URL is the same as the current URL. |
1047 if (match.destination_url == PermanentURL()) | 1047 if (match.destination_url == PermanentURL()) |
1048 return; | 1048 return; |
1049 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); | 1049 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); |
1050 if (!tab) | |
1051 return; | |
Peter Kasting
2011/12/01 21:03:38
Nit: It would be nice to write a comment here expl
dominich
2011/12/02 00:30:41
Done.
| |
1050 prerender::PrerenderManager* prerender_manager = | 1052 prerender::PrerenderManager* prerender_manager = |
1051 prerender::PrerenderManagerFactory::GetForProfile(tab->profile()); | 1053 prerender::PrerenderManagerFactory::GetForProfile(tab->profile()); |
1052 if (prerender_manager) { | 1054 if (prerender_manager) { |
1053 RenderViewHost* current_host = tab->tab_contents()->render_view_host(); | 1055 RenderViewHost* current_host = tab->tab_contents()->render_view_host(); |
1054 prerender_manager->AddPrerenderFromOmnibox( | 1056 prerender_manager->AddPrerenderFromOmnibox( |
1055 match.destination_url, current_host->session_storage_namespace()); | 1057 match.destination_url, current_host->session_storage_namespace()); |
1056 } | 1058 } |
1057 } | 1059 } |
1058 | 1060 |
1059 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) { | 1061 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) { |
(...skipping 15 matching lines...) Expand all Loading... | |
1075 // static | 1077 // static |
1076 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { | 1078 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { |
1077 switch (c) { | 1079 switch (c) { |
1078 case 0x0020: // Space | 1080 case 0x0020: // Space |
1079 case 0x3000: // Ideographic Space | 1081 case 0x3000: // Ideographic Space |
1080 return true; | 1082 return true; |
1081 default: | 1083 default: |
1082 return false; | 1084 return false; |
1083 } | 1085 } |
1084 } | 1086 } |
OLD | NEW |