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

Unified Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 10408047: Fix bug 105043: Panels [WIN]: For minimize panels, taskbar hover preview show the 4-pixel represent… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/panel_browser_view.cc
diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc
index 96f060e9e1e4a8b4f5a80493a3995376585fe937..eceeb6af9a16d9623040b2672895e34227fc4034 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -13,16 +13,23 @@
#include "chrome/browser/ui/panels/panel_browser_frame_view.h"
#include "chrome/browser/ui/panels/panel_manager.h"
#include "chrome/browser/ui/panels/panel_strip.h"
+#include "chrome/browser/ui/panels/taskbar_window_thumbnailer_win.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_service.h"
#include "grit/chromium_strings.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/canvas.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/widget/widget.h"
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
+
using content::NativeWebKeyboardEvent;
+
using content::WebContents;
NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel,
@@ -42,6 +49,7 @@ PanelBrowserView::PanelBrowserView(Browser* browser, Panel* panel,
mouse_pressed_(false),
mouse_dragging_state_(NO_DRAGGING),
is_drawing_attention_(false),
+ force_to_paint_as_inactive_(false),
old_focused_view_(NULL) {
}
@@ -519,7 +527,6 @@ void PanelBrowserView::UpdatePanelMinimizeRestoreButtonVisibility() {
GetFrameView()->UpdateTitleBarMinimizeRestoreButtonVisibility();
}
-
#if defined(OS_WIN) && !defined(USE_AURA)
void PanelBrowserView::UpdateWindowAttribute(int attribute_index,
int attribute_value,
@@ -536,6 +543,42 @@ void PanelBrowserView::UpdateWindowAttribute(int attribute_index,
}
#endif
+void PanelBrowserView::PanelExpansionStateChanging(
+ Panel::ExpansionState old_state, Panel::ExpansionState new_state) {
+#if defined(OS_WIN) && !defined(USE_AURA)
Ben Goodger (Google) 2012/05/22 23:05:48 USE_ASH
jianli 2012/05/22 23:34:04 Done.
+ // Live preview is only available since Windows 7.
+ if (base::win::GetVersion() < base::win::VERSION_WIN7)
+ return;
+
+ bool is_minimized = old_state != Panel::EXPANDED;
+ bool will_be_minimized = new_state != Panel::EXPANDED;
+ if (is_minimized == will_be_minimized)
+ return;
+
+ HWND native_window = GetNativeHandle();
+
+ // Cache the image at this point.
+ if (will_be_minimized) {
+ // If the panel is still active (we will deactivate the minimizd panel at
+ // later time), we need to paint it immediately as inactive so that we can
+ // take a snapshot of inactive panel.
+ if (focused_) {
+ force_to_paint_as_inactive_ = true;
+ ::RedrawWindow(native_window, NULL, NULL,
+ RDW_NOCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+
+ thumbnail_subclass_.reset(new ui::HWNDSubclass(native_window));
+ thumbnail_subclass_->SetFilter(
+ new TaskbarWindowThumbnailerWin(native_window));
+ } else {
+ force_to_paint_as_inactive_ = false;
+ thumbnail_subclass_.reset();
+ }
+
+#endif
+}
+
// NativePanelTesting implementation.
class NativePanelTestingWin : public NativePanelTesting {
public:

Powered by Google App Engine
This is Rietveld 408576698