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

Side by Side 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: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 auto_resizable_ = resizable; 120 auto_resizable_ = resizable;
121 if (auto_resizable_) { 121 if (auto_resizable_) {
122 browser()->tabstrip_model()->AddObserver(this); 122 browser()->tabstrip_model()->AddObserver(this);
123 WebContents* web_contents = browser()->GetSelectedWebContents(); 123 WebContents* web_contents = browser()->GetSelectedWebContents();
124 if (web_contents) 124 if (web_contents)
125 EnableWebContentsAutoResize(web_contents); 125 EnableWebContentsAutoResize(web_contents);
126 } else { 126 } else {
127 browser()->tabstrip_model()->RemoveObserver(this); 127 browser()->tabstrip_model()->RemoveObserver(this);
128 registrar_.RemoveAll(); 128 registrar_.RemoveAll();
129
130 WebContents* web_contents = browser()->GetSelectedWebContents();
jennb 2012/02/28 23:45:15 This is repeated in the if-section too. Move befor
levin 2012/02/29 00:04:43 Done.
131 if (web_contents) {
132 // NULL might be returned if the tab has not been added.
133 RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
134 if (render_view_host)
135 render_view_host->DisableAutoResize(restored_size_);
136 }
129 } 137 }
130 } 138 }
131 139
132 void Panel::SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size) { 140 void Panel::SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size) {
133 if (min_size == min_size_ && max_size == max_size_) 141 if (min_size == min_size_ && max_size == max_size_)
134 return; 142 return;
135 143
136 DCHECK(min_size.width() <= max_size.width()); 144 DCHECK(min_size.width() <= max_size.width());
137 DCHECK(min_size.height() <= max_size.height()); 145 DCHECK(min_size.height() <= max_size.height());
138 min_size_ = min_size; 146 min_size_ = min_size;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 NOTIMPLEMENTED(); 626 NOTIMPLEMENTED();
619 } 627 }
620 628
621 void Panel::ShowKeyboardOverlay(gfx::NativeWindow owning_window) { 629 void Panel::ShowKeyboardOverlay(gfx::NativeWindow owning_window) {
622 NOTIMPLEMENTED(); 630 NOTIMPLEMENTED();
623 } 631 }
624 #endif 632 #endif
625 633
626 void Panel::UpdatePreferredSize(WebContents* web_contents, 634 void Panel::UpdatePreferredSize(WebContents* web_contents,
627 const gfx::Size& pref_size) { 635 const gfx::Size& pref_size) {
628 if (auto_resizable_) { 636 DCHECK(auto_resizable_);
629 return manager()->OnPreferredWindowSizeChanged(this, 637 return manager()->OnPreferredWindowSizeChanged(this,
630 native_panel_->WindowSizeFromContentSize(pref_size)); 638 native_panel_->WindowSizeFromContentSize(pref_size));
631 }
632 } 639 }
633 640
634 void Panel::ShowAvatarBubble(WebContents* web_contents, const gfx::Rect& rect) { 641 void Panel::ShowAvatarBubble(WebContents* web_contents, const gfx::Rect& rect) {
635 // Panels will never show a new tab page so this should never be called. 642 // Panels will never show a new tab page so this should never be called.
636 NOTREACHED(); 643 NOTREACHED();
637 } 644 }
638 645
639 void Panel::ShowAvatarBubbleFromAvatarButton() { 646 void Panel::ShowAvatarBubbleFromAvatarButton() {
640 // Panels will never show an avatar button so this should never be called. 647 // Panels will never show an avatar button so this should never be called.
641 NOTREACHED(); 648 NOTREACHED();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 native_panel_->ContentSizeFromWindowSize(max_size_)); 691 native_panel_->ContentSizeFromWindowSize(max_size_));
685 } 692 }
686 693
687 void Panel::OnWindowSizeAvailable() { 694 void Panel::OnWindowSizeAvailable() {
688 ConfigureAutoResize(browser()->GetSelectedWebContents()); 695 ConfigureAutoResize(browser()->GetSelectedWebContents());
689 } 696 }
690 697
691 void Panel::DestroyBrowser() { 698 void Panel::DestroyBrowser() {
692 native_panel_->DestroyPanelBrowser(); 699 native_panel_->DestroyPanelBrowser();
693 } 700 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | chrome/browser/ui/panels/panel_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698