Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / shell / browser / shell_web_contents_view_delegate_win.cc
index cd387f0..89bfe14 100644 (file)
@@ -5,11 +5,11 @@
 #include "content/shell/browser/shell_web_contents_view_delegate.h"
 
 #include "base/command_line.h"
+#include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/render_widget_host_view.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
 #include "content/public/common/context_menu_params.h"
 #include "content/shell/browser/shell.h"
 #include "content/shell/browser/shell_browser_context.h"
@@ -20,7 +20,7 @@
 #include "content/shell/common/shell_switches.h"
 #include "third_party/WebKit/public/web/WebContextMenuData.h"
 
-using WebKit::WebContextMenuData;
+using blink::WebContextMenuData;
 
 namespace {
 
@@ -38,7 +38,7 @@ enum {
 
 void MakeContextMenuItem(HMENU menu,
                          int menu_index,
-                         LPTSTR text,
+                         LPCTSTR text,
                          UINT id,
                          bool enabled) {
   MENUITEMINFO mii = {0};
@@ -47,7 +47,7 @@ void MakeContextMenuItem(HMENU menu,
   mii.fState = enabled ? MFS_ENABLED : (MF_DISABLED | MFS_GRAYED);
   mii.fType = MFT_STRING;
   mii.wID = id;
-  mii.dwTypeData = text;
+  mii.dwTypeData = const_cast<LPTSTR>(text);
 
   InsertMenuItem(menu, menu_index, TRUE, &mii);
 }
@@ -70,6 +70,7 @@ ShellWebContentsViewDelegate::~ShellWebContentsViewDelegate() {
 }
 
 void ShellWebContentsViewDelegate::ShowContextMenu(
+    RenderFrameHost* render_frame_host,
     const ContextMenuParams& params) {
   if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
     return;
@@ -173,14 +174,14 @@ void ShellWebContentsViewDelegate::ShowContextMenu(
 #else
   gfx::Point screen_point(params.x, params.y);
   POINT point = screen_point.ToPOINT();
-  ClientToScreen(web_contents_->GetView()->GetNativeView(), &point);
+  ClientToScreen(web_contents_->GetNativeView(), &point);
 
   int selection =
       TrackPopupMenu(sub_menu,
                      TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
                      point.x, point.y,
                      0,
-                     web_contents_->GetView()->GetContentNativeView(),
+                     web_contents_->GetContentNativeView(),
                      NULL);
 
   MenuItemSelected(selection);
@@ -191,16 +192,16 @@ void ShellWebContentsViewDelegate::ShowContextMenu(
 void ShellWebContentsViewDelegate::MenuItemSelected(int selection) {
   switch (selection) {
     case ShellContextMenuItemCutId:
-      web_contents_->GetRenderViewHost()->Cut();
+      web_contents_->Cut();
       break;
     case ShellContextMenuItemCopyId:
-      web_contents_->GetRenderViewHost()->Copy();
+      web_contents_->Copy();
       break;
     case ShellContextMenuItemPasteId:
-      web_contents_->GetRenderViewHost()->Paste();
+      web_contents_->Paste();
       break;
     case ShellContextMenuItemDeleteId:
-      web_contents_->GetRenderViewHost()->Delete();
+      web_contents_->Delete();
       break;
     case ShellContextMenuItemOpenLinkId: {
       ShellBrowserContext* browser_context =
@@ -214,15 +215,15 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) {
     }
     case ShellContextMenuItemBackId:
       web_contents_->GetController().GoToOffset(-1);
-      web_contents_->GetView()->Focus();
+      web_contents_->Focus();
       break;
     case ShellContextMenuItemForwardId:
       web_contents_->GetController().GoToOffset(1);
-      web_contents_->GetView()->Focus();
+      web_contents_->Focus();
       break;
     case ShellContextMenuItemReloadId:
       web_contents_->GetController().Reload(false);
-      web_contents_->GetView()->Focus();
+      web_contents_->Focus();
       break;
     case ShellContextMenuItemInspectId: {
       ShellDevToolsFrontend::Show(web_contents_);
@@ -231,24 +232,17 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) {
   }
 }
 
-WebDragDestDelegate* ShellWebContentsViewDelegate::GetDragDestDelegate() {
-  return NULL;
+#if defined(TOOLKIT_VIEWS)
+void ShellWebContentsViewDelegate::ShowDisambiguationPopup(
+    const gfx::Rect& target_rect,
+    const SkBitmap& zoomed_bitmap,
+    const gfx::NativeView content,
+    const base::Callback<void(ui::GestureEvent*)>& gesture_cb,
+    const base::Callback<void(ui::MouseEvent*)>& mouse_cb) {
 }
 
-void ShellWebContentsViewDelegate::StoreFocus() {
-}
-
-void ShellWebContentsViewDelegate::RestoreFocus() {
-}
-
-bool ShellWebContentsViewDelegate::Focus() {
-  return false;
-}
-
-void ShellWebContentsViewDelegate::TakeFocus(bool reverse) {
-}
-
-void ShellWebContentsViewDelegate::SizeChanged(const gfx::Size& size) {
+void ShellWebContentsViewDelegate::HideDisambiguationPopup() {
 }
+#endif
 
 }  // namespace content