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

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

Issue 11466007: Add new IPC for searchbox to pipe SearchBox NavigateContentWindow calls to the browser. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove extra ; Created 8 years 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') | content/common/content_param_traits_macros.h » ('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_extension.h" 5 #include "chrome/renderer/searchbox/searchbox_extension.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 #include "chrome/renderer/searchbox/searchbox.h" 10 #include "chrome/renderer/searchbox/searchbox.h"
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 ui::ResourceBundle::MediumFont).GetFontSize()); 626 ui::ResourceBundle::MediumFont).GetFontSize());
627 } 627 }
628 628
629 // static 629 // static
630 v8::Handle<v8::Value> SearchBoxExtensionWrapper::NavigateContentWindow( 630 v8::Handle<v8::Value> SearchBoxExtensionWrapper::NavigateContentWindow(
631 const v8::Arguments& args) { 631 const v8::Arguments& args) {
632 content::RenderView* render_view = GetRenderView(); 632 content::RenderView* render_view = GetRenderView();
633 if (!render_view || !args.Length()) return v8::Undefined(); 633 if (!render_view || !args.Length()) return v8::Undefined();
634 634
635 GURL destination_url; 635 GURL destination_url;
636 content::PageTransition transition = content::PAGE_TRANSITION_TYPED;
636 if (args[0]->IsNumber()) { 637 if (args[0]->IsNumber()) {
637 const InstantAutocompleteResult* result = SearchBox::Get(render_view)-> 638 const InstantAutocompleteResult* result = SearchBox::Get(render_view)->
638 GetAutocompleteResultWithId(args[0]->Uint32Value()); 639 GetAutocompleteResultWithId(args[0]->Uint32Value());
639 if (result) 640 if (result) {
640 destination_url = GURL(result->destination_url); 641 destination_url = GURL(result->destination_url);
642 transition = result->transition;
643 }
641 } else { 644 } else {
642 destination_url = GURL(V8ValueToUTF16(args[0])); 645 destination_url = GURL(V8ValueToUTF16(args[0]));
643 } 646 }
644 647
645 // Navigate the main frame. 648 // Navigate the main frame.
646 if (destination_url.is_valid()) { 649 if (destination_url.is_valid())
647 WebKit::WebURLRequest request(destination_url); 650 SearchBox::Get(render_view)->NavigateToURL(destination_url, transition);
648 render_view->GetWebView()->mainFrame()->loadRequest(request);
649 }
650 651
651 return v8::Undefined(); 652 return v8::Undefined();
652 } 653 }
653 654
654 // static 655 // static
655 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions( 656 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions(
656 const v8::Arguments& args) { 657 const v8::Arguments& args) {
657 content::RenderView* render_view = GetRenderView(); 658 content::RenderView* render_view = GetRenderView();
658 if (!render_view || !args.Length()) return v8::Undefined(); 659 if (!render_view || !args.Length()) return v8::Undefined();
659 660
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript); 901 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript);
901 } 902 }
902 903
903 // static 904 // static
904 v8::Extension* SearchBoxExtension::Get() { 905 v8::Extension* SearchBoxExtension::Get() {
905 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). 906 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance().
906 GetRawDataResource(IDR_SEARCHBOX_API)); 907 GetRawDataResource(IDR_SEARCHBOX_API));
907 } 908 }
908 909
909 } // namespace extensions_v8 910 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | content/common/content_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698