Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 // Gets whether the browser is capturing key strokes. | 565 // Gets whether the browser is capturing key strokes. |
| 566 static void IsKeyCaptureEnabled( | 566 static void IsKeyCaptureEnabled( |
| 567 const v8::FunctionCallbackInfo<v8::Value>& args); | 567 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 568 | 568 |
| 569 // Gets the font family of the text in the omnibox. | 569 // Gets the font family of the text in the omnibox. |
| 570 static void GetFont(const v8::FunctionCallbackInfo<v8::Value>& args); | 570 static void GetFont(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 571 | 571 |
| 572 // Gets the font size of the text in the omnibox. | 572 // Gets the font size of the text in the omnibox. |
| 573 static void GetFontSize(const v8::FunctionCallbackInfo<v8::Value>& args); | 573 static void GetFontSize(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 574 | 574 |
| 575 // Gets the font size of the text in the omnibox. | |
|
Jered
2013/06/25 20:34:35
Update comment.
David Black
2013/06/25 21:33:06
Done.
| |
| 576 static void GetAppLauncherEnabled( | |
| 577 const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 578 | |
| 575 // Navigates the window to a URL represented by either a URL string or a | 579 // Navigates the window to a URL represented by either a URL string or a |
| 576 // restricted ID. The two variants handle restricted IDs in their | 580 // restricted ID. The two variants handle restricted IDs in their |
| 577 // respective namespaces. | 581 // respective namespaces. |
| 578 static void NavigateSearchBox( | 582 static void NavigateSearchBox( |
| 579 const v8::FunctionCallbackInfo<v8::Value>& args); | 583 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 580 static void NavigateNewTabPage( | 584 static void NavigateNewTabPage( |
| 581 const v8::FunctionCallbackInfo<v8::Value>& args); | 585 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 582 // DEPRECATED: TODO(sreeram): Remove when google.com no longer uses this. | 586 // DEPRECATED: TODO(sreeram): Remove when google.com no longer uses this. |
| 583 static void NavigateContentWindow( | 587 static void NavigateContentWindow( |
| 584 const v8::FunctionCallbackInfo<v8::Value>& args); | 588 const v8::FunctionCallbackInfo<v8::Value>& args); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 if (name->Equals(v8::String::New("GetDisplayInstantResults"))) | 698 if (name->Equals(v8::String::New("GetDisplayInstantResults"))) |
| 695 return v8::FunctionTemplate::New(GetDisplayInstantResults); | 699 return v8::FunctionTemplate::New(GetDisplayInstantResults); |
| 696 if (name->Equals(v8::String::New("GetThemeBackgroundInfo"))) | 700 if (name->Equals(v8::String::New("GetThemeBackgroundInfo"))) |
| 697 return v8::FunctionTemplate::New(GetThemeBackgroundInfo); | 701 return v8::FunctionTemplate::New(GetThemeBackgroundInfo); |
| 698 if (name->Equals(v8::String::New("IsKeyCaptureEnabled"))) | 702 if (name->Equals(v8::String::New("IsKeyCaptureEnabled"))) |
| 699 return v8::FunctionTemplate::New(IsKeyCaptureEnabled); | 703 return v8::FunctionTemplate::New(IsKeyCaptureEnabled); |
| 700 if (name->Equals(v8::String::New("GetFont"))) | 704 if (name->Equals(v8::String::New("GetFont"))) |
| 701 return v8::FunctionTemplate::New(GetFont); | 705 return v8::FunctionTemplate::New(GetFont); |
| 702 if (name->Equals(v8::String::New("GetFontSize"))) | 706 if (name->Equals(v8::String::New("GetFontSize"))) |
| 703 return v8::FunctionTemplate::New(GetFontSize); | 707 return v8::FunctionTemplate::New(GetFontSize); |
| 708 if (name->Equals(v8::String::New("GetAppLauncherEnabled"))) | |
| 709 return v8::FunctionTemplate::New(GetAppLauncherEnabled); | |
| 704 if (name->Equals(v8::String::New("NavigateSearchBox"))) | 710 if (name->Equals(v8::String::New("NavigateSearchBox"))) |
| 705 return v8::FunctionTemplate::New(NavigateSearchBox); | 711 return v8::FunctionTemplate::New(NavigateSearchBox); |
| 706 if (name->Equals(v8::String::New("NavigateNewTabPage"))) | 712 if (name->Equals(v8::String::New("NavigateNewTabPage"))) |
| 707 return v8::FunctionTemplate::New(NavigateNewTabPage); | 713 return v8::FunctionTemplate::New(NavigateNewTabPage); |
| 708 if (name->Equals(v8::String::New("NavigateContentWindow"))) | 714 if (name->Equals(v8::String::New("NavigateContentWindow"))) |
| 709 return v8::FunctionTemplate::New(NavigateContentWindow); | 715 return v8::FunctionTemplate::New(NavigateContentWindow); |
| 710 if (name->Equals(v8::String::New("SetSuggestions"))) | 716 if (name->Equals(v8::String::New("SetSuggestions"))) |
| 711 return v8::FunctionTemplate::New(SetSuggestions); | 717 return v8::FunctionTemplate::New(SetSuggestions); |
| 712 if (name->Equals(v8::String::New("SetSuggestion"))) | 718 if (name->Equals(v8::String::New("SetSuggestion"))) |
| 713 return v8::FunctionTemplate::New(SetSuggestion); | 719 return v8::FunctionTemplate::New(SetSuggestion); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 void SearchBoxExtensionWrapper::GetFontSize( | 1030 void SearchBoxExtensionWrapper::GetFontSize( |
| 1025 const v8::FunctionCallbackInfo<v8::Value>& args) { | 1031 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 1026 content::RenderView* render_view = GetRenderView(); | 1032 content::RenderView* render_view = GetRenderView(); |
| 1027 if (!render_view) return; | 1033 if (!render_view) return; |
| 1028 | 1034 |
| 1029 args.GetReturnValue().Set(static_cast<uint32_t>( | 1035 args.GetReturnValue().Set(static_cast<uint32_t>( |
| 1030 SearchBox::Get(render_view)->omnibox_font_size())); | 1036 SearchBox::Get(render_view)->omnibox_font_size())); |
| 1031 } | 1037 } |
| 1032 | 1038 |
| 1033 // static | 1039 // static |
| 1040 void SearchBoxExtensionWrapper::GetAppLauncherEnabled( | |
| 1041 const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| 1042 content::RenderView* render_view = GetRenderView(); | |
| 1043 if (!render_view) return; | |
| 1044 | |
| 1045 args.GetReturnValue().Set( | |
| 1046 SearchBox::Get(render_view)->app_launcher_enabled()); | |
| 1047 } | |
| 1048 | |
| 1049 // static | |
| 1034 void SearchBoxExtensionWrapper::NavigateSearchBox( | 1050 void SearchBoxExtensionWrapper::NavigateSearchBox( |
| 1035 const v8::FunctionCallbackInfo<v8::Value>& args) { | 1051 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 1036 content::RenderView* render_view = GetRenderView(); | 1052 content::RenderView* render_view = GetRenderView(); |
| 1037 if (!render_view || !args.Length()) return; | 1053 if (!render_view || !args.Length()) return; |
| 1038 | 1054 |
| 1039 GURL destination_url; | 1055 GURL destination_url; |
| 1040 content::PageTransition transition = content::PAGE_TRANSITION_TYPED; | 1056 content::PageTransition transition = content::PAGE_TRANSITION_TYPED; |
| 1041 bool is_search_type = false; | 1057 bool is_search_type = false; |
| 1042 if (args[0]->IsNumber()) { | 1058 if (args[0]->IsNumber()) { |
| 1043 InstantAutocompleteResult result; | 1059 InstantAutocompleteResult result; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1560 Dispatch(frame, kDispatchInputCancelScript); | 1576 Dispatch(frame, kDispatchInputCancelScript); |
| 1561 } | 1577 } |
| 1562 | 1578 |
| 1563 // static | 1579 // static |
| 1564 void SearchBoxExtension::DispatchToggleVoiceSearch( | 1580 void SearchBoxExtension::DispatchToggleVoiceSearch( |
| 1565 WebKit::WebFrame* frame) { | 1581 WebKit::WebFrame* frame) { |
| 1566 Dispatch(frame, kDispatchToggleVoiceSearchScript); | 1582 Dispatch(frame, kDispatchToggleVoiceSearchScript); |
| 1567 } | 1583 } |
| 1568 | 1584 |
| 1569 } // namespace extensions_v8 | 1585 } // namespace extensions_v8 |
| OLD | NEW |