| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 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 CHROME_BROWSER_PRERENDER_PRERENDER_RENDER_WIDGET_HOST_VIEW_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_RENDER_WIDGET_HOST_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <vector> |
| 10 |
| 11 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 12 |
| 13 namespace prerender { |
| 14 |
| 15 class PrerenderContents; |
| 16 |
| 17 // A PrerenderRenderWidgetHostView acts as the "View" of prerendered web pages, |
| 18 // as they don't have an actual window (visible or hidden) until swapped into |
| 19 // a tab. |
| 20 class PrerenderRenderWidgetHostView : public RenderWidgetHostView { |
| 21 public: |
| 22 PrerenderRenderWidgetHostView(RenderWidgetHost* widget, |
| 23 PrerenderContents* prerender_contents); |
| 24 virtual ~PrerenderRenderWidgetHostView(); |
| 25 |
| 26 // Initializes |this| using the bounds from |view|, which must be non-NULL. |
| 27 void Init(RenderWidgetHostView* view); |
| 28 |
| 29 // Implementation of RenderWidgetHostView: |
| 30 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 31 const gfx::Rect& pos) OVERRIDE; |
| 32 virtual void InitAsFullscreen() OVERRIDE; |
| 33 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| 34 virtual void DidBecomeSelected() OVERRIDE; |
| 35 virtual void WasHidden() OVERRIDE; |
| 36 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 37 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 38 virtual gfx::NativeView GetNativeView() OVERRIDE; |
| 39 virtual void MovePluginWindows( |
| 40 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; |
| 41 virtual void Focus() OVERRIDE; |
| 42 virtual void Blur() OVERRIDE; |
| 43 virtual bool HasFocus() OVERRIDE; |
| 44 virtual void Show() OVERRIDE; |
| 45 virtual void Hide() OVERRIDE; |
| 46 virtual bool IsShowing() OVERRIDE; |
| 47 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 48 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; |
| 49 virtual void SetIsLoading(bool is_loading) OVERRIDE; |
| 50 virtual void ImeUpdateTextInputState(WebKit::WebTextInputType type, |
| 51 const gfx::Rect& caret_rect) OVERRIDE; |
| 52 virtual void ImeCancelComposition() OVERRIDE; |
| 53 virtual void DidUpdateBackingStore( |
| 54 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
| 55 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; |
| 56 virtual void RenderViewGone(base::TerminationStatus status, |
| 57 int error_code) OVERRIDE; |
| 58 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) OVERRIDE; |
| 59 virtual void Destroy() OVERRIDE; |
| 60 virtual void SetTooltipText(const std::wstring& tooltip_text) OVERRIDE; |
| 61 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; |
| 62 |
| 63 #if defined(OS_MACOSX) |
| 64 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE; |
| 65 virtual gfx::Rect GetViewCocoaBounds() const OVERRIDE; |
| 66 virtual gfx::Rect GetRootWindowRect() OVERRIDE; |
| 67 virtual void SetActive(bool active) OVERRIDE; |
| 68 virtual void SetWindowVisibility(bool visible) OVERRIDE; |
| 69 virtual void WindowFrameChanged() OVERRIDE; |
| 70 virtual void PluginFocusChanged(bool focused, int plugin_id) OVERRIDE; |
| 71 virtual void StartPluginIme() OVERRIDE; |
| 72 virtual bool PostProcessEventForPluginIme( |
| 73 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 74 |
| 75 virtual gfx::PluginWindowHandle AllocateFakePluginWindowHandle( |
| 76 bool opaque, bool root) OVERRIDE; |
| 77 virtual void DestroyFakePluginWindowHandle( |
| 78 gfx::PluginWindowHandle window) OVERRIDE; |
| 79 virtual void AcceleratedSurfaceSetIOSurface( |
| 80 gfx::PluginWindowHandle window, |
| 81 int32 width, |
| 82 int32 height, |
| 83 uint64 io_surface_identifier) OVERRIDE; |
| 84 virtual void AcceleratedSurfaceSetTransportDIB( |
| 85 gfx::PluginWindowHandle window, |
| 86 int32 width, |
| 87 int32 height, |
| 88 TransportDIB::Handle transport_dib) OVERRIDE; |
| 89 virtual void AcceleratedSurfaceBuffersSwapped( |
| 90 gfx::PluginWindowHandle window, |
| 91 uint64 surface_id, |
| 92 int renderer_id, |
| 93 int32 route_id, |
| 94 int gpu_host_id, |
| 95 uint64 swap_buffers_count) OVERRIDE; |
| 96 virtual void GpuRenderingStateDidChange() OVERRIDE; |
| 97 #endif |
| 98 |
| 99 #if defined(TOOLKIT_USES_GTK) |
| 100 virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE; |
| 101 virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE; |
| 102 virtual void AcceleratedCompositingActivated(bool activated) OVERRIDE; |
| 103 #endif |
| 104 |
| 105 #if defined(OS_WIN) |
| 106 virtual void WillWmDestroy() OVERRIDE; |
| 107 virtual void ShowCompositorHostWindow(bool show) OVERRIDE; |
| 108 #endif |
| 109 |
| 110 virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; |
| 111 virtual void SetVisuallyDeemphasized(const SkColor* color, |
| 112 bool animate) OVERRIDE; |
| 113 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
| 114 |
| 115 virtual bool ContainsNativeView(gfx::NativeView native_view) const OVERRIDE; |
| 116 |
| 117 private: |
| 118 RenderWidgetHost* render_widget_host_; |
| 119 // Need this to cancel prerendering in some cases. |
| 120 PrerenderContents* prerender_contents_; |
| 121 |
| 122 gfx::Rect bounds_; |
| 123 #if defined(OS_MACOSX) |
| 124 gfx::Rect cocoa_view_bounds_; |
| 125 gfx::Rect root_window_rect_; |
| 126 #endif // defined(OS_MACOSX) |
| 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(PrerenderRenderWidgetHostView); |
| 129 }; |
| 130 |
| 131 } // namespace prerender |
| 132 |
| 133 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_RENDER_WIDGET_HOST_VIEW_H_ |
| OLD | NEW |