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

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

Issue 8775022: Add Panel::SetPanelBoundsInstantly for all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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.h" 5 #include "chrome/browser/ui/panels/panel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/extensions/extension_prefs.h" 8 #include "chrome/browser/extensions/extension_prefs.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 PanelManager* Panel::manager() const { 61 PanelManager* Panel::manager() const {
62 return PanelManager::GetInstance(); 62 return PanelManager::GetInstance();
63 } 63 }
64 64
65 const Extension* Panel::GetExtension() const { 65 const Extension* Panel::GetExtension() const {
66 return GetExtensionFromBrowser(browser()); 66 return GetExtensionFromBrowser(browser());
67 } 67 }
68 68
69 void Panel::SetPanelBounds(const gfx::Rect& bounds) { 69 void Panel::SetPanelBounds(const gfx::Rect& bounds, bool animate) {
70 if (expansion_state_ == Panel::EXPANDED) 70 if (expansion_state_ == Panel::EXPANDED)
71 restored_size_ = bounds.size(); 71 restored_size_ = bounds.size();
72 72
73 native_panel_->SetPanelBounds(bounds); 73 native_panel_->SetPanelBounds(bounds, animate);
74 74
75 content::NotificationService::current()->Notify( 75 content::NotificationService::current()->Notify(
76 chrome::NOTIFICATION_PANEL_CHANGED_BOUNDS, 76 chrome::NOTIFICATION_PANEL_CHANGED_BOUNDS,
77 content::Source<Panel>(this), 77 content::Source<Panel>(this),
78 content::NotificationService::NoDetails()); 78 content::NotificationService::NoDetails());
79 } 79 }
80 80
81 void Panel::SetAutoResizable(bool resizable) { 81 void Panel::SetAutoResizable(bool resizable) {
82 if (auto_resizable_ == resizable) 82 if (auto_resizable_ == resizable)
83 return; 83 return;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 default: 129 default:
130 NOTREACHED(); 130 NOTREACHED();
131 height = restored_size_.height(); 131 height = restored_size_.height();
132 break; 132 break;
133 } 133 }
134 134
135 int bottom = manager()->GetBottomPositionForExpansionState(expansion_state_); 135 int bottom = manager()->GetBottomPositionForExpansionState(expansion_state_);
136 gfx::Rect bounds = native_panel_->GetPanelBounds(); 136 gfx::Rect bounds = native_panel_->GetPanelBounds();
137 bounds.set_y(bottom - height); 137 bounds.set_y(bottom - height);
138 bounds.set_height(height); 138 bounds.set_height(height);
139 SetPanelBounds(bounds); 139 SetPanelBounds(bounds, true); // use animation.
Dmitry Titov 2011/12/01 19:59:51 We tend to do enums instead of bools if callsites
jianli 2011/12/01 20:24:08 Done.
140 140
141 manager()->OnPanelExpansionStateChanged(old_state, new_state); 141 manager()->OnPanelExpansionStateChanged(old_state, new_state);
142 142
143 // The minimized panel should not get the focus. 143 // The minimized panel should not get the focus.
144 if (expansion_state_ == MINIMIZED) 144 if (expansion_state_ == MINIMIZED)
145 Deactivate(); 145 Deactivate();
146 146
147 content::NotificationService::current()->Notify( 147 content::NotificationService::current()->Notify(
148 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, 148 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
149 content::Source<Panel>(this), 149 content::Source<Panel>(this),
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 if (auto_resizable_) { 635 if (auto_resizable_) {
636 RenderViewHost* render_view_host = GetRenderViewHost(); 636 RenderViewHost* render_view_host = GetRenderViewHost();
637 if (render_view_host) 637 if (render_view_host)
638 RequestRenderViewHostToDisableScrollbars(render_view_host); 638 RequestRenderViewHostToDisableScrollbars(render_view_host);
639 } 639 }
640 } 640 }
641 641
642 void Panel::DestroyBrowser() { 642 void Panel::DestroyBrowser() {
643 native_panel_->DestroyPanelBrowser(); 643 native_panel_->DestroyPanelBrowser();
644 } 644 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698