| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MUS_H_ | |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MUS_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "build/build_config.h" | |
| 13 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | |
| 14 #include "content/browser/web_contents/web_contents_view.h" | |
| 15 #include "content/common/content_export.h" | |
| 16 #include "content/common/drag_event_source_info.h" | |
| 17 #include "services/ui/public/cpp/scoped_window_ptr.h" | |
| 18 #include "services/ui/public/cpp/window.h" | |
| 19 #include "ui/aura/window_delegate.h" | |
| 20 | |
| 21 namespace content { | |
| 22 | |
| 23 class RenderWidgetHostImpl; | |
| 24 class WebContents; | |
| 25 class WebContentsImpl; | |
| 26 class WebContentsViewDelegate; | |
| 27 | |
| 28 class WebContentsViewMus : public WebContentsView, | |
| 29 public RenderViewHostDelegateView, | |
| 30 public aura::WindowDelegate { | |
| 31 public: | |
| 32 // The corresponding WebContentsImpl is passed in the constructor, and manages | |
| 33 // our lifetime. This doesn't need to be the case, but is this way currently | |
| 34 // because that's what was easiest when they were split. | |
| 35 WebContentsViewMus(ui::Window* parent_window, | |
| 36 WebContentsImpl* web_contents, | |
| 37 WebContentsViewDelegate* delegate, | |
| 38 RenderViewHostDelegateView** delegate_view); | |
| 39 ~WebContentsViewMus() override; | |
| 40 | |
| 41 WebContents* web_contents(); | |
| 42 | |
| 43 private: | |
| 44 void SizeChangedCommon(const gfx::Size& size); | |
| 45 | |
| 46 // WebContentsView implementation: | |
| 47 gfx::NativeView GetNativeView() const override; | |
| 48 gfx::NativeView GetContentNativeView() const override; | |
| 49 gfx::NativeWindow GetTopLevelNativeWindow() const override; | |
| 50 void GetScreenInfo(ScreenInfo* screen_info) const override; | |
| 51 void GetContainerBounds(gfx::Rect* out) const override; | |
| 52 void SizeContents(const gfx::Size& size) override; | |
| 53 void Focus() override; | |
| 54 void SetInitialFocus() override; | |
| 55 void StoreFocus() override; | |
| 56 void RestoreFocus() override; | |
| 57 DropData* GetDropData() const override; | |
| 58 gfx::Rect GetViewBounds() const override; | |
| 59 void CreateView(const gfx::Size& initial_size, | |
| 60 gfx::NativeView context) override; | |
| 61 RenderWidgetHostViewBase* CreateViewForWidget( | |
| 62 RenderWidgetHost* render_widget_host, | |
| 63 bool is_guest_view_hack) override; | |
| 64 RenderWidgetHostViewBase* CreateViewForPopupWidget( | |
| 65 RenderWidgetHost* render_widget_host) override; | |
| 66 void SetPageTitle(const base::string16& title) override; | |
| 67 void RenderViewCreated(RenderViewHost* host) override; | |
| 68 void RenderViewSwappedIn(RenderViewHost* host) override; | |
| 69 void SetOverscrollControllerEnabled(bool enabled) override; | |
| 70 #if defined(OS_MACOSX) | |
| 71 void SetAllowOtherViews(bool allow) override; | |
| 72 bool GetAllowOtherViews() const override; | |
| 73 bool IsEventTracking() const override; | |
| 74 void CloseTabAfterEventTracking() override; | |
| 75 #endif | |
| 76 | |
| 77 // Backend implementation of RenderViewHostDelegateView. | |
| 78 void ShowContextMenu(RenderFrameHost* render_frame_host, | |
| 79 const ContextMenuParams& params) override; | |
| 80 void StartDragging(const DropData& drop_data, | |
| 81 blink::WebDragOperationsMask allowed_ops, | |
| 82 const gfx::ImageSkia& image, | |
| 83 const gfx::Vector2d& image_offset, | |
| 84 const DragEventSourceInfo& event_info, | |
| 85 RenderWidgetHostImpl* source_rwh) override; | |
| 86 void UpdateDragCursor(blink::WebDragOperation operation) override; | |
| 87 void GotFocus() override; | |
| 88 void TakeFocus(bool reverse) override; | |
| 89 | |
| 90 // Overridden from aura::WindowDelegate: | |
| 91 gfx::Size GetMinimumSize() const override; | |
| 92 gfx::Size GetMaximumSize() const override; | |
| 93 void OnBoundsChanged(const gfx::Rect& old_bounds, | |
| 94 const gfx::Rect& new_bounds) override; | |
| 95 gfx::NativeCursor GetCursor(const gfx::Point& point) override; | |
| 96 int GetNonClientComponent(const gfx::Point& point) const override; | |
| 97 bool ShouldDescendIntoChildForEventHandling( | |
| 98 aura::Window* child, | |
| 99 const gfx::Point& location) override; | |
| 100 bool CanFocus() override; | |
| 101 void OnCaptureLost() override; | |
| 102 void OnPaint(const ui::PaintContext& context) override; | |
| 103 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | |
| 104 void OnWindowDestroying(aura::Window* window) override; | |
| 105 void OnWindowDestroyed(aura::Window* window) override; | |
| 106 void OnWindowTargetVisibilityChanged(bool visible) override; | |
| 107 bool HasHitTestMask() const override; | |
| 108 void GetHitTestMask(gfx::Path* mask) const override; | |
| 109 | |
| 110 // The WebContentsImpl whose contents we display. | |
| 111 WebContentsImpl* web_contents_; | |
| 112 | |
| 113 std::unique_ptr<WebContentsViewDelegate> delegate_; | |
| 114 std::unique_ptr<aura::Window> aura_window_; | |
| 115 std::unique_ptr<ui::ScopedWindowPtr> mus_window_; | |
| 116 | |
| 117 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMus); | |
| 118 }; | |
| 119 | |
| 120 } // namespace content | |
| 121 | |
| 122 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MUS_H_ | |
| OLD | NEW |