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

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

Issue 8392041: Prerendered tabs use the same SessionStorage namespace as the tab that triggered the prerender. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove check Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/search_engines/template_url.h" 31 #include "chrome/browser/search_engines/template_url.h"
32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
33 #include "chrome/browser/search_engines/template_url_service.h" 33 #include "chrome/browser/search_engines/template_url_service.h"
34 #include "chrome/browser/search_engines/template_url_service_factory.h" 34 #include "chrome/browser/search_engines/template_url_service_factory.h"
35 #include "chrome/browser/ui/browser_list.h" 35 #include "chrome/browser/ui/browser_list.h"
36 #include "chrome/browser/ui/omnibox/omnibox_view.h" 36 #include "chrome/browser/ui/omnibox/omnibox_view.h"
37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
38 #include "chrome/common/chrome_notification_types.h" 38 #include "chrome/common/chrome_notification_types.h"
39 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
40 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
41 #include "content/browser/renderer_host/render_view_host.h"
41 #include "content/browser/user_metrics.h" 42 #include "content/browser/user_metrics.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "googleurl/src/gurl.h" 44 #include "googleurl/src/gurl.h"
44 #include "googleurl/src/url_util.h" 45 #include "googleurl/src/url_util.h"
45 #include "third_party/skia/include/core/SkBitmap.h" 46 #include "third_party/skia/include/core/SkBitmap.h"
46 47
47 /////////////////////////////////////////////////////////////////////////////// 48 ///////////////////////////////////////////////////////////////////////////////
48 // AutocompleteEditController 49 // AutocompleteEditController
49 50
50 AutocompleteEditController::~AutocompleteEditController() { 51 AutocompleteEditController::~AutocompleteEditController() {
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 } 1031 }
1031 1032
1032 void AutocompleteEditModel::DoPrerender(const AutocompleteMatch& match) { 1033 void AutocompleteEditModel::DoPrerender(const AutocompleteMatch& match) {
1033 // Do not prerender if the destination URL is the same as the current URL. 1034 // Do not prerender if the destination URL is the same as the current URL.
1034 if (match.destination_url == PermanentURL()) 1035 if (match.destination_url == PermanentURL())
1035 return; 1036 return;
1036 if (user_input_in_progress() && popup_->IsOpen()) { 1037 if (user_input_in_progress() && popup_->IsOpen()) {
1037 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); 1038 TabContentsWrapper* tab = controller_->GetTabContentsWrapper();
1038 prerender::PrerenderManager* prerender_manager = 1039 prerender::PrerenderManager* prerender_manager =
1039 prerender::PrerenderManagerFactory::GetForProfile(tab->profile()); 1040 prerender::PrerenderManagerFactory::GetForProfile(tab->profile());
1040 if (prerender_manager) 1041 if (prerender_manager) {
1041 prerender_manager->AddPrerenderFromOmnibox(match.destination_url); 1042 RenderViewHost* current_host = tab->tab_contents()->render_view_host();
1043 prerender_manager->AddPrerenderFromOmnibox(
1044 match.destination_url, current_host->session_storage_namespace());
1045 }
1042 } 1046 }
1043 } 1047 }
1044 1048
1045 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) { 1049 void AutocompleteEditModel::DoPreconnect(const AutocompleteMatch& match) {
1046 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { 1050 if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) {
1047 // Warm up DNS Prefetch cache, or preconnect to a search service. 1051 // Warm up DNS Prefetch cache, or preconnect to a search service.
1048 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, 1052 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type,
1049 AutocompleteMatch::NUM_TYPES); 1053 AutocompleteMatch::NUM_TYPES);
1050 if (profile_->GetNetworkPredictor()) { 1054 if (profile_->GetNetworkPredictor()) {
1051 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl( 1055 profile_->GetNetworkPredictor()->AnticipateOmniboxUrl(
1052 match.destination_url, 1056 match.destination_url,
1053 NetworkActionPredictor::IsPreconnectable(match)); 1057 NetworkActionPredictor::IsPreconnectable(match));
1054 } 1058 }
1055 // We could prefetch the alternate nav URL, if any, but because there 1059 // We could prefetch the alternate nav URL, if any, but because there
1056 // can be many of these as a user types an initial series of characters, 1060 // can be many of these as a user types an initial series of characters,
1057 // the OS DNS cache could suffer eviction problems for minimal gain. 1061 // the OS DNS cache could suffer eviction problems for minimal gain.
1058 } 1062 }
1059 } 1063 }
1060 1064
1061 // static 1065 // static
1062 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { 1066 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) {
1063 switch (c) { 1067 switch (c) {
1064 case 0x0020: // Space 1068 case 0x0020: // Space
1065 case 0x3000: // Ideographic Space 1069 case 0x3000: // Ideographic Space
1066 return true; 1070 return true;
1067 default: 1071 default:
1068 return false; 1072 return false;
1069 } 1073 }
1070 } 1074 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698