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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_
8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h"
14 ///////////////////////////////////////////////////////////////////////////////
17 // An object that a HWND "steps into" to have its picture taken. This is used
18 // to generate a full size screen shot of the contents of a HWND including
21 // Implementation note: This causes the HWND to be re-parented to a mostly
22 // off-screen layered window.
24 class NativeViewPhotoboothWin : public NativeViewPhotobooth {
26 // Creates the photo booth. Constructs a nearly off-screen window, parents
27 // the HWND, then shows it. The caller is responsible for destroying this
28 // window, since the photo-booth will detach it before it is destroyed.
29 // |canvas| is a canvas to paint the contents into, and dest_bounds is the
30 // target area in |canvas| to which painted contents will be clipped.
31 explicit NativeViewPhotoboothWin(gfx::NativeView initial_view);
33 // Destroys the photo booth window.
34 virtual ~NativeViewPhotoboothWin();
36 // Replaces the view in the photo booth with the specified one.
37 virtual void Replace(gfx::NativeView new_view) OVERRIDE;
39 // Paints the current display image of the window into |canvas|, clipped to
41 virtual void PaintScreenshotIntoCanvas(
43 const gfx::Rect& target_bounds) OVERRIDE;
46 // Creates a mostly off-screen window to contain the HWND to be captured.
47 void CreateCaptureWindow(HWND initial_hwnd);
49 // The nearly off-screen photo-booth layered window used to hold the HWND.
50 views::Widget* capture_window_;
52 // The current HWND being captured.
55 DISALLOW_COPY_AND_ASSIGN(NativeViewPhotoboothWin);
58 #endif // CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_