Add a stupidly simple "search Google from the URL bar" feature, a la Chrome.
It still needs a lot but this doesn't seem to break anything and it already is making my browsing more productive. The hard-coding of Google will be fixed when some proper search engine provider handling is added. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@557 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
parent
530dea0f16
commit
1526be737a
@ -618,7 +618,10 @@ BrowserWindow::MessageReceived(BMessage* message)
|
||||
if (message->FindString("url", &url) != B_OK)
|
||||
url = fURLInputGroup->Text();
|
||||
_SetPageIcon(CurrentWebView(), NULL);
|
||||
CurrentWebView()->LoadURL(url.String());
|
||||
BString newUrl = _SmartURLHandler(url);
|
||||
if (newUrl != url)
|
||||
fURLInputGroup->TextView()->SetText(newUrl);
|
||||
CurrentWebView()->LoadURL(newUrl.String());
|
||||
break;
|
||||
}
|
||||
case GO_BACK:
|
||||
@ -2090,6 +2093,16 @@ BrowserWindow::_NewTabURL(bool isNewWindow) const
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
BrowserWindow::_SmartURLHandler(const BString& url) const
|
||||
{
|
||||
BString result = url;
|
||||
if (url.FindFirst(".") == B_ERROR || url.FindFirst(" ") != B_ERROR)
|
||||
result.Prepend("http://www.google.com/#q=");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BrowserWindow::_HandlePageSourceResult(const BMessage* message)
|
||||
{
|
||||
|
@ -191,6 +191,7 @@ private:
|
||||
void _InvokeButtonVisibly(BButton* button);
|
||||
|
||||
BString _NewTabURL(bool isNewWindow) const;
|
||||
BString _SmartURLHandler(const BString& url) const;
|
||||
|
||||
void _HandlePageSourceResult(
|
||||
const BMessage* message);
|
||||
|
Loading…
Reference in New Issue
Block a user