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

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

Issue 1543203002: Remove a variety of no-longer-used query params. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 11 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
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_extension.h" 5 #include "chrome/renderer/searchbox/searchbox_extension.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 "if (window.chrome &&" 346 "if (window.chrome &&"
347 " window.chrome.embeddedSearch &&" 347 " window.chrome.embeddedSearch &&"
348 " window.chrome.embeddedSearch.searchBox &&" 348 " window.chrome.embeddedSearch.searchBox &&"
349 " window.chrome.embeddedSearch.searchBox.onkeycapturechange &&" 349 " window.chrome.embeddedSearch.searchBox.onkeycapturechange &&"
350 " typeof window.chrome.embeddedSearch.searchBox.onkeycapturechange ==" 350 " typeof window.chrome.embeddedSearch.searchBox.onkeycapturechange =="
351 " 'function') {" 351 " 'function') {"
352 " window.chrome.embeddedSearch.searchBox.onkeycapturechange();" 352 " window.chrome.embeddedSearch.searchBox.onkeycapturechange();"
353 " true;" 353 " true;"
354 "}"; 354 "}";
355 355
356 static const char kDispatchMarginChangeEventScript[] =
357 "if (window.chrome &&"
358 " window.chrome.embeddedSearch &&"
359 " window.chrome.embeddedSearch.searchBox &&"
360 " window.chrome.embeddedSearch.searchBox.onmarginchange &&"
361 " typeof window.chrome.embeddedSearch.searchBox.onmarginchange =="
362 " 'function') {"
363 " window.chrome.embeddedSearch.searchBox.onmarginchange();"
364 " true;"
365 "}";
366
367 static const char kDispatchMostVisitedChangedScript[] = 356 static const char kDispatchMostVisitedChangedScript[] =
368 "if (window.chrome &&" 357 "if (window.chrome &&"
369 " window.chrome.embeddedSearch &&" 358 " window.chrome.embeddedSearch &&"
370 " window.chrome.embeddedSearch.newTabPage &&" 359 " window.chrome.embeddedSearch.newTabPage &&"
371 " window.chrome.embeddedSearch.newTabPage.onmostvisitedchange &&" 360 " window.chrome.embeddedSearch.newTabPage.onmostvisitedchange &&"
372 " typeof window.chrome.embeddedSearch.newTabPage.onmostvisitedchange ==" 361 " typeof window.chrome.embeddedSearch.newTabPage.onmostvisitedchange =="
373 " 'function') {" 362 " 'function') {"
374 " window.chrome.embeddedSearch.newTabPage.onmostvisitedchange();" 363 " window.chrome.embeddedSearch.newTabPage.onmostvisitedchange();"
375 " true;" 364 " true;"
376 "}"; 365 "}";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // Gets the submitted value of the user's search query. 448 // Gets the submitted value of the user's search query.
460 static void GetQuery(const v8::FunctionCallbackInfo<v8::Value>& args); 449 static void GetQuery(const v8::FunctionCallbackInfo<v8::Value>& args);
461 450
462 // Returns true if the Searchbox itself is oriented right-to-left. 451 // Returns true if the Searchbox itself is oriented right-to-left.
463 static void GetRightToLeft(const v8::FunctionCallbackInfo<v8::Value>& args); 452 static void GetRightToLeft(const v8::FunctionCallbackInfo<v8::Value>& args);
464 453
465 // Gets the Embedded Search request params. Used for logging purposes. 454 // Gets the Embedded Search request params. Used for logging purposes.
466 static void GetSearchRequestParams( 455 static void GetSearchRequestParams(
467 const v8::FunctionCallbackInfo<v8::Value>& args); 456 const v8::FunctionCallbackInfo<v8::Value>& args);
468 457
469 // Gets the start-edge margin to use with extended Instant.
470 static void GetStartMargin(const v8::FunctionCallbackInfo<v8::Value>& args);
471
472 // Gets the current top suggestion to prefetch search results. 458 // Gets the current top suggestion to prefetch search results.
473 static void GetSuggestionToPrefetch( 459 static void GetSuggestionToPrefetch(
474 const v8::FunctionCallbackInfo<v8::Value>& args); 460 const v8::FunctionCallbackInfo<v8::Value>& args);
475 461
476 // Gets the background info of the theme currently adopted by browser. 462 // Gets the background info of the theme currently adopted by browser.
477 // Call only when overlay is showing NTP page. 463 // Call only when overlay is showing NTP page.
478 static void GetThemeBackgroundInfo( 464 static void GetThemeBackgroundInfo(
479 const v8::FunctionCallbackInfo<v8::Value>& args); 465 const v8::FunctionCallbackInfo<v8::Value>& args);
480 466
481 // Gets whether the omnibox has focus or not. 467 // Gets whether the omnibox has focus or not.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 void SearchBoxExtension::DispatchInputStart(blink::WebFrame* frame) { 570 void SearchBoxExtension::DispatchInputStart(blink::WebFrame* frame) {
585 Dispatch(frame, kDispatchInputStartScript); 571 Dispatch(frame, kDispatchInputStartScript);
586 } 572 }
587 573
588 // static 574 // static
589 void SearchBoxExtension::DispatchKeyCaptureChange(blink::WebFrame* frame) { 575 void SearchBoxExtension::DispatchKeyCaptureChange(blink::WebFrame* frame) {
590 Dispatch(frame, kDispatchKeyCaptureChangeScript); 576 Dispatch(frame, kDispatchKeyCaptureChangeScript);
591 } 577 }
592 578
593 // static 579 // static
594 void SearchBoxExtension::DispatchMarginChange(blink::WebFrame* frame) {
595 Dispatch(frame, kDispatchMarginChangeEventScript);
596 }
597
598 // static
599 void SearchBoxExtension::DispatchMostVisitedChanged( 580 void SearchBoxExtension::DispatchMostVisitedChanged(
600 blink::WebFrame* frame) { 581 blink::WebFrame* frame) {
601 Dispatch(frame, kDispatchMostVisitedChangedScript); 582 Dispatch(frame, kDispatchMostVisitedChangedScript);
602 } 583 }
603 584
604 // static 585 // static
605 void SearchBoxExtension::DispatchSubmit(blink::WebFrame* frame) { 586 void SearchBoxExtension::DispatchSubmit(blink::WebFrame* frame) {
606 Dispatch(frame, kDispatchSubmitEventScript); 587 Dispatch(frame, kDispatchSubmitEventScript);
607 } 588 }
608 589
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItems"))) 623 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItems")))
643 return v8::FunctionTemplate::New(isolate, GetMostVisitedItems); 624 return v8::FunctionTemplate::New(isolate, GetMostVisitedItems);
644 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItemData"))) 625 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItemData")))
645 return v8::FunctionTemplate::New(isolate, GetMostVisitedItemData); 626 return v8::FunctionTemplate::New(isolate, GetMostVisitedItemData);
646 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetQuery"))) 627 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetQuery")))
647 return v8::FunctionTemplate::New(isolate, GetQuery); 628 return v8::FunctionTemplate::New(isolate, GetQuery);
648 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetRightToLeft"))) 629 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetRightToLeft")))
649 return v8::FunctionTemplate::New(isolate, GetRightToLeft); 630 return v8::FunctionTemplate::New(isolate, GetRightToLeft);
650 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetSearchRequestParams"))) 631 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetSearchRequestParams")))
651 return v8::FunctionTemplate::New(isolate, GetSearchRequestParams); 632 return v8::FunctionTemplate::New(isolate, GetSearchRequestParams);
652 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetStartMargin")))
653 return v8::FunctionTemplate::New(isolate, GetStartMargin);
654 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetSuggestionToPrefetch"))) 633 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetSuggestionToPrefetch")))
655 return v8::FunctionTemplate::New(isolate, GetSuggestionToPrefetch); 634 return v8::FunctionTemplate::New(isolate, GetSuggestionToPrefetch);
656 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetThemeBackgroundInfo"))) 635 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetThemeBackgroundInfo")))
657 return v8::FunctionTemplate::New(isolate, GetThemeBackgroundInfo); 636 return v8::FunctionTemplate::New(isolate, GetThemeBackgroundInfo);
658 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsFocused"))) 637 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsFocused")))
659 return v8::FunctionTemplate::New(isolate, IsFocused); 638 return v8::FunctionTemplate::New(isolate, IsFocused);
660 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsInputInProgress"))) 639 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsInputInProgress")))
661 return v8::FunctionTemplate::New(isolate, IsInputInProgress); 640 return v8::FunctionTemplate::New(isolate, IsInputInProgress);
662 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsKeyCaptureEnabled"))) 641 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsKeyCaptureEnabled")))
663 return v8::FunctionTemplate::New(isolate, IsKeyCaptureEnabled); 642 return v8::FunctionTemplate::New(isolate, IsKeyCaptureEnabled);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 UTF16ToV8String(isolate, params.input_encoding)); 866 UTF16ToV8String(isolate, params.input_encoding));
888 } 867 }
889 if (!params.assisted_query_stats.empty()) { 868 if (!params.assisted_query_stats.empty()) {
890 data->Set(v8::String::NewFromUtf8(isolate, kAssistedQueryStatsKey), 869 data->Set(v8::String::NewFromUtf8(isolate, kAssistedQueryStatsKey),
891 UTF16ToV8String(isolate, params.assisted_query_stats)); 870 UTF16ToV8String(isolate, params.assisted_query_stats));
892 } 871 }
893 args.GetReturnValue().Set(data); 872 args.GetReturnValue().Set(data);
894 } 873 }
895 874
896 // static 875 // static
897 void SearchBoxExtensionWrapper::GetStartMargin(
898 const v8::FunctionCallbackInfo<v8::Value>& args) {
899 content::RenderView* render_view = GetRenderView();
900 if (!render_view) return;
901 args.GetReturnValue().Set(static_cast<int32_t>(
902 SearchBox::Get(render_view)->start_margin()));
903 }
904
905 // static
906 void SearchBoxExtensionWrapper::GetSuggestionToPrefetch( 876 void SearchBoxExtensionWrapper::GetSuggestionToPrefetch(
907 const v8::FunctionCallbackInfo<v8::Value>& args) { 877 const v8::FunctionCallbackInfo<v8::Value>& args) {
908 content::RenderView* render_view = GetRenderView(); 878 content::RenderView* render_view = GetRenderView();
909 if (!render_view) return; 879 if (!render_view) return;
910 880
911 const InstantSuggestion& suggestion = 881 const InstantSuggestion& suggestion =
912 SearchBox::Get(render_view)->suggestion(); 882 SearchBox::Get(render_view)->suggestion();
913 v8::Isolate* isolate = args.GetIsolate(); 883 v8::Isolate* isolate = args.GetIsolate();
914 v8::Local<v8::Object> data = v8::Object::New(isolate); 884 v8::Local<v8::Object> data = v8::Object::New(isolate);
915 data->Set(v8::String::NewFromUtf8(isolate, "text"), 885 data->Set(v8::String::NewFromUtf8(isolate, "text"),
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 if (!render_view) return; 1244 if (!render_view) return;
1275 1245
1276 bool display_instant_results = 1246 bool display_instant_results =
1277 SearchBox::Get(render_view)->display_instant_results(); 1247 SearchBox::Get(render_view)->display_instant_results();
1278 DVLOG(1) << render_view << " GetDisplayInstantResults" << 1248 DVLOG(1) << render_view << " GetDisplayInstantResults" <<
1279 display_instant_results; 1249 display_instant_results;
1280 args.GetReturnValue().Set(display_instant_results); 1250 args.GetReturnValue().Set(display_instant_results);
1281 } 1251 }
1282 1252
1283 } // namespace extensions_v8 1253 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox_extension.h ('k') | chrome/test/data/diagnostics/user/Default/Preferences » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698