Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit.cc

Issue 7467012: Modifying prefetch to account for multi-profile. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 14 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
15 #include "chrome/browser/autocomplete/autocomplete_match.h" 15 #include "chrome/browser/autocomplete/autocomplete_match.h"
16 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 16 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
17 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" 17 #include "chrome/browser/autocomplete/autocomplete_popup_view.h"
18 #include "chrome/browser/autocomplete/keyword_provider.h" 18 #include "chrome/browser/autocomplete/keyword_provider.h"
19 #include "chrome/browser/autocomplete/search_provider.h" 19 #include "chrome/browser/autocomplete/search_provider.h"
20 #include "chrome/browser/command_updater.h" 20 #include "chrome/browser/command_updater.h"
21 #include "chrome/browser/extensions/extension_omnibox_api.h" 21 #include "chrome/browser/extensions/extension_omnibox_api.h"
22 #include "chrome/browser/google/google_url_tracker.h" 22 #include "chrome/browser/google/google_url_tracker.h"
23 #include "chrome/browser/instant/instant_controller.h" 23 #include "chrome/browser/instant/instant_controller.h"
24 #include "chrome/browser/net/predictor_api.h" 24 #include "chrome/browser/net/predictor.h"
25 #include "chrome/browser/net/url_fixer_upper.h" 25 #include "chrome/browser/net/url_fixer_upper.h"
26 #include "chrome/browser/prerender/prerender_manager.h" 26 #include "chrome/browser/prerender/prerender_manager.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/search_engines/template_url.h" 28 #include "chrome/browser/search_engines/template_url.h"
29 #include "chrome/browser/search_engines/template_url_service.h" 29 #include "chrome/browser/search_engines/template_url_service.h"
30 #include "chrome/browser/search_engines/template_url_service_factory.h" 30 #include "chrome/browser/search_engines/template_url_service_factory.h"
31 #include "chrome/browser/ui/browser_list.h" 31 #include "chrome/browser/ui/browser_list.h"
32 #include "chrome/browser/ui/omnibox/omnibox_view.h" 32 #include "chrome/browser/ui/omnibox/omnibox_view.h"
33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
34 #include "chrome/common/chrome_notification_types.h" 34 #include "chrome/common/chrome_notification_types.h"
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 if (match != result.end()) { 846 if (match != result.end()) {
847 if ((match->inline_autocomplete_offset != string16::npos) && 847 if ((match->inline_autocomplete_offset != string16::npos) &&
848 (match->inline_autocomplete_offset < 848 (match->inline_autocomplete_offset <
849 match->fill_into_edit.length())) { 849 match->fill_into_edit.length())) {
850 inline_autocomplete_text = 850 inline_autocomplete_text =
851 match->fill_into_edit.substr(match->inline_autocomplete_offset); 851 match->fill_into_edit.substr(match->inline_autocomplete_offset);
852 } 852 }
853 853
854 if (!match->destination_url.SchemeIs(chrome::kExtensionScheme)) { 854 if (!match->destination_url.SchemeIs(chrome::kExtensionScheme)) {
855 // Warm up DNS Prefetch cache, or preconnect to a search service. 855 // Warm up DNS Prefetch cache, or preconnect to a search service.
856 chrome_browser_net::AnticipateOmniboxUrl(match->destination_url, 856 if (profile_->GetNetworkPredictor()) {
857 IsPreconnectable(match->type)); 857 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl(
858 match->destination_url,
859 IsPreconnectable(match->type));
860 }
858 } 861 }
859 862
860 // We could prefetch the alternate nav URL, if any, but because there 863 // We could prefetch the alternate nav URL, if any, but because there
861 // can be many of these as a user types an initial series of characters, 864 // can be many of these as a user types an initial series of characters,
862 // the OS DNS cache could suffer eviction problems for minimal gain. 865 // the OS DNS cache could suffer eviction problems for minimal gain.
863 866
864 is_keyword_hint = popup_->GetKeywordForMatch(*match, &keyword); 867 is_keyword_hint = popup_->GetKeywordForMatch(*match, &keyword);
865 } 868 }
866 popup_->OnResultChanged(); 869 popup_->OnResultChanged();
867 OnPopupDataChanged(inline_autocomplete_text, NULL, keyword, 870 OnPopupDataChanged(inline_autocomplete_text, NULL, keyword,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 // static 1015 // static
1013 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { 1016 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) {
1014 switch (c) { 1017 switch (c) {
1015 case 0x0020: // Space 1018 case 0x0020: // Space
1016 case 0x3000: // Ideographic Space 1019 case 0x3000: // Ideographic Space
1017 return true; 1020 return true;
1018 default: 1021 default:
1019 return false; 1022 return false;
1020 } 1023 }
1021 } 1024 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_browsertest.cc » ('j') | chrome/browser/browser_about_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698