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

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 win_aura 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 34f72067d959738a600bf16a86f946c843cb929d..8a6dc8096dcae7bfa47d5b74fb3e57c60d0dc4ba 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -20,10 +20,16 @@
#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) && !defined(USE_ASH) && !defined(USE_AURA)
+#include "base/win/windows_version.h"
+#include "chrome/browser/ui/panels/taskbar_window_thumbnailer_win.h"
+#endif
+
using content::NativeWebKeyboardEvent;
using content::WebContents;
@@ -44,7 +50,13 @@ PanelBrowserView::PanelBrowserView(Browser* browser, Panel* panel,
mouse_pressed_(false),
mouse_dragging_state_(NO_DRAGGING),
is_drawing_attention_(false),
+ force_to_paint_as_inactive_(false),
+#if defined(OS_WIN) && !defined(USE_ASH) && !defined(USE_AURA)
+ old_focused_view_(NULL),
+ thumbnailer_(NULL) {
+#else
old_focused_view_(NULL) {
+#endif
}
PanelBrowserView::~PanelBrowserView() {
@@ -521,7 +533,6 @@ void PanelBrowserView::UpdatePanelMinimizeRestoreButtonVisibility() {
GetFrameView()->UpdateTitleBarMinimizeRestoreButtonVisibility();
}
-
#if defined(OS_WIN) && !defined(USE_AURA)
void PanelBrowserView::UpdateWindowAttribute(int attribute_index,
int attribute_value,
@@ -538,6 +549,47 @@ void PanelBrowserView::UpdateWindowAttribute(int attribute_index,
}
#endif
+void PanelBrowserView::PanelExpansionStateChanging(
+ Panel::ExpansionState old_state, Panel::ExpansionState new_state) {
+#if defined(OS_WIN) && !defined(USE_ASH) && !defined(USE_AURA)
+ // 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();
+
+ if (!thumbnail_subclass_.get()) {
+ thumbnail_subclass_.reset(new ui::HWNDSubclass(native_window));
+ // thumbnailer_ is owned by thumbnail_subclass_.
+ thumbnailer_ = new TaskbarWindowThumbnailerWin(native_window);
+ thumbnail_subclass_->SetFilter(thumbnailer_);
+ }
+
+ // 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);
+ }
+
+ thumbnailer_->Start();
+ } else {
+ force_to_paint_as_inactive_ = false;
+ thumbnailer_->Stop();
+ }
+
+#endif
+}
+
// NativePanelTesting implementation.
class NativePanelTestingWin : public NativePanelTesting {
public:
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.h ('k') | chrome/browser/ui/panels/panel_browser_window_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698