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