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

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

Issue 2413663002: Remove embeddedSearch.searchBox.focus (Closed)
Patch Set: . Created 4 years, 2 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
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | 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_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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 const v8::FunctionCallbackInfo<v8::Value>& args); 411 const v8::FunctionCallbackInfo<v8::Value>& args);
412 412
413 // Checks whether the user sync his history. 413 // Checks whether the user sync his history.
414 static void CheckIsUserSyncingHistory( 414 static void CheckIsUserSyncingHistory(
415 const v8::FunctionCallbackInfo<v8::Value>& args); 415 const v8::FunctionCallbackInfo<v8::Value>& args);
416 416
417 // Deletes a Most Visited item. 417 // Deletes a Most Visited item.
418 static void DeleteMostVisitedItem( 418 static void DeleteMostVisitedItem(
419 const v8::FunctionCallbackInfo<v8::Value>& args); 419 const v8::FunctionCallbackInfo<v8::Value>& args);
420 420
421 // Focuses the omnibox.
422 static void Focus(const v8::FunctionCallbackInfo<v8::Value>& args);
423
424 // Gets Most Visited Items. 421 // Gets Most Visited Items.
425 static void GetMostVisitedItems( 422 static void GetMostVisitedItems(
426 const v8::FunctionCallbackInfo<v8::Value>& args); 423 const v8::FunctionCallbackInfo<v8::Value>& args);
427 424
428 // Gets the raw data for a most visited item including its raw URL. 425 // Gets the raw data for a most visited item including its raw URL.
429 // GetRenderViewWithCheckedOrigin() enforces that only code in the origin 426 // GetRenderViewWithCheckedOrigin() enforces that only code in the origin
430 // chrome-search://most-visited can call this function. 427 // chrome-search://most-visited can call this function.
431 static void GetMostVisitedItemData( 428 static void GetMostVisitedItemData(
432 const v8::FunctionCallbackInfo<v8::Value>& args); 429 const v8::FunctionCallbackInfo<v8::Value>& args);
433 430
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 v8::Isolate* isolate, 581 v8::Isolate* isolate,
585 v8::Local<v8::String> name) { 582 v8::Local<v8::String> name) {
586 if (name->Equals( 583 if (name->Equals(
587 v8::String::NewFromUtf8(isolate, "CheckIsUserSignedInToChromeAs"))) 584 v8::String::NewFromUtf8(isolate, "CheckIsUserSignedInToChromeAs")))
588 return v8::FunctionTemplate::New(isolate, CheckIsUserSignedInToChromeAs); 585 return v8::FunctionTemplate::New(isolate, CheckIsUserSignedInToChromeAs);
589 if (name->Equals( 586 if (name->Equals(
590 v8::String::NewFromUtf8(isolate, "CheckIsUserSyncingHistory"))) 587 v8::String::NewFromUtf8(isolate, "CheckIsUserSyncingHistory")))
591 return v8::FunctionTemplate::New(isolate, CheckIsUserSyncingHistory); 588 return v8::FunctionTemplate::New(isolate, CheckIsUserSyncingHistory);
592 if (name->Equals(v8::String::NewFromUtf8(isolate, "DeleteMostVisitedItem"))) 589 if (name->Equals(v8::String::NewFromUtf8(isolate, "DeleteMostVisitedItem")))
593 return v8::FunctionTemplate::New(isolate, DeleteMostVisitedItem); 590 return v8::FunctionTemplate::New(isolate, DeleteMostVisitedItem);
594 if (name->Equals(v8::String::NewFromUtf8(isolate, "Focus")))
595 return v8::FunctionTemplate::New(isolate, Focus);
596 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItems"))) 591 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItems")))
597 return v8::FunctionTemplate::New(isolate, GetMostVisitedItems); 592 return v8::FunctionTemplate::New(isolate, GetMostVisitedItems);
598 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItemData"))) 593 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetMostVisitedItemData")))
599 return v8::FunctionTemplate::New(isolate, GetMostVisitedItemData); 594 return v8::FunctionTemplate::New(isolate, GetMostVisitedItemData);
600 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetQuery"))) 595 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetQuery")))
601 return v8::FunctionTemplate::New(isolate, GetQuery); 596 return v8::FunctionTemplate::New(isolate, GetQuery);
602 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetRightToLeft"))) 597 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetRightToLeft")))
603 return v8::FunctionTemplate::New(isolate, GetRightToLeft); 598 return v8::FunctionTemplate::New(isolate, GetRightToLeft);
604 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetSearchRequestParams"))) 599 if (name->Equals(v8::String::NewFromUtf8(isolate, "GetSearchRequestParams")))
605 return v8::FunctionTemplate::New(isolate, GetSearchRequestParams); 600 return v8::FunctionTemplate::New(isolate, GetSearchRequestParams);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 return; 683 return;
689 } 684 }
690 685
691 DVLOG(1) << render_view 686 DVLOG(1) << render_view
692 << " DeleteMostVisitedItem: " << args[0]->ToInteger()->Value(); 687 << " DeleteMostVisitedItem: " << args[0]->ToInteger()->Value();
693 SearchBox::Get(render_view)-> 688 SearchBox::Get(render_view)->
694 DeleteMostVisitedItem(args[0]->ToInteger()->Value()); 689 DeleteMostVisitedItem(args[0]->ToInteger()->Value());
695 } 690 }
696 691
697 // static 692 // static
698 void SearchBoxExtensionWrapper::Focus(
699 const v8::FunctionCallbackInfo<v8::Value>& args) {
700 content::RenderView* render_view = GetRenderView();
701 if (!render_view) return;
702
703 DVLOG(1) << render_view << " Focus";
704 SearchBox::Get(render_view)->Focus();
705 }
706
707 // static
708 void SearchBoxExtensionWrapper::GetMostVisitedItems( 693 void SearchBoxExtensionWrapper::GetMostVisitedItems(
709 const v8::FunctionCallbackInfo<v8::Value>& args) { 694 const v8::FunctionCallbackInfo<v8::Value>& args) {
710 content::RenderView* render_view = GetRenderView(); 695 content::RenderView* render_view = GetRenderView();
711 if (!render_view) 696 if (!render_view)
712 return; 697 return;
713 DVLOG(1) << render_view << " GetMostVisitedItems"; 698 DVLOG(1) << render_view << " GetMostVisitedItems";
714 699
715 const SearchBox* search_box = SearchBox::Get(render_view); 700 const SearchBox* search_box = SearchBox::Get(render_view);
716 701
717 std::vector<InstantMostVisitedItemIDPair> instant_mv_items; 702 std::vector<InstantMostVisitedItemIDPair> instant_mv_items;
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 ThrowInvalidParameters(args); 1114 ThrowInvalidParameters(args);
1130 return; 1115 return;
1131 } 1116 }
1132 1117
1133 DVLOG(1) << render_view << " UndoMostVisitedDeletion"; 1118 DVLOG(1) << render_view << " UndoMostVisitedDeletion";
1134 SearchBox::Get(render_view) 1119 SearchBox::Get(render_view)
1135 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value()); 1120 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value());
1136 } 1121 }
1137 1122
1138 } // namespace extensions_v8 1123 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698