Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: chrome/browser/views/tabs/native_view_photobooth.h

Issue 115475: Refactors HWNDPhotobooth into NativeViewPhotobooth and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_H_
6 #define CHROME_BROWSER_VIEWS_TABS_HWND_PHOTOBOOTH_H__ 6 #define CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/gfx/native_widget_types.h"
9 #include "base/gfx/rect.h"
10 9
11 namespace gfx { 10 namespace gfx {
12 class Canvas; 11 class Canvas;
12 class Rect;
13 } 13 }
14 namespace views {
15 class WidgetWin;
16 }
17
18 /////////////////////////////////////////////////////////////////////////////// 14 ///////////////////////////////////////////////////////////////////////////////
19 // HWNDPhotobooth 15 // NativeViewPhotobooth
20 // 16 //
21 // An object that a HWND "steps into" to have its picture taken. This is used 17 // An object that a NativeView "steps into" to have its picture taken. This is
22 // to generate a full size screen shot of the contents of a HWND including 18 // used to generate a full size screen shot of the contents of a NativeView
23 // any child windows. 19 // including 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 NativeView to be re-parented to a
26 // off-screen layered window. 22 // mostly off-screen layered window.
27 // 23 //
28 class HWNDPhotobooth { 24 class 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 view, then shows it. The caller is responsible for destroying this
32 // window, since the photo-booth will detach it before it is destroyed. 28 // photo-booth, 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 static NativeViewPhotobooth* Create(gfx::NativeView initial_view);
34 // target area in |canvas| to which painted contents will be clipped.
35 explicit HWNDPhotobooth(HWND initial_hwnd);
36 30
37 // Destroys the photo booth window. 31 // Destroys the photo booth window.
38 virtual ~HWNDPhotobooth(); 32 virtual ~NativeViewPhotobooth() {}
39 33
40 // Replaces the HWND in the photo booth with the specified one. The caller is 34 // Replaces the view in the photo booth with the specified one.
41 // responsible for destroying this HWND since it will be detached from the 35 virtual void Replace(gfx::NativeView new_view) = 0;
42 // capture window before the capture window is destroyed.
43 void ReplaceHWND(HWND new_hwnd);
44 36
45 // Paints the current display image of the window into |canvas|, clipped to 37 // Paints the current display image of the window into |canvas|, clipped to
46 // |target_bounds|. 38 // |target_bounds|.
47 void PaintScreenshotIntoCanvas(gfx::Canvas* canvas, 39 virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas,
48 const gfx::Rect& target_bounds); 40 const gfx::Rect& target_bounds) = 0;
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 }; 41 };
62 42
63 #endif // #ifndef CHROME_BROWSER_VIEWS_TABS_HWND_PHOTOBOOTH_H__ 43 #endif // #ifndef CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/hwnd_photobooth.cc ('k') | chrome/browser/views/tabs/native_view_photobooth_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698