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 #include "chrome/browser/ui/views/panels/panel_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_view.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 GetFrameView()->SetWindowCornerStyle(corner_style); | 597 GetFrameView()->SetWindowCornerStyle(corner_style); |
598 } | 598 } |
599 | 599 |
600 void PanelView::PanelExpansionStateChanging(Panel::ExpansionState old_state, | 600 void PanelView::PanelExpansionStateChanging(Panel::ExpansionState old_state, |
601 Panel::ExpansionState new_state) { | 601 Panel::ExpansionState new_state) { |
602 #if defined(OS_WIN) | 602 #if defined(OS_WIN) |
603 // Live preview is only available since Windows 7. | 603 // Live preview is only available since Windows 7. |
604 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 604 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
605 return; | 605 return; |
606 | 606 |
| 607 if (panel_->collection()->type() != PanelCollection::DOCKED) |
| 608 return; |
| 609 |
607 bool is_minimized = old_state != Panel::EXPANDED; | 610 bool is_minimized = old_state != Panel::EXPANDED; |
608 bool will_be_minimized = new_state != Panel::EXPANDED; | 611 bool will_be_minimized = new_state != Panel::EXPANDED; |
609 if (is_minimized == will_be_minimized) | 612 if (is_minimized == will_be_minimized) |
610 return; | 613 return; |
611 | 614 |
612 HWND native_window = views::HWNDForWidget(window_); | 615 HWND native_window = views::HWNDForWidget(window_); |
613 | 616 |
614 if (!thumbnailer_.get()) { | 617 if (!thumbnailer_.get()) { |
615 DCHECK(native_window); | 618 DCHECK(native_window); |
616 thumbnailer_.reset(new TaskbarWindowThumbnailerWin(native_window)); | 619 thumbnailer_.reset(new TaskbarWindowThumbnailerWin(native_window, NULL)); |
617 ui::HWNDSubclass::AddFilterToTarget(native_window, thumbnailer_.get()); | |
618 } | 620 } |
619 | 621 |
620 // Cache the image at this point. | 622 // Cache the image at this point. |
621 if (will_be_minimized) { | 623 if (will_be_minimized) { |
622 // If the panel is still active (we will deactivate the minimizd panel at | 624 // If the panel is still active (we will deactivate the minimizd panel at |
623 // later time), we need to paint it immediately as inactive so that we can | 625 // later time), we need to paint it immediately as inactive so that we can |
624 // take a snapshot of inactive panel. | 626 // take a snapshot of inactive panel. |
625 if (focused_) { | 627 if (focused_) { |
626 force_to_paint_as_inactive_ = true; | 628 force_to_paint_as_inactive_ = true; |
627 ::RedrawWindow(native_window, NULL, NULL, | 629 ::RedrawWindow(native_window, NULL, NULL, |
628 RDW_NOCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW); | 630 RDW_NOCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW); |
629 } | 631 } |
630 | 632 |
631 std::vector<HWND> snapshot_hwnds; | 633 // Start the thumbnailer and capture the snapshot now. |
632 thumbnailer_->Start(snapshot_hwnds); | 634 thumbnailer_->Start(); |
| 635 thumbnailer_->CaptureSnapshot(); |
633 } else { | 636 } else { |
634 force_to_paint_as_inactive_ = false; | 637 force_to_paint_as_inactive_ = false; |
635 thumbnailer_->Stop(); | 638 thumbnailer_->Stop(); |
636 } | 639 } |
637 | 640 |
638 #endif | 641 #endif |
639 } | 642 } |
640 | 643 |
641 gfx::Size PanelView::WindowSizeFromContentSize( | 644 gfx::Size PanelView::WindowSizeFromContentSize( |
642 const gfx::Size& content_size) const { | 645 const gfx::Size& content_size) const { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 DCHECK(thickness_for_mouse_resizing > 0); | 1114 DCHECK(thickness_for_mouse_resizing > 0); |
1112 SkRegion* region = new SkRegion; | 1115 SkRegion* region = new SkRegion; |
1113 region->op(0, 0, thickness_for_mouse_resizing, height, SkRegion::kUnion_Op); | 1116 region->op(0, 0, thickness_for_mouse_resizing, height, SkRegion::kUnion_Op); |
1114 region->op(width - thickness_for_mouse_resizing, 0, width, height, | 1117 region->op(width - thickness_for_mouse_resizing, 0, width, height, |
1115 SkRegion::kUnion_Op); | 1118 SkRegion::kUnion_Op); |
1116 region->op(0, height - thickness_for_mouse_resizing, width, height, | 1119 region->op(0, height - thickness_for_mouse_resizing, width, height, |
1117 SkRegion::kUnion_Op); | 1120 SkRegion::kUnion_Op); |
1118 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); | 1121 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); |
1119 #endif | 1122 #endif |
1120 } | 1123 } |
OLD | NEW |