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

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

Issue 11644009: Added support for passing WindowOpenDisposition into BrowserInstantController::OpenURL() from the o… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
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/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/renderer/searchbox/searchbox.h" 11 #include "chrome/renderer/searchbox/searchbox.h"
12 #include "content/public/renderer/render_view.h" 12 #include "content/public/renderer/render_view.h"
13 #include "grit/renderer_resources.h" 13 #include "grit/renderer_resources.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h"
18 #include "ui/base/keycodes/keyboard_codes.h" 18 #include "ui/base/keycodes/keyboard_codes.h"
19 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
20 #include "v8/include/v8.h" 20 #include "v8/include/v8.h"
21 #include "webkit/glue/window_open_disposition.h"
22
21 23
22 namespace { 24 namespace {
23 25
24 const char kCSSBackgroundImageFormat[] = 26 const char kCSSBackgroundImageFormat[] =
25 "-webkit-image-set(url(chrome://theme/IDR_THEME_BACKGROUND?%s) 1x)"; 27 "-webkit-image-set(url(chrome://theme/IDR_THEME_BACKGROUND?%s) 1x)";
26 28
27 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)"; 29 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)";
28 30
29 const char kCSSBackgroundPositionCenter[] = "center"; 31 const char kCSSBackgroundPositionCenter[] = "center";
30 const char kCSSBackgroundPositionLeft[] = "left"; 32 const char kCSSBackgroundPositionLeft[] = "left";
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 GetAutocompleteResultWithId(args[0]->Uint32Value()); 693 GetAutocompleteResultWithId(args[0]->Uint32Value());
692 if (result) { 694 if (result) {
693 destination_url = GURL(result->destination_url); 695 destination_url = GURL(result->destination_url);
694 transition = result->transition; 696 transition = result->transition;
695 } 697 }
696 } else { 698 } else {
697 destination_url = GURL(V8ValueToUTF16(args[0])); 699 destination_url = GURL(V8ValueToUTF16(args[0]));
698 } 700 }
699 701
700 // Navigate the main frame. 702 // Navigate the main frame.
701 if (destination_url.is_valid()) 703 if (destination_url.is_valid()) {
702 SearchBox::Get(render_view)->NavigateToURL(destination_url, transition); 704 if (args[1]->Uint32Value() == NEW_BACKGROUND_TAB) {
samarth 2013/01/10 21:42:04 Is disposition supposed to be optional? Do you ne
samarth 2013/01/10 21:42:04 Don't use NEW_BACKGROUND_TAB here. We don't want t
dougw 2013/01/18 23:54:30 Done.
dougw 2013/01/18 23:54:30 Done.
703 705 SearchBox::Get(render_view)->NavigateToURL(destination_url,
706 transition,
707 NEW_BACKGROUND_TAB);
708 } else {
709 SearchBox::Get(render_view)->NavigateToURL(destination_url,
710 transition,
711 CURRENT_TAB);
712 }
713 }
704 return v8::Undefined(); 714 return v8::Undefined();
705 } 715 }
706 716
707 // static 717 // static
708 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions( 718 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions(
709 const v8::Arguments& args) { 719 const v8::Arguments& args) {
710 content::RenderView* render_view = GetRenderView(); 720 content::RenderView* render_view = GetRenderView();
711 if (!render_view || !args.Length()) return v8::Undefined(); 721 if (!render_view || !args.Length()) return v8::Undefined();
712 722
713 DVLOG(1) << render_view << " SetSuggestions"; 723 DVLOG(1) << render_view << " SetSuggestions";
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript); 968 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript);
959 } 969 }
960 970
961 // static 971 // static
962 v8::Extension* SearchBoxExtension::Get() { 972 v8::Extension* SearchBoxExtension::Get() {
963 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). 973 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance().
964 GetRawDataResource(IDR_SEARCHBOX_API)); 974 GetRawDataResource(IDR_SEARCHBOX_API));
965 } 975 }
966 976
967 } // namespace extensions_v8 977 } // namespace extensions_v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698