| 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 24 matching lines...) Expand all Loading... |
| 35 #include "chrome/browser/search_engines/template_url_service.h" | 35 #include "chrome/browser/search_engines/template_url_service.h" |
| 36 #include "chrome/browser/search_engines/template_url_service_factory.h" | 36 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 37 #include "chrome/browser/sessions/restore_tab_helper.h" | 37 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 38 #include "chrome/browser/ui/browser_list.h" | 38 #include "chrome/browser/ui/browser_list.h" |
| 39 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 39 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 40 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 40 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 41 #include "chrome/common/chrome_notification_types.h" | 41 #include "chrome/common/chrome_notification_types.h" |
| 42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
| 43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 44 #include "content/browser/renderer_host/render_view_host.h" | 44 #include "content/browser/renderer_host/render_view_host.h" |
| 45 #include "content/browser/tab_contents/tab_contents.h" | |
| 46 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/user_metrics.h" | 46 #include "content/public/browser/user_metrics.h" |
| 47 #include "content/public/browser/web_contents.h" |
| 48 #include "googleurl/src/gurl.h" | 48 #include "googleurl/src/gurl.h" |
| 49 #include "googleurl/src/url_util.h" | 49 #include "googleurl/src/url_util.h" |
| 50 #include "third_party/skia/include/core/SkBitmap.h" | 50 #include "third_party/skia/include/core/SkBitmap.h" |
| 51 | 51 |
| 52 using content::UserMetricsAction; | 52 using content::UserMetricsAction; |
| 53 | 53 |
| 54 /////////////////////////////////////////////////////////////////////////////// | 54 /////////////////////////////////////////////////////////////////////////////// |
| 55 // AutocompleteEditController | 55 // AutocompleteEditController |
| 56 | 56 |
| 57 AutocompleteEditController::~AutocompleteEditController() { | 57 AutocompleteEditController::~AutocompleteEditController() { |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 return; | 1066 return; |
| 1067 // It's possible the tab strip does not have an active tab contents, for | 1067 // It's possible the tab strip does not have an active tab contents, for |
| 1068 // instance if the tab has been closed or on return from a sleep state | 1068 // instance if the tab has been closed or on return from a sleep state |
| 1069 // (http://crbug.com/105689) | 1069 // (http://crbug.com/105689) |
| 1070 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); | 1070 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); |
| 1071 if (!tab) | 1071 if (!tab) |
| 1072 return; | 1072 return; |
| 1073 prerender::PrerenderManager* prerender_manager = | 1073 prerender::PrerenderManager* prerender_manager = |
| 1074 prerender::PrerenderManagerFactory::GetForProfile(tab->profile()); | 1074 prerender::PrerenderManagerFactory::GetForProfile(tab->profile()); |
| 1075 if (prerender_manager) { | 1075 if (prerender_manager) { |
| 1076 RenderViewHost* current_host = tab->tab_contents()->GetRenderViewHost(); | 1076 RenderViewHost* current_host = tab->web_contents()->GetRenderViewHost(); |
| 1077 prerender_manager->AddPrerenderFromOmnibox( | 1077 prerender_manager->AddPrerenderFromOmnibox( |
| 1078 match.destination_url, current_host->session_storage_namespace()); | 1078 match.destination_url, current_host->session_storage_namespace()); |
| 1079 } | 1079 } |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) { | 1082 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) { |
| 1083 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { | 1083 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { |
| 1084 // Warm up DNS Prefetch cache, or preconnect to a search service. | 1084 // Warm up DNS Prefetch cache, or preconnect to a search service. |
| 1085 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, | 1085 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, |
| 1086 AutocompleteMatch::NUM_TYPES); | 1086 AutocompleteMatch::NUM_TYPES); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1098 // static | 1098 // static |
| 1099 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { | 1099 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { |
| 1100 switch (c) { | 1100 switch (c) { |
| 1101 case 0x0020: // Space | 1101 case 0x0020: // Space |
| 1102 case 0x3000: // Ideographic Space | 1102 case 0x3000: // Ideographic Space |
| 1103 return true; | 1103 return true; |
| 1104 default: | 1104 default: |
| 1105 return false; | 1105 return false; |
| 1106 } | 1106 } |
| 1107 } | 1107 } |
| OLD | NEW |