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

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 7 years, 10 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 | 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/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.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/Platform/chromium/public/WebURLRequest.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.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 "ui/base/window_open_disposition.h"
samarth 2013/02/20 23:55:16 nit: sort please
dougw 2013/02/21 00:49:00 Done.
21 22
22 namespace { 23 namespace {
23 24
24 const char kCSSBackgroundImageFormat[] = 25 const char kCSSBackgroundImageFormat[] =
25 "-webkit-image-set(url(chrome://theme/IDR_THEME_BACKGROUND?%s) 1x)"; 26 "-webkit-image-set(url(chrome://theme/IDR_THEME_BACKGROUND?%s) 1x)";
26 27
27 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)"; 28 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)";
28 29
29 const char kCSSBackgroundPositionCenter[] = "center"; 30 const char kCSSBackgroundPositionCenter[] = "center";
30 const char kCSSBackgroundPositionLeft[] = "left"; 31 const char kCSSBackgroundPositionLeft[] = "left";
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 GetAutocompleteResultWithId(args[0]->Uint32Value()); 669 GetAutocompleteResultWithId(args[0]->Uint32Value());
669 if (result) { 670 if (result) {
670 destination_url = GURL(result->destination_url); 671 destination_url = GURL(result->destination_url);
671 transition = result->transition; 672 transition = result->transition;
672 } 673 }
673 } else { 674 } else {
674 destination_url = GURL(V8ValueToUTF16(args[0])); 675 destination_url = GURL(V8ValueToUTF16(args[0]));
675 } 676 }
676 677
677 // Navigate the main frame. 678 // Navigate the main frame.
678 if (destination_url.is_valid()) 679 if (destination_url.is_valid()) {
679 SearchBox::Get(render_view)->NavigateToURL(destination_url, transition); 680 WindowOpenDisposition disposition = CURRENT_TAB;
680 681 if (args[1]->Uint32Value() == 2)
682 disposition = NEW_BACKGROUND_TAB;
683 SearchBox::Get(render_view)->NavigateToURL(
684 destination_url, transition, disposition);
685 }
681 return v8::Undefined(); 686 return v8::Undefined();
682 } 687 }
683 688
684 // static 689 // static
685 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions( 690 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions(
686 const v8::Arguments& args) { 691 const v8::Arguments& args) {
687 content::RenderView* render_view = GetRenderView(); 692 content::RenderView* render_view = GetRenderView();
688 if (!render_view || !args.Length()) return v8::Undefined(); 693 if (!render_view || !args.Length()) return v8::Undefined();
689 694
690 DVLOG(1) << render_view << " SetSuggestions"; 695 DVLOG(1) << render_view << " SetSuggestions";
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 void SearchBoxExtension::DispatchMarginChange(WebKit::WebFrame* frame) { 935 void SearchBoxExtension::DispatchMarginChange(WebKit::WebFrame* frame) {
931 Dispatch(frame, kDispatchMarginChangeEventScript); 936 Dispatch(frame, kDispatchMarginChangeEventScript);
932 } 937 }
933 938
934 // static 939 // static
935 void SearchBoxExtension::DispatchThemeChange(WebKit::WebFrame* frame) { 940 void SearchBoxExtension::DispatchThemeChange(WebKit::WebFrame* frame) {
936 Dispatch(frame, kDispatchThemeChangeEventScript); 941 Dispatch(frame, kDispatchThemeChangeEventScript);
937 } 942 }
938 943
939 } // namespace extensions_v8 944 } // namespace extensions_v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698