Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / web_contents / web_contents_view_guest.h
blobaaa35c39429c3f9bc0ca1859786c5b9a436f2e91
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.
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_
8 #include <vector>
10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h"
12 #include "content/common/drag_event_source_info.h"
13 #include "content/port/browser/render_view_host_delegate_view.h"
14 #include "content/port/browser/web_contents_view_port.h"
16 namespace content {
18 class WebContents;
19 class WebContentsImpl;
20 class BrowserPluginGuest;
22 class CONTENT_EXPORT WebContentsViewGuest
23 : public WebContentsViewPort,
24 public RenderViewHostDelegateView {
25 public:
26 // The corresponding WebContentsImpl is passed in the constructor, and manages
27 // our lifetime. This doesn't need to be the case, but is this way currently
28 // because that's what was easiest when they were split.
29 // WebContentsViewGuest always has a backing platform dependent view,
30 // |platform_view|.
31 WebContentsViewGuest(WebContentsImpl* web_contents,
32 BrowserPluginGuest* guest,
33 scoped_ptr<WebContentsViewPort> platform_view,
34 RenderViewHostDelegateView* platform_view_delegate_view);
35 virtual ~WebContentsViewGuest();
37 WebContents* web_contents();
39 void OnGuestInitialized(WebContentsView* parent_view);
41 // WebContentsView implementation --------------------------------------------
43 virtual gfx::NativeView GetNativeView() const OVERRIDE;
44 virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
45 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
46 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
47 virtual void OnTabCrashed(base::TerminationStatus status,
48 int error_code) OVERRIDE;
49 virtual void SizeContents(const gfx::Size& size) OVERRIDE;
50 virtual void Focus() OVERRIDE;
51 virtual void SetInitialFocus() OVERRIDE;
52 virtual void StoreFocus() OVERRIDE;
53 virtual void RestoreFocus() OVERRIDE;
54 virtual DropData* GetDropData() const OVERRIDE;
55 virtual gfx::Rect GetViewBounds() const OVERRIDE;
56 #if defined(OS_MACOSX)
57 virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
58 virtual bool GetAllowOverlappingViews() const OVERRIDE;
59 virtual void SetOverlayView(WebContentsView* overlay,
60 const gfx::Point& offset) OVERRIDE;
61 virtual void RemoveOverlayView() OVERRIDE;
62 #endif
64 // WebContentsViewPort implementation ----------------------------------------
65 virtual void CreateView(const gfx::Size& initial_size,
66 gfx::NativeView context) OVERRIDE;
67 virtual RenderWidgetHostView* CreateViewForWidget(
68 RenderWidgetHost* render_widget_host) OVERRIDE;
69 virtual RenderWidgetHostView* CreateViewForPopupWidget(
70 RenderWidgetHost* render_widget_host) OVERRIDE;
71 virtual void SetPageTitle(const base::string16& title) OVERRIDE;
72 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
73 virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
74 virtual void SetOverscrollControllerEnabled(bool enabled) OVERRIDE;
75 #if defined(OS_MACOSX)
76 virtual bool IsEventTracking() const OVERRIDE;
77 virtual void CloseTabAfterEventTracking() OVERRIDE;
78 #endif
80 // Backend implementation of RenderViewHostDelegateView.
81 virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
82 const ContextMenuParams& params) OVERRIDE;
83 virtual void StartDragging(const DropData& drop_data,
84 blink::WebDragOperationsMask allowed_ops,
85 const gfx::ImageSkia& image,
86 const gfx::Vector2d& image_offset,
87 const DragEventSourceInfo& event_info) OVERRIDE;
88 virtual void UpdateDragCursor(blink::WebDragOperation operation) OVERRIDE;
89 virtual void GotFocus() OVERRIDE;
90 virtual void TakeFocus(bool reverse) OVERRIDE;
92 private:
93 // The WebContentsImpl whose contents we display.
94 WebContentsImpl* web_contents_;
95 BrowserPluginGuest* guest_;
96 // The platform dependent view backing this WebContentsView.
97 // Calls to this WebContentsViewGuest are forwarded to |platform_view_|.
98 scoped_ptr<WebContentsViewPort> platform_view_;
99 gfx::Size size_;
101 // Delegate view for guest's platform view.
102 RenderViewHostDelegateView* platform_view_delegate_view_;
104 DISALLOW_COPY_AND_ASSIGN(WebContentsViewGuest);
107 } // namespace content
109 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_