| 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_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_ | |
| 7 | |
| 8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" | |
| 9 | |
| 10 namespace views { | |
| 11 class Widget; | |
| 12 } | |
| 13 | |
| 14 /////////////////////////////////////////////////////////////////////////////// | |
| 15 // HWNDPhotobooth | |
| 16 // | |
| 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 | |
| 19 // any child windows. | |
| 20 // | |
| 21 // Implementation note: This causes the HWND to be re-parented to a mostly | |
| 22 // off-screen layered window. | |
| 23 // | |
| 24 class NativeViewPhotoboothWin : public NativeViewPhotobooth { | |
| 25 public: | |
| 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); | |
| 32 | |
| 33 // Destroys the photo booth window. | |
| 34 virtual ~NativeViewPhotoboothWin(); | |
| 35 | |
| 36 // Replaces the view in the photo booth with the specified one. | |
| 37 virtual void Replace(gfx::NativeView new_view) OVERRIDE; | |
| 38 | |
| 39 // Paints the current display image of the window into |canvas|, clipped to | |
| 40 // |target_bounds|. | |
| 41 virtual void PaintScreenshotIntoCanvas( | |
| 42 gfx::Canvas* canvas, | |
| 43 const gfx::Rect& target_bounds) OVERRIDE; | |
| 44 | |
| 45 private: | |
| 46 // Creates a mostly off-screen window to contain the HWND to be captured. | |
| 47 void CreateCaptureWindow(HWND initial_hwnd); | |
| 48 | |
| 49 // The nearly off-screen photo-booth layered window used to hold the HWND. | |
| 50 views::Widget* capture_window_; | |
| 51 | |
| 52 // The current HWND being captured. | |
| 53 HWND current_hwnd_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(NativeViewPhotoboothWin); | |
| 56 }; | |
| 57 | |
| 58 #endif // CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_WIN_H_ | |
| OLD | NEW |