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

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, 11 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/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/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 "webkit/glue/window_open_disposition.h"
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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 GetAutocompleteResultWithId(args[0]->Uint32Value()); 692 GetAutocompleteResultWithId(args[0]->Uint32Value());
692 if (result) { 693 if (result) {
693 destination_url = GURL(result->destination_url); 694 destination_url = GURL(result->destination_url);
694 transition = result->transition; 695 transition = result->transition;
695 } 696 }
696 } else { 697 } else {
697 destination_url = GURL(V8ValueToUTF16(args[0])); 698 destination_url = GURL(V8ValueToUTF16(args[0]));
698 } 699 }
699 700
700 // Navigate the main frame. 701 // Navigate the main frame.
701 if (destination_url.is_valid()) 702 if (destination_url.is_valid()) {
702 SearchBox::Get(render_view)->NavigateToURL(destination_url, transition); 703 WindowOpenDisposition disposition = CURRENT_TAB;
703 704 if ((args[1]->IsUint32()) && (args[1]->Uint32Value() == 2))
sreeram 2013/01/22 06:01:19 You don't need the first clause. Just this: if
dougw 2013/01/24 03:05:25 Done.
705 disposition = NEW_BACKGROUND_TAB;
706 SearchBox::Get(render_view)->NavigateToURL(
707 destination_url, transition, disposition);
708 }
704 return v8::Undefined(); 709 return v8::Undefined();
705 } 710 }
706 711
707 // static 712 // static
708 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions( 713 v8::Handle<v8::Value> SearchBoxExtensionWrapper::SetSuggestions(
709 const v8::Arguments& args) { 714 const v8::Arguments& args) {
710 content::RenderView* render_view = GetRenderView(); 715 content::RenderView* render_view = GetRenderView();
711 if (!render_view || !args.Length()) return v8::Undefined(); 716 if (!render_view || !args.Length()) return v8::Undefined();
712 717
713 DVLOG(1) << render_view << " SetSuggestions"; 718 DVLOG(1) << render_view << " SetSuggestions";
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript); 963 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript);
959 } 964 }
960 965
961 // static 966 // static
962 v8::Extension* SearchBoxExtension::Get() { 967 v8::Extension* SearchBoxExtension::Get() {
963 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). 968 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance().
964 GetRawDataResource(IDR_SEARCHBOX_API)); 969 GetRawDataResource(IDR_SEARCHBOX_API));
965 } 970 }
966 971
967 } // namespace extensions_v8 972 } // namespace extensions_v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698