This source file includes following definitions.
- Create
- GetDragDestDelegate
- ShowContextMenu
#include "android_webview/native/aw_web_contents_view_delegate.h"
#include "content/public/browser/android/content_view_core.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/context_menu_params.h"
namespace android_webview {
content::WebContentsViewDelegate* AwWebContentsViewDelegate::Create(
content::WebContents* web_contents) {
return new AwWebContentsViewDelegate(web_contents);
}
AwWebContentsViewDelegate::AwWebContentsViewDelegate(
content::WebContents* web_contents)
: web_contents_(web_contents) {
}
AwWebContentsViewDelegate::~AwWebContentsViewDelegate() {}
content::WebDragDestDelegate* AwWebContentsViewDelegate::GetDragDestDelegate() {
NOTREACHED();
return NULL;
}
void AwWebContentsViewDelegate::ShowContextMenu(
content::RenderFrameHost* render_frame_host,
const content::ContextMenuParams& params) {
if (params.is_editable && params.selection_text.empty()) {
content::ContentViewCore* content_view_core =
content::ContentViewCore::FromWebContents(web_contents_);
if (content_view_core) {
content_view_core->ShowPastePopup(params.selection_start.x(),
params.selection_start.y());
}
}
}
}