// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MUS_H_ #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MUS_H_ #include #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "components/mus/public/cpp/scoped_window_ptr.h" #include "components/mus/public/cpp/window.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 "ui/aura/window_delegate.h" namespace content { class WebContents; class WebContentsImpl; class WebContentsViewDelegate; class WebContentsViewMus : public WebContentsView, public RenderViewHostDelegateView, public aura::WindowDelegate { public: // The corresponding WebContentsImpl is passed in the constructor, and manages // our lifetime. This doesn't need to be the case, but is this way currently // because that's what was easiest when they were split. WebContentsViewMus(mus::Window* parent_window, WebContentsImpl* web_contents, WebContentsViewDelegate* delegate, RenderViewHostDelegateView** delegate_view); ~WebContentsViewMus() override; WebContents* web_contents(); private: void SizeChangedCommon(const gfx::Size& size); // WebContentsView implementation: gfx::NativeView GetNativeView() const override; gfx::NativeView GetContentNativeView() const override; gfx::NativeWindow GetTopLevelNativeWindow() const override; void GetContainerBounds(gfx::Rect* out) const override; void SizeContents(const gfx::Size& size) override; void Focus() override; void SetInitialFocus() override; void StoreFocus() override; void RestoreFocus() override; DropData* GetDropData() const override; gfx::Rect GetViewBounds() const override; void CreateView(const gfx::Size& initial_size, gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override; RenderWidgetHostViewBase* CreateViewForPopupWidget( RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; void RenderViewCreated(RenderViewHost* host) override; void RenderViewSwappedIn(RenderViewHost* host) override; void SetOverscrollControllerEnabled(bool enabled) override; #if defined(OS_MACOSX) void SetAllowOtherViews(bool allow) override; bool GetAllowOtherViews() const override; bool IsEventTracking() const override; void CloseTabAfterEventTracking() override; #endif // Backend implementation of RenderViewHostDelegateView. void ShowContextMenu(RenderFrameHost* render_frame_host, const ContextMenuParams& params) override; void StartDragging(const DropData& drop_data, blink::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, const DragEventSourceInfo& event_info) override; void UpdateDragCursor(blink::WebDragOperation operation) override; void GotFocus() override; void TakeFocus(bool reverse) override; // Overridden from aura::WindowDelegate: gfx::Size GetMinimumSize() const override; gfx::Size GetMaximumSize() const override; void OnBoundsChanged(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) override; gfx::NativeCursor GetCursor(const gfx::Point& point) override; int GetNonClientComponent(const gfx::Point& point) const override; bool ShouldDescendIntoChildForEventHandling( aura::Window* child, const gfx::Point& location) override; bool CanFocus() override; void OnCaptureLost() override; void OnPaint(const ui::PaintContext& context) override; void OnDeviceScaleFactorChanged(float device_scale_factor) override; void OnWindowDestroying(aura::Window* window) override; void OnWindowDestroyed(aura::Window* window) override; void OnWindowTargetVisibilityChanged(bool visible) override; bool HasHitTestMask() const override; void GetHitTestMask(gfx::Path* mask) const override; // The WebContentsImpl whose contents we display. WebContentsImpl* web_contents_; scoped_ptr delegate_; scoped_ptr aura_window_; scoped_ptr mus_window_; DISALLOW_COPY_AND_ASSIGN(WebContentsViewMus); }; } // namespace content #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MUS_H_