| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 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_VIEWS_TABS_HWND_PHOTOBOOTH_H__ | |
| 6 #define CHROME_BROWSER_VIEWS_TABS_HWND_PHOTOBOOTH_H__ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/gfx/rect.h" | |
| 10 | |
| 11 namespace gfx { | |
| 12 class Canvas; | |
| 13 } | |
| 14 namespace views { | |
| 15 class WidgetWin; | |
| 16 } | |
| 17 | |
| 18 /////////////////////////////////////////////////////////////////////////////// | |
| 19 // HWNDPhotobooth | |
| 20 // | |
| 21 // An object that a HWND "steps into" to have its picture taken. This is used | |
| 22 // to generate a full size screen shot of the contents of a HWND including | |
| 23 // any child windows. | |
| 24 // | |
| 25 // Implementation note: This causes the HWND to be re-parented to a mostly | |
| 26 // off-screen layered window. | |
| 27 // | |
| 28 class HWNDPhotobooth { | |
| 29 public: | |
| 30 // Creates the photo booth. Constructs a nearly off-screen window, parents | |
| 31 // the HWND, then shows it. The caller is responsible for destroying this | |
| 32 // window, since the photo-booth will detach it before it is destroyed. | |
| 33 // |canvas| is a canvas to paint the contents into, and dest_bounds is the | |
| 34 // target area in |canvas| to which painted contents will be clipped. | |
| 35 explicit HWNDPhotobooth(HWND initial_hwnd); | |
| 36 | |
| 37 // Destroys the photo booth window. | |
| 38 virtual ~HWNDPhotobooth(); | |
| 39 | |
| 40 // Replaces the HWND in the photo booth with the specified one. The caller is | |
| 41 // responsible for destroying this HWND since it will be detached from the | |
| 42 // capture window before the capture window is destroyed. | |
| 43 void ReplaceHWND(HWND new_hwnd); | |
| 44 | |
| 45 // Paints the current display image of the window into |canvas|, clipped to | |
| 46 // |target_bounds|. | |
| 47 void PaintScreenshotIntoCanvas(gfx::Canvas* canvas, | |
| 48 const gfx::Rect& target_bounds); | |
| 49 | |
| 50 private: | |
| 51 // Creates a mostly off-screen window to contain the HWND to be captured. | |
| 52 void CreateCaptureWindow(HWND initial_hwnd); | |
| 53 | |
| 54 // The nearly off-screen photo-booth layered window used to hold the HWND. | |
| 55 views::WidgetWin* capture_window_; | |
| 56 | |
| 57 // The current HWND being captured. | |
| 58 HWND current_hwnd_; | |
| 59 | |
| 60 DISALLOW_EVIL_CONSTRUCTORS(HWNDPhotobooth); | |
| 61 }; | |
| 62 | |
| 63 #endif // #ifndef CHROME_BROWSER_VIEWS_TABS_HWND_PHOTOBOOTH_H__ | |
| OLD | NEW |