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

Unified Diff: chrome/browser/ui/panels/panel.cc

Issue 9517010: Change panels to be able to turn off autoresize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix assert at the end of RenderWidget::Resize which fixes the tests on OSX. Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel.cc
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index 6863fee73660ce66e4dc835abebf6e1085b75e09..42917cee4bbed3abe6c6fc354d3f4903c6f95387 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -119,14 +119,21 @@ void Panel::SetAutoResizable(bool resizable) {
return;
auto_resizable_ = resizable;
+ WebContents* web_contents = browser()->GetSelectedWebContents();
if (auto_resizable_) {
browser()->tabstrip_model()->AddObserver(this);
- WebContents* web_contents = browser()->GetSelectedWebContents();
if (web_contents)
EnableWebContentsAutoResize(web_contents);
} else {
browser()->tabstrip_model()->RemoveObserver(this);
registrar_.RemoveAll();
+
+ if (web_contents) {
+ // NULL might be returned if the tab has not been added.
+ RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
+ if (render_view_host)
+ render_view_host->DisableAutoResize(restored_size_);
+ }
}
}
@@ -620,12 +627,12 @@ void Panel::ShowKeyboardOverlay(gfx::NativeWindow owning_window) {
}
#endif
-void Panel::UpdatePreferredSize(WebContents* web_contents,
- const gfx::Size& pref_size) {
- if (auto_resizable_) {
- return manager()->OnPreferredWindowSizeChanged(this,
- native_panel_->WindowSizeFromContentSize(pref_size));
- }
+void Panel::ResizeDueToAutoResize(WebContents* web_contents,
+ const gfx::Size& pref_size) {
+ DCHECK(auto_resizable_);
+ return manager()->OnWindowAutoResized(
+ this,
+ native_panel_->WindowSizeFromContentSize(pref_size));
}
void Panel::ShowAvatarBubble(WebContents* web_contents, const gfx::Rect& rect) {
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698