summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/panels/taskbar_window_thumbnailer_win.h
blob: 537d596ef98d933612d2e0c3411efb4ad7031df2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_
#define CHROME_BROWSER_UI_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_
#pragma once

#include "base/memory/scoped_ptr.h"
#include "ui/base/win/hwnd_subclass.h"

class SkBitmap;

// Provides the custom thumbnail and live preview for the window that appears
// in the taskbar (Windows 7 and later).
class TaskbarWindowThumbnailerWin : public ui::HWNDMessageFilter {
 public:
  explicit TaskbarWindowThumbnailerWin(HWND hwnd);
  virtual ~TaskbarWindowThumbnailerWin();

  void Start();
  void Stop();

 private:
  // Overridden from ui::HWNDMessageFilter:
  virtual bool FilterMessage(HWND hwnd,
                             UINT message,
                             WPARAM w_param,
                             LPARAM l_param,
                             LRESULT* l_result) OVERRIDE;

  // Message handlers.
  bool OnDwmSendIconicThumbnail(
      int width, int height, LRESULT* l_result);
  bool OnDwmSendIconicLivePreviewBitmap(LRESULT* l_result);

  // Captures and returns the screenshot of the window. The caller is
  // responsible to release the returned SkBitmap instance.
  SkBitmap* CaptureWindowImage() const;

  HWND hwnd_;
  scoped_ptr<SkBitmap> capture_bitmap_;

  DISALLOW_COPY_AND_ASSIGN(TaskbarWindowThumbnailerWin);
};

#endif  // CHROME_BROWSER_UI_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_