OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_browser_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_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_browser_frame_view.h" | 9 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return false; | 77 return false; |
78 } | 78 } |
79 | 79 |
80 bool PanelBrowserView::CanMaximize() const { | 80 bool PanelBrowserView::CanMaximize() const { |
81 return false; | 81 return false; |
82 } | 82 } |
83 | 83 |
84 void PanelBrowserView::SetBounds(const gfx::Rect& bounds) { | 84 void PanelBrowserView::SetBounds(const gfx::Rect& bounds) { |
85 bounds_ = bounds; | 85 bounds_ = bounds; |
86 | 86 |
87 //// No animation if the panel is being dragged. | 87 // No animation if the panel is being dragged. |
88 if (mouse_dragging_) { | 88 if (mouse_dragging_) { |
89 ::BrowserView::SetBounds(bounds); | 89 ::BrowserView::SetBounds(bounds); |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 animation_start_bounds_ = GetBounds(); | 93 animation_start_bounds_ = GetBounds(); |
94 | 94 |
95 if (!bounds_animator_.get()) { | 95 if (!bounds_animator_.get()) { |
96 bounds_animator_.reset(new ui::SlideAnimation(this)); | 96 bounds_animator_.reset(new ui::SlideAnimation(this)); |
97 bounds_animator_->SetSlideDuration(kSetBoundsAnimationMs); | 97 bounds_animator_->SetSlideDuration(kSetBoundsAnimationMs); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 #if defined(OS_WIN) | 200 #if defined(OS_WIN) |
201 EnsureMouseWatcherStarted(); | 201 EnsureMouseWatcherStarted(); |
202 #endif | 202 #endif |
203 break; | 203 break; |
204 default: | 204 default: |
205 NOTREACHED(); | 205 NOTREACHED(); |
206 height = original_height_; | 206 height = original_height_; |
207 break; | 207 break; |
208 } | 208 } |
209 | 209 |
| 210 int bottom = panel_->manager()->GetBottomPositionForExpansionState( |
| 211 expansion_state); |
210 gfx::Rect bounds = bounds_; | 212 gfx::Rect bounds = bounds_; |
211 bounds.set_y(bounds.y() + bounds.height() - height); | 213 bounds.set_y(bottom - height); |
212 bounds.set_height(height); | 214 bounds.set_height(height); |
213 SetBounds(bounds); | 215 SetBounds(bounds); |
214 } | 216 } |
215 | 217 |
216 bool PanelBrowserView::ShouldBringUpPanelTitlebar(int mouse_x, | 218 bool PanelBrowserView::ShouldBringUpPanelTitlebar(int mouse_x, |
217 int mouse_y) const { | 219 int mouse_y) const { |
218 // We do not want to bring up other minimized panels if the mouse is over the | 220 // We do not want to bring up other minimized panels if the mouse is over the |
219 // panel that pops up the title-bar to attract attention. | 221 // panel that pops up the title-bar to attract attention. |
220 if (is_drawing_attention_) | 222 if (is_drawing_attention_) |
221 return false; | 223 return false; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 panel_browser_view_->mouse_pressed_point_.y() + delta_y)); | 429 panel_browser_view_->mouse_pressed_point_.y() + delta_y)); |
428 } | 430 } |
429 | 431 |
430 void NativePanelTestingWin::CancelDragTitlebar() { | 432 void NativePanelTestingWin::CancelDragTitlebar() { |
431 panel_browser_view_->OnTitlebarMouseCaptureLost(); | 433 panel_browser_view_->OnTitlebarMouseCaptureLost(); |
432 } | 434 } |
433 | 435 |
434 void NativePanelTestingWin::FinishDragTitlebar() { | 436 void NativePanelTestingWin::FinishDragTitlebar() { |
435 panel_browser_view_->OnTitlebarMouseReleased(); | 437 panel_browser_view_->OnTitlebarMouseReleased(); |
436 } | 438 } |
OLD | NEW |