WebContextMenuClient.cpp [plain text]
#include "WebContextMenuClient.h"
#include "UserGestureIndicator.h"
#include "WebElementPropertyBag.h"
#include "WebLocalizableStrings.h"
#include "WebView.h"
#include <WebCore/ContextMenu.h>
#include <WebCore/ContextMenuController.h>
#include <WebCore/Editor.h>
#include <WebCore/Event.h>
#include <WebCore/FrameLoadRequest.h>
#include <WebCore/FrameLoader.h>
#include <WebCore/MainFrame.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/Page.h>
#include <WebCore/ResourceRequest.h>
using namespace WebCore;
WebContextMenuClient::WebContextMenuClient(WebView* webView)
: m_webView(webView)
{
}
void WebContextMenuClient::contextMenuDestroyed()
{
delete this;
}
void WebContextMenuClient::downloadURL(const URL& url)
{
m_webView->downloadURL(url);
}
void WebContextMenuClient::searchWithGoogle(const Frame* frame)
{
String searchString = frame->editor().selectedText();
searchString.stripWhiteSpace();
String encoded = encodeWithURLEscapeSequences(searchString);
encoded.replace("%20", "+");
String url("http://www.google.com/search?q=");
url.append(encoded);
url.append("&ie=UTF-8&oe=UTF-8");
if (Page* page = frame->page()) {
UserGestureIndicator indicator(ProcessingUserGesture);
page->mainFrame().loader().urlSelected(URL(ParsedURLString, url), String(), 0, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
}
}
void WebContextMenuClient::lookUpInDictionary(Frame*)
{
notImplemented();
}
void WebContextMenuClient::speak(const String&)
{
notImplemented();
}
void WebContextMenuClient::stopSpeaking()
{
notImplemented();
}
bool WebContextMenuClient::isSpeaking()
{
notImplemented();
return false;
}
ContextMenuItem WebContextMenuClient::shareMenuItem(const HitTestResult&)
{
notImplemented();
return ContextMenuItem();
}