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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 8775022: Add Panel::SetPanelBoundsInstantly for all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/ui/panels/panel.h" 9 #include "chrome/browser/ui/panels/panel.h"
10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" 10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 bool PanelBrowserView::CanResize() const { 102 bool PanelBrowserView::CanResize() const {
103 return false; 103 return false;
104 } 104 }
105 105
106 bool PanelBrowserView::CanMaximize() const { 106 bool PanelBrowserView::CanMaximize() const {
107 return false; 107 return false;
108 } 108 }
109 109
110 void PanelBrowserView::SetBounds(const gfx::Rect& bounds) { 110 void PanelBrowserView::SetBounds(const gfx::Rect& bounds) {
111 SetBoundsInternal(bounds, true);
112 }
113
114 void PanelBrowserView::SetBoundsInternal(const gfx::Rect& bounds,
115 bool animate) {
111 if (bounds_ == bounds) 116 if (bounds_ == bounds)
112 return; 117 return;
113 bounds_ = bounds; 118 bounds_ = bounds;
114 119
115 // No animation if the panel is being dragged. 120 // No animation if the panel is being dragged.
116 if (mouse_dragging_state_ == DRAGGING_STARTED) { 121 if (!animate || mouse_dragging_state_ == DRAGGING_STARTED) {
117 ::BrowserView::SetBounds(bounds); 122 ::BrowserView::SetBounds(bounds);
118 return; 123 return;
119 } 124 }
120 125
121 animation_start_bounds_ = GetBounds(); 126 animation_start_bounds_ = GetBounds();
122 127
123 if (!bounds_animator_.get()) { 128 if (!bounds_animator_.get()) {
124 bounds_animator_.reset(new ui::SlideAnimation(this)); 129 bounds_animator_.reset(new ui::SlideAnimation(this));
125 bounds_animator_->SetSlideDuration(kSetBoundsAnimationMs); 130 bounds_animator_->SetSlideDuration(kSetBoundsAnimationMs);
126 } 131 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 231
227 void PanelBrowserView::ShowPanelInactive() { 232 void PanelBrowserView::ShowPanelInactive() {
228 ShowInactive(); 233 ShowInactive();
229 } 234 }
230 235
231 gfx::Rect PanelBrowserView::GetPanelBounds() const { 236 gfx::Rect PanelBrowserView::GetPanelBounds() const {
232 return bounds_; 237 return bounds_;
233 } 238 }
234 239
235 void PanelBrowserView::SetPanelBounds(const gfx::Rect& bounds) { 240 void PanelBrowserView::SetPanelBounds(const gfx::Rect& bounds) {
236 SetBounds(bounds); 241 SetBoundsInternal(bounds, true);
242 }
243
244 void PanelBrowserView::SetPanelBoundsInstantly(const gfx::Rect& bounds) {
245 SetBoundsInternal(bounds, false);
237 } 246 }
238 247
239 void PanelBrowserView::ClosePanel() { 248 void PanelBrowserView::ClosePanel() {
240 Close(); 249 Close();
241 } 250 }
242 251
243 void PanelBrowserView::ActivatePanel() { 252 void PanelBrowserView::ActivatePanel() {
244 Activate(); 253 Activate();
245 } 254 }
246 255
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 } 574 }
566 575
567 bool NativePanelTestingWin::IsWindowSizeKnown() const { 576 bool NativePanelTestingWin::IsWindowSizeKnown() const {
568 return true; 577 return true;
569 } 578 }
570 579
571 bool NativePanelTestingWin::IsAnimatingBounds() const { 580 bool NativePanelTestingWin::IsAnimatingBounds() const {
572 return panel_browser_view_->bounds_animator_.get() && 581 return panel_browser_view_->bounds_animator_.get() &&
573 panel_browser_view_->bounds_animator_->is_animating(); 582 panel_browser_view_->bounds_animator_->is_animating();
574 } 583 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698