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

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, 9 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
« 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 "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 "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/renderer/searchbox/searchbox.h" 12 #include "chrome/renderer/searchbox/searchbox.h"
13 #include "content/public/renderer/render_view.h" 13 #include "content/public/renderer/render_view.h"
14 #include "grit/renderer_resources.h" 14 #include "grit/renderer_resources.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
19 #include "ui/base/keycodes/keyboard_codes.h" 19 #include "ui/base/keycodes/keyboard_codes.h"
20 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/base/window_open_disposition.h"
21 #include "v8/include/v8.h" 22 #include "v8/include/v8.h"
22 23
23 namespace { 24 namespace {
24 25
25 const char kCSSBackgroundImageFormat[] = 26 const char kCSSBackgroundImageFormat[] =
26 "-webkit-image-set(url(chrome://theme/IDR_THEME_BACKGROUND?%s) 1x)"; 27 "-webkit-image-set(url(chrome://theme/IDR_THEME_BACKGROUND?%s) 1x)";
27 28
28 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)"; 29 const char kCSSBackgroundColorFormat[] = "rgba(%d,%d,%d,%s)";
29 30
30 const char kCSSBackgroundPositionCenter[] = "center"; 31 const char kCSSBackgroundPositionCenter[] = "center";
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 GetAutocompleteResultWithId(args[0]->Uint32Value()); 701 GetAutocompleteResultWithId(args[0]->Uint32Value());
701 if (result) { 702 if (result) {
702 destination_url = GURL(result->destination_url); 703 destination_url = GURL(result->destination_url);
703 transition = result->transition; 704 transition = result->transition;
704 } 705 }
705 } else { 706 } else {
706 destination_url = GURL(V8ValueToUTF16(args[0])); 707 destination_url = GURL(V8ValueToUTF16(args[0]));
707 } 708 }
708 709
709 // Navigate the main frame. 710 // Navigate the main frame.
710 if (destination_url.is_valid()) 711 if (destination_url.is_valid()) {
711 SearchBox::Get(render_view)->NavigateToURL(destination_url, transition); 712 WindowOpenDisposition disposition = CURRENT_TAB;
712 713 if (args[1]->Uint32Value() == 2)
714 disposition = NEW_BACKGROUND_TAB;
715 SearchBox::Get(render_view)->NavigateToURL(
716 destination_url, transition, disposition);
717 }
713 return v8::Undefined(); 718 return v8::Undefined();
714 } 719 }
715 720
716 // static 721 // static
717 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions( 722 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions(
718 const v8::Arguments& args) { 723 const v8::Arguments& args) {
719 content::RenderView* render_view = GetRenderView(); 724 content::RenderView* render_view = GetRenderView();
720 if (!render_view || !args.Length()) return v8::Undefined(); 725 if (!render_view || !args.Length()) return v8::Undefined();
721 726
722 DVLOG(1) << render_view << " SetSuggestions"; 727 DVLOG(1) << render_view << " SetSuggestions";
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 void SearchBoxExtension::DispatchThemeChange(WebKit::WebFrame* frame) { 1041 void SearchBoxExtension::DispatchThemeChange(WebKit::WebFrame* frame) {
1037 Dispatch(frame, kDispatchThemeChangeEventScript); 1042 Dispatch(frame, kDispatchThemeChangeEventScript);
1038 } 1043 }
1039 1044
1040 // static 1045 // static
1041 void SearchBoxExtension::DispatchMostVisitedChanged( 1046 void SearchBoxExtension::DispatchMostVisitedChanged(
1042 WebKit::WebFrame* frame) { 1047 WebKit::WebFrame* frame) {
1043 Dispatch(frame, kDispatchMostVisitedChangedScript); 1048 Dispatch(frame, kDispatchMostVisitedChangedScript);
1044 } 1049 }
1045 } // namespace extensions_v8 1050 } // 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