#include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_ptr.h"
+#include "content/browser/renderer_host/render_view_host_delegate_view.h"
+#include "content/browser/web_contents/web_contents_view.h"
#include "content/common/content_export.h"
#include "content/common/drag_event_source_info.h"
-#include "content/port/browser/render_view_host_delegate_view.h"
-#include "content/port/browser/web_contents_view_port.h"
#include "ui/base/cocoa/base_view.h"
#include "ui/gfx/size.h"
@class WebDragSource;
namespace content {
+class PopupMenuHelper;
class WebContentsImpl;
class WebContentsViewDelegate;
class WebContentsViewMac;
// Mac-specific implementation of the WebContentsView. It owns an NSView that
// contains all of the contents of the tab and associated child views.
-class WebContentsViewMac : public WebContentsViewPort,
+class WebContentsViewMac : public WebContentsView,
public RenderViewHostDelegateView {
public:
// The corresponding WebContentsImpl is passed in the constructor, and manages
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
- virtual void OnTabCrashed(base::TerminationStatus status,
- int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual DropData* GetDropData() const OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
- virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
- virtual bool GetAllowOverlappingViews() const OVERRIDE;
- virtual void SetOverlayView(WebContentsView* overlay,
- const gfx::Point& offset) OVERRIDE;
- virtual void RemoveOverlayView() OVERRIDE;
-
- // WebContentsViewPort implementation ----------------------------------------
+ virtual void SetAllowOtherViews(bool allow) OVERRIDE;
+ virtual bool GetAllowOtherViews() const OVERRIDE;
virtual void CreateView(
const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
+ virtual RenderWidgetHostViewBase* CreateViewForWidget(
RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ virtual RenderWidgetHostViewBase* CreateViewForPopupWidget(
RenderWidgetHost* render_widget_host) OVERRIDE;
virtual void SetPageTitle(const base::string16& title) OVERRIDE;
virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
// Backend implementation of RenderViewHostDelegateView.
- virtual void ShowContextMenu(content::RenderFrameHost* render_frame_host,
+ virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
const ContextMenuParams& params) OVERRIDE;
- virtual void ShowPopupMenu(const gfx::Rect& bounds,
+ virtual void ShowPopupMenu(RenderFrameHost* render_frame_host,
+ const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
+ virtual void HidePopupMenu() OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
blink::WebDragOperationsMask allowed_operations,
const gfx::ImageSkia& image,
WebContentsViewDelegate* delegate() { return delegate_.get(); }
private:
- // Updates overlay view on current RenderWidgetHostView.
- void UpdateRenderWidgetHostViewOverlay();
-
// The WebContentsImpl whose contents we display.
WebContentsImpl* web_contents_;
// Our optional delegate.
scoped_ptr<WebContentsViewDelegate> delegate_;
- // Whether to allow overlapping views.
- bool allow_overlapping_views_;
-
- // The overlay view which is rendered above this one.
- // Overlay view has |underlay_view_| set to this view.
- WebContentsViewMac* overlay_view_;
-
- // The offset of overlay view relative to this view.
- gfx::Point overlay_view_offset_;
+ // Whether to allow other views.
+ bool allow_other_views_;
- // The underlay view which this view is rendered above.
- // Underlay view has |overlay_view_| set to this view.
- WebContentsViewMac* underlay_view_;
+ scoped_ptr<PopupMenuHelper> popup_menu_helper_;
DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac);
};