Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_VIEWS_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/base/win/hwnd_subclass.h" | 10 #include "ui/base/win/hwnd_subclass.h" |
| 11 | 11 |
| 12 class SkBitmap; | 12 class SkBitmap; |
| 13 | 13 |
| 14 class TaskbarWindowThumbnailerDelegateWin { | |
| 15 public: | |
| 16 // Returns the handle list of all windows that are used to construct the | |
|
Dmitry Titov
2013/05/29 21:12:54
"handle list of all windows" -> "list of handles f
| |
| 17 // thumbnail. If empty list is returned, the snapshot of current window | |
| 18 // is used. | |
| 19 virtual std::vector<HWND> GetSnapshotWindowHandles() const = 0; | |
| 20 }; | |
| 21 | |
| 14 // Provides the custom thumbnail and live preview for the window that appears | 22 // Provides the custom thumbnail and live preview for the window that appears |
| 15 // in the taskbar (Windows 7 and later). | 23 // in the taskbar (Windows 7 and later). |
| 16 class TaskbarWindowThumbnailerWin : public ui::HWNDMessageFilter { | 24 class TaskbarWindowThumbnailerWin : public ui::HWNDMessageFilter { |
| 17 public: | 25 public: |
| 18 explicit TaskbarWindowThumbnailerWin(HWND hwnd); | 26 TaskbarWindowThumbnailerWin(HWND hwnd, |
| 27 TaskbarWindowThumbnailerDelegateWin* delegate); | |
| 19 virtual ~TaskbarWindowThumbnailerWin(); | 28 virtual ~TaskbarWindowThumbnailerWin(); |
| 20 | 29 |
| 21 // Use the snapshots from all the windows in |snapshot_hwnds| to construct | 30 // Starts using the custom snapshot for live preview. The snapshot is only |
| 22 // the thumbnail. If |snapshot_hwnds| is empty, use the snapshot of current | 31 // captured once when the system requests it. |
|
Dmitry Titov
2013/05/29 21:12:54
Lets add "... when system requests it, so the upda
| |
| 23 // window. | 32 void Start(); |
| 24 void Start(const std::vector<HWND>& snapshot_hwnds); | 33 |
| 34 // Stops providing the custom snapshot for live preview. | |
| 25 void Stop(); | 35 void Stop(); |
| 26 | 36 |
| 37 // Captures the snapshot now instead of when the system requests it. | |
| 38 void CaptureSnapshot(); | |
| 39 | |
| 40 // Invalidates the snapshot such that a fresh copy can be obtained next time | |
| 41 // when the system requests it. | |
| 42 void InvalidateSnapshot(); | |
| 43 | |
| 27 private: | 44 private: |
| 28 // Overridden from ui::HWNDMessageFilter: | 45 // Overridden from ui::HWNDMessageFilter: |
| 29 virtual bool FilterMessage(HWND hwnd, | 46 virtual bool FilterMessage(HWND hwnd, |
| 30 UINT message, | 47 UINT message, |
| 31 WPARAM w_param, | 48 WPARAM w_param, |
| 32 LPARAM l_param, | 49 LPARAM l_param, |
| 33 LRESULT* l_result) OVERRIDE; | 50 LRESULT* l_result) OVERRIDE; |
| 34 | 51 |
| 35 // Message handlers. | 52 // Message handlers. |
| 36 bool OnDwmSendIconicThumbnail( | 53 bool OnDwmSendIconicThumbnail(int width, int height, LRESULT* l_result); |
| 37 int width, int height, LRESULT* l_result); | |
| 38 bool OnDwmSendIconicLivePreviewBitmap(LRESULT* l_result); | 54 bool OnDwmSendIconicLivePreviewBitmap(LRESULT* l_result); |
| 39 | 55 |
| 40 // Captures and returns the screenshot of the window. The caller is | 56 // Captures and returns the screenshot of the window. The caller is |
| 41 // responsible to release the returned SkBitmap instance. | 57 // responsible to release the returned SkBitmap instance. |
| 42 SkBitmap* CaptureWindowImage() const; | 58 SkBitmap* CaptureWindowImage() const; |
| 43 | 59 |
| 44 HWND hwnd_; | 60 HWND hwnd_; |
| 45 std::vector<HWND> snapshot_hwnds_; | 61 TaskbarWindowThumbnailerDelegateWin* delegate_; // Weak, owns us. |
| 46 scoped_ptr<SkBitmap> capture_bitmap_; | 62 scoped_ptr<SkBitmap> capture_bitmap_; |
| 47 | 63 |
| 48 DISALLOW_COPY_AND_ASSIGN(TaskbarWindowThumbnailerWin); | 64 DISALLOW_COPY_AND_ASSIGN(TaskbarWindowThumbnailerWin); |
| 49 }; | 65 }; |
| 50 | 66 |
| 51 #endif // CHROME_BROWSER_UI_VIEWS_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_ | 67 #endif // CHROME_BROWSER_UI_VIEWS_PANELS_TASKBAR_WINDOW_THUMBNAILER_WIN_H_ |
| OLD | NEW |