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

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: 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
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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 if (args[0]->IsNumber()) { 576 if (args[0]->IsNumber()) {
577 const InstantAutocompleteResult* result = SearchBox::Get(render_view)-> 577 const InstantAutocompleteResult* result = SearchBox::Get(render_view)->
578 GetAutocompleteResultWithId(args[0]->Uint32Value()); 578 GetAutocompleteResultWithId(args[0]->Uint32Value());
579 if (result) 579 if (result)
580 destination_url = GURL(result->destination_url); 580 destination_url = GURL(result->destination_url);
581 } else { 581 } else {
582 destination_url = GURL(V8ValueToUTF16(args[0])); 582 destination_url = GURL(V8ValueToUTF16(args[0]));
583 } 583 }
584 584
585 // Navigate the main frame. 585 // Navigate the main frame.
586 if (destination_url.is_valid()) { 586 if (destination_url.is_valid())
587 WebKit::WebURLRequest request(destination_url); 587 SearchBox::Get(render_view)->NavigateToURL(destination_url);
588 render_view->GetWebView()->mainFrame()->loadRequest(request);
589 }
590 588
591 return v8::Undefined(); 589 return v8::Undefined();
592 } 590 }
593 591
594 // static 592 // static
595 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions( 593 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions(
596 const v8::Arguments& args) { 594 const v8::Arguments& args) {
597 content::RenderView* render_view = GetRenderView(); 595 content::RenderView* render_view = GetRenderView();
598 if (!render_view || !args.Length()) return v8::Undefined(); 596 if (!render_view || !args.Length()) return v8::Undefined();
599 597
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript); 827 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript);
830 } 828 }
831 829
832 // static 830 // static
833 v8::Extension* SearchBoxExtension::Get() { 831 v8::Extension* SearchBoxExtension::Get() {
834 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). 832 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance().
835 GetRawDataResource(IDR_SEARCHBOX_API)); 833 GetRawDataResource(IDR_SEARCHBOX_API));
836 } 834 }
837 835
838 } // namespace extensions_v8 836 } // namespace extensions_v8
OLDNEW
« chrome/renderer/searchbox/searchbox.h ('K') | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698