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

Side by Side Diff: chrome/browser/ui/search/instant_search_prerenderer.cc

Issue 609493002: Propagate the search request params from the browser to the Instant search base page to fix the embe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/search/instant_search_prerenderer.h" 5 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
6 6
7 #include "chrome/browser/prerender/prerender_handle.h" 7 #include "chrome/browser/prerender/prerender_handle.h"
8 #include "chrome/browser/prerender/prerender_manager.h" 8 #include "chrome/browser/prerender/prerender_manager.h"
9 #include "chrome/browser/prerender/prerender_manager_factory.h" 9 #include "chrome/browser/prerender/prerender_manager_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return; 93 return;
94 94
95 if (!prerender_contents()) 95 if (!prerender_contents())
96 return; 96 return;
97 97
98 last_instant_suggestion_ = suggestion; 98 last_instant_suggestion_ = suggestion;
99 SearchTabHelper::FromWebContents(prerender_contents())-> 99 SearchTabHelper::FromWebContents(prerender_contents())->
100 SetSuggestionToPrefetch(suggestion); 100 SetSuggestionToPrefetch(suggestion);
101 } 101 }
102 102
103 void InstantSearchPrerenderer::Commit(const base::string16& query) { 103 void InstantSearchPrerenderer::Commit(
104 const base::string16& query,
105 const EmbeddedSearchRequestParams& params) {
104 DCHECK(prerender_handle_); 106 DCHECK(prerender_handle_);
105 DCHECK(prerender_contents()); 107 DCHECK(prerender_contents());
106 SearchTabHelper::FromWebContents(prerender_contents())->Submit(query); 108 SearchTabHelper::FromWebContents(prerender_contents())->Submit(query, params);
107 } 109 }
108 110
109 bool InstantSearchPrerenderer::CanCommitQuery( 111 bool InstantSearchPrerenderer::CanCommitQuery(
110 content::WebContents* source, 112 content::WebContents* source,
111 const base::string16& query) const { 113 const base::string16& query) const {
112 if (!source || query.empty() || !prerender_handle_ || 114 if (!source || query.empty() || !prerender_handle_ ||
113 !prerender_handle_->IsFinishedLoading() || 115 !prerender_handle_->IsFinishedLoading() ||
114 !prerender_contents() || !QueryMatchesPrefetch(query)) { 116 !prerender_contents() || !QueryMatchesPrefetch(query)) {
115 return false; 117 return false;
116 } 118 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return (prerender_handle_ && prerender_handle_->contents()) ? 153 return (prerender_handle_ && prerender_handle_->contents()) ?
152 prerender_handle_->contents()->prerender_contents() : NULL; 154 prerender_handle_->contents()->prerender_contents() : NULL;
153 } 155 }
154 156
155 bool InstantSearchPrerenderer::QueryMatchesPrefetch( 157 bool InstantSearchPrerenderer::QueryMatchesPrefetch(
156 const base::string16& query) const { 158 const base::string16& query) const {
157 if (chrome::ShouldReuseInstantSearchBasePage()) 159 if (chrome::ShouldReuseInstantSearchBasePage())
158 return true; 160 return true;
159 return last_instant_suggestion_.text == query; 161 return last_instant_suggestion_.text == query;
160 } 162 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_search_prerenderer.h ('k') | chrome/browser/ui/search/instant_search_prerenderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698