| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "android_webview/native/aw_web_contents_view_delegate.h" | |
| 6 | |
| 7 #include "content/public/browser/android/content_view_core.h" | |
| 8 #include "content/public/browser/web_contents.h" | |
| 9 #include "content/public/common/context_menu_params.h" | |
| 10 | |
| 11 namespace android_webview { | |
| 12 | |
| 13 // static | |
| 14 content::WebContentsViewDelegate* AwWebContentsViewDelegate::Create( | |
| 15 content::WebContents* web_contents) { | |
| 16 return new AwWebContentsViewDelegate(web_contents); | |
| 17 } | |
| 18 | |
| 19 AwWebContentsViewDelegate::AwWebContentsViewDelegate( | |
| 20 content::WebContents* web_contents) | |
| 21 : web_contents_(web_contents) { | |
| 22 // Cannot instantiate web_contents_view_delegate_ here because | |
| 23 // AwContents::SetWebDelegate is not called yet. | |
| 24 } | |
| 25 | |
| 26 AwWebContentsViewDelegate::~AwWebContentsViewDelegate() {} | |
| 27 | |
| 28 content::WebDragDestDelegate* AwWebContentsViewDelegate::GetDragDestDelegate() { | |
| 29 // GetDragDestDelegate is a pure virtual method from WebContentsViewDelegate | |
| 30 // and must have an implementation although android doesn't use it. | |
| 31 NOTREACHED(); | |
| 32 return NULL; | |
| 33 } | |
| 34 | |
| 35 void AwWebContentsViewDelegate::ShowContextMenu( | |
| 36 content::RenderFrameHost* render_frame_host, | |
| 37 const content::ContextMenuParams& params) { | |
| 38 content::ContentViewCore* content_view_core = | |
| 39 content::ContentViewCore::FromWebContents(web_contents_); | |
| 40 if (content_view_core) | |
| 41 content_view_core->ShowPastePopup(params); | |
| 42 } | |
| 43 | |
| 44 } // namespace android_webview | |
| OLD | NEW |