native_view_photobooth.h revision 72a454cd3513ac24fbdd0e0cb9ad70b86a99b801
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_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_ 6#define CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_ 7#pragma once 8 9#include "ui/gfx/native_widget_types.h" 10 11namespace gfx { 12class Canvas; 13class Rect; 14} 15/////////////////////////////////////////////////////////////////////////////// 16// NativeViewPhotobooth 17// 18// An object that a NativeView "steps into" to have its picture taken. This is 19// used to generate a full size screen shot of the contents of a NativeView 20// including any child windows. 21// 22// Implementation note: This causes the NativeView to be re-parented to a 23// mostly off-screen layered window. 24// 25class NativeViewPhotobooth { 26 public: 27 // Creates the photo booth. Constructs a nearly off-screen window, parents 28 // the view, then shows it. The caller is responsible for destroying this 29 // photo-booth, since the photo-booth will detach it before it is destroyed. 30 static NativeViewPhotobooth* Create(gfx::NativeView initial_view); 31 32 // Destroys the photo booth window. 33 virtual ~NativeViewPhotobooth() {} 34 35 // Replaces the view in the photo booth with the specified one. 36 virtual void Replace(gfx::NativeView new_view) = 0; 37 38 // Paints the current display image of the window into |canvas|, clipped to 39 // |target_bounds|. 40 virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas, 41 const gfx::Rect& target_bounds) = 0; 42}; 43 44#endif // CHROME_BROWSER_UI_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_H_ 45