| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/native_web_keyboard_event.h" | 10 #include "content/public/browser/native_web_keyboard_event.h" |
| 11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
| 12 #include "ipc/ipc_sender.h" | 12 #include "ipc/ipc_sender.h" |
| 13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 14 #include "third_party/WebKit/public/web/WebTextDirection.h" | 14 #include "third_party/WebKit/public/web/WebTextDirection.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
| 16 #include "ui/surface/transport_dib.h" | 17 #include "ui/surface/transport_dib.h" |
| 17 | 18 |
| 18 #if defined(TOOLKIT_GTK) | 19 #if defined(TOOLKIT_GTK) |
| 19 #include "ui/base/x/x11_util.h" | 20 #include "ui/base/x/x11_util.h" |
| 20 #elif defined(OS_MACOSX) | 21 #elif defined(OS_MACOSX) |
| 21 #include "skia/ext/platform_device.h" | 22 #include "skia/ext/platform_device.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 class SkBitmap; | 25 class SkBitmap; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // resized. If |accelerated_dst_size| is empty, the size copied from the | 191 // resized. If |accelerated_dst_size| is empty, the size copied from the |
| 191 // source contents is used. |callback| is invoked with true on success, false | 192 // source contents is used. |callback| is invoked with true on success, false |
| 192 // otherwise, along with a SkBitmap containing the copied pixel data. | 193 // otherwise, along with a SkBitmap containing the copied pixel data. |
| 193 // | 194 // |
| 194 // NOTE: |callback| is called synchronously if the backing store is available. | 195 // NOTE: |callback| is called synchronously if the backing store is available. |
| 195 // When accelerated compositing is active, |callback| may be called | 196 // When accelerated compositing is active, |callback| may be called |
| 196 // asynchronously. | 197 // asynchronously. |
| 197 virtual void CopyFromBackingStore( | 198 virtual void CopyFromBackingStore( |
| 198 const gfx::Rect& src_rect, | 199 const gfx::Rect& src_rect, |
| 199 const gfx::Size& accelerated_dst_size, | 200 const gfx::Size& accelerated_dst_size, |
| 200 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; | 201 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 202 const SkBitmap::Config& bitmap_config) = 0; |
| 201 #if defined(TOOLKIT_GTK) | 203 #if defined(TOOLKIT_GTK) |
| 202 // Paint the backing store into the target's |dest_rect|. | 204 // Paint the backing store into the target's |dest_rect|. |
| 203 virtual bool CopyFromBackingStoreToGtkWindow(const gfx::Rect& dest_rect, | 205 virtual bool CopyFromBackingStoreToGtkWindow(const gfx::Rect& dest_rect, |
| 204 GdkWindow* target) = 0; | 206 GdkWindow* target) = 0; |
| 205 #elif defined(OS_MACOSX) | 207 #elif defined(OS_MACOSX) |
| 206 virtual gfx::Size GetBackingStoreSize() = 0; | 208 virtual gfx::Size GetBackingStoreSize() = 0; |
| 207 virtual bool CopyFromBackingStoreToCGContext(const CGRect& dest_rect, | 209 virtual bool CopyFromBackingStoreToCGContext(const CGRect& dest_rect, |
| 208 CGContextRef target) = 0; | 210 CGContextRef target) = 0; |
| 209 #endif | 211 #endif |
| 210 | 212 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // Grabs snapshot from renderer side and returns the bitmap to a callback. | 289 // Grabs snapshot from renderer side and returns the bitmap to a callback. |
| 288 // If |src_rect| is empty, the whole contents is copied. This is an expensive | 290 // If |src_rect| is empty, the whole contents is copied. This is an expensive |
| 289 // operation due to the IPC, but it can be used as a fallback method when | 291 // operation due to the IPC, but it can be used as a fallback method when |
| 290 // CopyFromBackingStore fails due to the backing store not being available or, | 292 // CopyFromBackingStore fails due to the backing store not being available or, |
| 291 // in composited mode, when the accelerated surface is not available to the | 293 // in composited mode, when the accelerated surface is not available to the |
| 292 // browser side. | 294 // browser side. |
| 293 virtual void GetSnapshotFromRenderer( | 295 virtual void GetSnapshotFromRenderer( |
| 294 const gfx::Rect& src_subrect, | 296 const gfx::Rect& src_subrect, |
| 295 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; | 297 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; |
| 296 | 298 |
| 299 virtual SkBitmap::Config PreferredReadbackFormat() = 0; |
| 300 |
| 297 protected: | 301 protected: |
| 298 friend class RenderWidgetHostImpl; | 302 friend class RenderWidgetHostImpl; |
| 299 | 303 |
| 300 // Retrieves the implementation class. Intended only for code | 304 // Retrieves the implementation class. Intended only for code |
| 301 // within content/. This method is necessary because | 305 // within content/. This method is necessary because |
| 302 // RenderWidgetHost is the root of a diamond inheritance pattern, so | 306 // RenderWidgetHost is the root of a diamond inheritance pattern, so |
| 303 // subclasses inherit it virtually, which removes our ability to | 307 // subclasses inherit it virtually, which removes our ability to |
| 304 // static_cast to the subclass. | 308 // static_cast to the subclass. |
| 305 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; | 309 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; |
| 306 }; | 310 }; |
| 307 | 311 |
| 308 } // namespace content | 312 } // namespace content |
| 309 | 313 |
| 310 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 314 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
| OLD | NEW |