Index: chrome/browser/ui/android/tab_contents/chrome_web_contents_view_delegate_android.cc |
diff --git a/chrome/browser/ui/android/tab_contents/chrome_web_contents_view_delegate_android.cc b/chrome/browser/ui/android/tab_contents/chrome_web_contents_view_delegate_android.cc |
index c69250071ce34ca58893ad4a2d3165216717ac9d..41f25889b83cd974d7a249f6971a223fb1dc7229 100644 |
--- a/chrome/browser/ui/android/tab_contents/chrome_web_contents_view_delegate_android.cc |
+++ b/chrome/browser/ui/android/tab_contents/chrome_web_contents_view_delegate_android.cc |
@@ -2,20 +2,53 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "chrome/browser/ui/android/tab_contents/chrome_web_contents_view_delegate_android.h" |
+ |
#include "base/logging.h" |
+#include "chrome/browser/android/tab_android.h" |
#include "content/public/browser/web_contents_view_delegate.h" |
+#include "content/public/common/context_menu_params.h" |
namespace content { |
-class WebContents; |
+ class ContextMenuParams; |
Lei Zhang
2012/07/18 18:07:43
nit: no space in front of "class"
felipeg
2012/07/19 10:15:36
Done.
|
} // namespace content |
+ChromeWebContentsViewDelegateAndroid::ChromeWebContentsViewDelegateAndroid( |
+ content::WebContents* web_contents) |
+ : web_contents_(web_contents) { |
+} |
+ |
+ChromeWebContentsViewDelegateAndroid::~ChromeWebContentsViewDelegateAndroid() { |
+} |
+ |
+content::WebDragDestDelegate* |
+ChromeWebContentsViewDelegateAndroid::GetDragDestDelegate() { |
+ // GetDragDestDelegate is a pure virtual method from WebContentsViewDelegate |
+ // and must have an implementation although android doesn't use it. |
+ NOTREACHED(); |
+ return NULL; |
+} |
+ |
+void ChromeWebContentsViewDelegateAndroid::ShowContextMenu( |
+ const content::ContextMenuParams& params) { |
+ // http://crbug.com/136075 |
+ NOTIMPLEMENTED(); |
+ // Still lacking some code here that depends on |
+ // content/public/browser/android/content_view_core.h |
+ |
+ TabAndroid* tab = TabAndroid::FromWebContents(web_contents_); |
+ // We may not have a Tab if we're running in Android WebView mode. |
+ // TODO: The long term plan is to factor out the context menu code into |
+ // a shared class and have WebView use a separate delegate. |
+ if (tab) |
+ tab->ShowContextMenu(params); |
+} |
+ |
namespace chrome { |
content::WebContentsViewDelegate* CreateWebContentsViewDelegate( |
content::WebContents* web_contents) { |
- // http://crbug.com/136075 |
- NOTIMPLEMENTED(); |
- return NULL; |
+ return new ChromeWebContentsViewDelegateAndroid(web_contents); |
} |
} // namespace chrome |