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/panels/panel_view.h" | 5 #include "chrome/browser/ui/panels/panel_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/panels/panel.h" | 8 #include "chrome/browser/ui/panels/panel.h" |
9 #include "chrome/browser/ui/panels/panel_bounds_animation.h" | 9 #include "chrome/browser/ui/panels/panel_bounds_animation.h" |
10 #include "chrome/browser/ui/panels/panel_frame_view.h" | 10 #include "chrome/browser/ui/panels/panel_frame_view.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 bounds_ = new_bounds; | 184 bounds_ = new_bounds; |
185 | 185 |
186 if (!animate) { | 186 if (!animate) { |
187 // If no animation is in progress, apply bounds change instantly. Otherwise, | 187 // If no animation is in progress, apply bounds change instantly. Otherwise, |
188 // continue the animation with new target bounds. | 188 // continue the animation with new target bounds. |
189 if (!IsAnimatingBounds()) | 189 if (!IsAnimatingBounds()) |
190 GetWidget()->SetBounds(bounds_); | 190 GetWidget()->SetBounds(bounds_); |
191 return; | 191 return; |
192 } | 192 } |
193 | 193 |
194 animation_start_bounds_ = window_->GetWindowScreenBounds(); | 194 animation_start_bounds_ = window_->GetWindowBoundsInScreen(); |
195 | 195 |
196 bounds_animator_.reset(new PanelBoundsAnimation( | 196 bounds_animator_.reset(new PanelBoundsAnimation( |
197 this, panel_.get(), animation_start_bounds_, new_bounds)); | 197 this, panel_.get(), animation_start_bounds_, new_bounds)); |
198 bounds_animator_->Start(); | 198 bounds_animator_->Start(); |
199 } | 199 } |
200 | 200 |
201 void PanelView::AnimationEnded(const ui::Animation* animation) { | 201 void PanelView::AnimationEnded(const ui::Animation* animation) { |
202 panel_->manager()->OnPanelAnimationEnded(panel_.get()); | 202 panel_->manager()->OnPanelAnimationEnded(panel_.get()); |
203 } | 203 } |
204 | 204 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 453 } |
454 | 454 |
455 void PanelView::OnWindowBeginUserBoundsChange() { | 455 void PanelView::OnWindowBeginUserBoundsChange() { |
456 panel_->OnPanelStartUserResizing(); | 456 panel_->OnPanelStartUserResizing(); |
457 } | 457 } |
458 | 458 |
459 void PanelView::OnWindowEndUserBoundsChange() { | 459 void PanelView::OnWindowEndUserBoundsChange() { |
460 panel_->OnPanelEndUserResizing(); | 460 panel_->OnPanelEndUserResizing(); |
461 | 461 |
462 // No need to proceed with post-resizing update when there is no size change. | 462 // No need to proceed with post-resizing update when there is no size change. |
463 gfx::Rect new_bounds = window_->GetWindowScreenBounds(); | 463 gfx::Rect new_bounds = window_->GetWindowBoundsInScreen(); |
464 if (bounds_ == new_bounds) | 464 if (bounds_ == new_bounds) |
465 return; | 465 return; |
466 bounds_ = new_bounds; | 466 bounds_ = new_bounds; |
467 | 467 |
468 panel_->IncreaseMaxSize(bounds_.size()); | 468 panel_->IncreaseMaxSize(bounds_.size()); |
469 panel_->set_full_size(bounds_.size()); | 469 panel_->set_full_size(bounds_.size()); |
470 | 470 |
471 panel_->panel_strip()->RefreshLayout(); | 471 panel_->panel_strip()->RefreshLayout(); |
472 } | 472 } |
473 | 473 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 635 |
636 PanelFrameView* PanelView::GetFrameView() const { | 636 PanelFrameView* PanelView::GetFrameView() const { |
637 return static_cast<PanelFrameView*>(window_->non_client_view()->frame_view()); | 637 return static_cast<PanelFrameView*>(window_->non_client_view()->frame_view()); |
638 } | 638 } |
639 | 639 |
640 bool PanelView::IsAnimatingBounds() const { | 640 bool PanelView::IsAnimatingBounds() const { |
641 return bounds_animator_.get() && bounds_animator_->is_animating(); | 641 return bounds_animator_.get() && bounds_animator_->is_animating(); |
642 } | 642 } |
643 | 643 |
644 bool PanelView::IsWithinResizingArea(const gfx::Point& mouse_location) const { | 644 bool PanelView::IsWithinResizingArea(const gfx::Point& mouse_location) const { |
645 gfx::Rect bounds = window_->GetWindowScreenBounds(); | 645 gfx::Rect bounds = window_->GetWindowBoundsInScreen(); |
646 DCHECK(bounds.Contains(mouse_location)); | 646 DCHECK(bounds.Contains(mouse_location)); |
647 return mouse_location.x() < bounds.x() + kResizeInsideBoundsSize || | 647 return mouse_location.x() < bounds.x() + kResizeInsideBoundsSize || |
648 mouse_location.x() >= bounds.right() - kResizeInsideBoundsSize || | 648 mouse_location.x() >= bounds.right() - kResizeInsideBoundsSize || |
649 mouse_location.y() < bounds.y() + kResizeInsideBoundsSize || | 649 mouse_location.y() < bounds.y() + kResizeInsideBoundsSize || |
650 mouse_location.y() >= bounds.bottom() - kResizeInsideBoundsSize; | 650 mouse_location.y() >= bounds.bottom() - kResizeInsideBoundsSize; |
651 } | 651 } |
652 | 652 |
653 #if defined(OS_WIN) && !defined(USE_ASH) && !defined(USE_AURA) | 653 #if defined(OS_WIN) && !defined(USE_ASH) && !defined(USE_AURA) |
654 void PanelView::UpdateWindowAttribute(int attribute_index, | 654 void PanelView::UpdateWindowAttribute(int attribute_index, |
655 int attribute_value, | 655 int attribute_value, |
(...skipping 21 matching lines...) Expand all Loading... |
677 int height = web_view_->size().height(); | 677 int height = web_view_->size().height(); |
678 SkRegion* region = new SkRegion; | 678 SkRegion* region = new SkRegion; |
679 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); | 679 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); |
680 region->op(width - kResizeInsideBoundsSize, 0, width, height, | 680 region->op(width - kResizeInsideBoundsSize, 0, width, height, |
681 SkRegion::kUnion_Op); | 681 SkRegion::kUnion_Op); |
682 region->op(0, height - kResizeInsideBoundsSize, width, height, | 682 region->op(0, height - kResizeInsideBoundsSize, width, height, |
683 SkRegion::kUnion_Op); | 683 SkRegion::kUnion_Op); |
684 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); | 684 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); |
685 #endif | 685 #endif |
686 } | 686 } |
OLD | NEW |