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

Side by Side Diff: chrome/renderer/searchbox/searchbox.cc

Issue 741593003: Merge: Propagate the search request params from the browser to the Instant search base page to fix … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2214
Patch Set: 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
« no previous file with comments | « chrome/renderer/searchbox/searchbox.h ('k') | chrome/renderer/searchbox/searchbox_extension.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/renderer/searchbox/searchbox.h" 5 #include "chrome/renderer/searchbox/searchbox.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 InstantRestrictedID most_visited_item_id, 230 InstantRestrictedID most_visited_item_id,
231 InstantMostVisitedItem* item) const { 231 InstantMostVisitedItem* item) const {
232 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id, 232 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id,
233 item); 233 item);
234 } 234 }
235 235
236 const ThemeBackgroundInfo& SearchBox::GetThemeBackgroundInfo() { 236 const ThemeBackgroundInfo& SearchBox::GetThemeBackgroundInfo() {
237 return theme_info_; 237 return theme_info_;
238 } 238 }
239 239
240 const EmbeddedSearchRequestParams& SearchBox::GetEmbeddedSearchRequestParams() {
241 return embedded_search_request_params_;
242 }
243
240 void SearchBox::Focus() { 244 void SearchBox::Focus() {
241 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( 245 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox(
242 render_view()->GetRoutingID(), page_seq_no_, OMNIBOX_FOCUS_VISIBLE)); 246 render_view()->GetRoutingID(), page_seq_no_, OMNIBOX_FOCUS_VISIBLE));
243 } 247 }
244 248
245 void SearchBox::NavigateToURL(const GURL& url, 249 void SearchBox::NavigateToURL(const GURL& url,
246 WindowOpenDisposition disposition, 250 WindowOpenDisposition disposition,
247 bool is_most_visited_item_url) { 251 bool is_most_visited_item_url) {
248 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( 252 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate(
249 render_view()->GetRoutingID(), page_seq_no_, url, 253 render_view()->GetRoutingID(), page_seq_no_, url,
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 423
420 void SearchBox::OnSetSuggestionToPrefetch(const InstantSuggestion& suggestion) { 424 void SearchBox::OnSetSuggestionToPrefetch(const InstantSuggestion& suggestion) {
421 suggestion_ = suggestion; 425 suggestion_ = suggestion;
422 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 426 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
423 DVLOG(1) << render_view() << " OnSetSuggestionToPrefetch"; 427 DVLOG(1) << render_view() << " OnSetSuggestionToPrefetch";
424 extensions_v8::SearchBoxExtension::DispatchSuggestionChange( 428 extensions_v8::SearchBoxExtension::DispatchSuggestionChange(
425 render_view()->GetWebView()->mainFrame()); 429 render_view()->GetWebView()->mainFrame());
426 } 430 }
427 } 431 }
428 432
429 void SearchBox::OnSubmit(const base::string16& query) { 433 void SearchBox::OnSubmit(const base::string16& query,
434 const EmbeddedSearchRequestParams& params) {
430 query_ = query; 435 query_ = query;
436 embedded_search_request_params_ = params;
431 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 437 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
432 DVLOG(1) << render_view() << " OnSubmit"; 438 DVLOG(1) << render_view() << " OnSubmit";
433 extensions_v8::SearchBoxExtension::DispatchSubmit( 439 extensions_v8::SearchBoxExtension::DispatchSubmit(
434 render_view()->GetWebView()->mainFrame()); 440 render_view()->GetWebView()->mainFrame());
435 } 441 }
436 if (!query.empty()) 442 if (!query.empty())
437 Reset(); 443 Reset();
438 } 444 }
439 445
440 void SearchBox::OnThemeChanged(const ThemeBackgroundInfo& theme_info) { 446 void SearchBox::OnThemeChanged(const ThemeBackgroundInfo& theme_info) {
(...skipping 15 matching lines...) Expand all
456 } 462 }
457 } 463 }
458 464
459 GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const { 465 GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const {
460 InstantMostVisitedItem item; 466 InstantMostVisitedItem item;
461 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL(); 467 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL();
462 } 468 }
463 469
464 void SearchBox::Reset() { 470 void SearchBox::Reset() {
465 query_.clear(); 471 query_.clear();
472 embedded_search_request_params_ = EmbeddedSearchRequestParams();
466 suggestion_ = InstantSuggestion(); 473 suggestion_ = InstantSuggestion();
467 start_margin_ = 0; 474 start_margin_ = 0;
468 is_focused_ = false; 475 is_focused_ = false;
469 is_key_capture_enabled_ = false; 476 is_key_capture_enabled_ = false;
470 theme_info_ = ThemeBackgroundInfo(); 477 theme_info_ = ThemeBackgroundInfo();
471 } 478 }
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.h ('k') | chrome/renderer/searchbox/searchbox_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698