Commit 7e0b5922 authored by tapted's avatar tapted Committed by Commit bot

Remove #ifdefs around ShowLinkDisambiguationPopup

Current efforts are aimed at harmonizing our UI code. #ifdefs work
against this and have a lot of downsides besides.

This is a follow-up to http://crrev.com/351683002 -- a long-running CL
which added ShowLinkDisambiguationPopup to Aura -- and
http://crrev.com/596373002 which fixed some build problems with that.
However, toolkit_views=1 use_aura=0 which is in use on Mac still has
problems.

This CL adds default method definitions to WebContentsViewDelegate and
RenderWidgetHostViewBase. Essentially moving a NOTIMPLEMENTED() guarded
by #ifdefs into a base class method, and removing some unnecessary
boilerplate.

BUG=385249, 399191

Review URL: https://codereview.chromium.org/610893003

Cr-Commit-Position: refs/heads/master@{#297360}
parent 2636d976
......@@ -187,13 +187,6 @@ void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params) {
}
#if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) || defined(USE_AURA)
void RenderWidgetHostViewChildFrame::ShowDisambiguationPopup(
const gfx::Rect& rect_pixels,
const SkBitmap& zoomed_bitmap) {
}
#endif
#if defined(OS_ANDROID)
void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
}
......
......@@ -137,13 +137,7 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
const NativeWebKeyboardEvent& event) OVERRIDE;
#endif // defined(OS_MACOSX)
#if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) || defined(USE_AURA)
// RenderWidgetHostViewBase implementation.
virtual void ShowDisambiguationPopup(
const gfx::Rect& rect_pixels,
const SkBitmap& zoomed_bitmap) OVERRIDE;
#endif // defined(OS_ANDROID) || defined(TOOLKIT_VIEWS)
#if defined(OS_ANDROID)
virtual void LockCompositingSurface() OVERRIDE;
virtual void UnlockCompositingSurface() OVERRIDE;
......
......@@ -1734,14 +1734,10 @@ void RenderWidgetHostImpl::OnShowDisambiguationPopup(
SkBitmap zoomed_bitmap;
zoomed_bitmap.installPixels(info, bitmap->pixels(), info.minRowBytes());
#if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS)
// Note that |rect| is in coordinates of pixels relative to the window origin.
// Aura-based systems will want to convert this to DIPs.
if (view_)
view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap);
#else
NOTIMPLEMENTED();
#endif
// It is assumed that the disambiguation popup will make a copy of the
// provided zoomed image, so we delete this one.
......
......@@ -605,6 +605,19 @@ SkColorType RenderWidgetHostViewBase::PreferredReadbackFormat() {
return kN32_SkColorType;
}
void RenderWidgetHostViewBase::OnTextSurroundingSelectionResponse(
const base::string16& content,
size_t start_offset,
size_t end_offset) {
NOTIMPLEMENTED();
}
void RenderWidgetHostViewBase::ShowDisambiguationPopup(
const gfx::Rect& rect_pixels,
const SkBitmap& zoomed_bitmap) {
NOTIMPLEMENTED();
}
gfx::Size RenderWidgetHostViewBase::GetVisibleViewportSize() const {
return GetViewBounds().size();
}
......
......@@ -331,14 +331,16 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
virtual gfx::GLSurfaceHandle GetCompositingSurface() = 0;
// Called by the RenderFrameHost when it receives an IPC response to a
// TextSurroundingSelectionRequest.
virtual void OnTextSurroundingSelectionResponse(const base::string16& content,
size_t start_offset,
size_t end_offset) {};
size_t end_offset);
#if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) || defined(USE_AURA)
// Called by the RenderWidgetHost when an ambiguous gesture is detected to
// show the disambiguation popup bubble.
virtual void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
const SkBitmap& zoomed_bitmap) = 0;
#endif
const SkBitmap& zoomed_bitmap);
#if defined(OS_ANDROID)
// Instructs the view to not drop the surface even when the view is hidden.
......
......@@ -33,6 +33,17 @@ bool WebContentsViewDelegate::Focus() {
void WebContentsViewDelegate::TakeFocus(bool reverse) {
}
void WebContentsViewDelegate::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 WebContentsViewDelegate::HideDisambiguationPopup() {
}
void WebContentsViewDelegate::SizeChanged(const gfx::Size& size) {
}
......
......@@ -9,9 +9,8 @@
#import <Cocoa/Cocoa.h>
#endif
#include "base/callback.h"
#include "base/callback_forward.h"
#include "content/common/content_export.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#if defined(__OBJC__)
......@@ -19,6 +18,7 @@
#endif
namespace gfx {
class Rect;
class Size;
}
......@@ -55,7 +55,6 @@ class CONTENT_EXPORT WebContentsViewDelegate {
virtual void TakeFocus(bool reverse);
virtual void SizeChanged(const gfx::Size& size);
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
// Shows a popup window containing the |zoomed_bitmap| of web content with
// more than one link, allowing the user to more easily select which link
// they were trying to touch. |target_rect| is the rectangle in DIPs in the
......@@ -68,12 +67,11 @@ class CONTENT_EXPORT WebContentsViewDelegate {
const SkBitmap& zoomed_bitmap,
const gfx::NativeView content,
const base::Callback<void(ui::GestureEvent*)>& gesture_cb,
const base::Callback<void(ui::MouseEvent*)>& mouse_cb) = 0;
const base::Callback<void(ui::MouseEvent*)>& mouse_cb);
// Hides the link disambiguation popup window if it is showing, otherwise does
// nothing.
virtual void HideDisambiguationPopup() = 0;
#endif
virtual void HideDisambiguationPopup();
// Returns a newly-created delegate for the RenderWidgetHostViewMac, to handle
// events on the responder chain.
......
......@@ -26,17 +26,6 @@ class ShellWebContentsViewDelegate : public WebContentsViewDelegate {
void MenuItemSelected(int selection);
#endif
#if defined(TOOLKIT_VIEWS)
virtual void 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) OVERRIDE;
virtual void HideDisambiguationPopup() OVERRIDE;
#endif
private:
WebContents* web_contents_;
ContextMenuParams params_;
......
......@@ -232,17 +232,4 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) {
}
}
#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::HideDisambiguationPopup() {
}
#endif
} // namespace content
......@@ -138,11 +138,6 @@ class TestRenderWidgetHostView : public RenderWidgetHostViewBase {
virtual bool PostProcessEventForPluginIme(
const NativeWebKeyboardEvent& event) OVERRIDE;
#endif
#if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) || defined(USE_AURA)
virtual void ShowDisambiguationPopup(
const gfx::Rect& rect_pixels,
const SkBitmap& zoomed_bitmap) OVERRIDE {}
#endif
#if defined(OS_ANDROID)
virtual void LockCompositingSurface() OVERRIDE {}
virtual void UnlockCompositingSurface() OVERRIDE {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment