| OLD | NEW |
| 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 "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 499 |
| 500 bool Panel::IsFullscreen() const { | 500 bool Panel::IsFullscreen() const { |
| 501 return false; | 501 return false; |
| 502 } | 502 } |
| 503 | 503 |
| 504 void Panel::OnContentsAutoResized(const gfx::Size& new_content_size) { | 504 void Panel::OnContentsAutoResized(const gfx::Size& new_content_size) { |
| 505 DCHECK(auto_resizable_); | 505 DCHECK(auto_resizable_); |
| 506 if (!panel_strip_) | 506 if (!panel_strip_) |
| 507 return; | 507 return; |
| 508 | 508 |
| 509 panel_strip_->ResizePanelWindow( | 509 gfx::Size new_window_size = |
| 510 this, | 510 native_panel_->WindowSizeFromContentSize(new_content_size); |
| 511 native_panel_->WindowSizeFromContentSize(new_content_size)); | 511 |
| 512 // Ignore content auto resizes until window frame size is known. |
| 513 // This reduces extra resizes when panel is first shown. |
| 514 // After window frame size is known, it will trigger another content |
| 515 // auto resize. |
| 516 if (new_content_size == new_window_size) |
| 517 return; |
| 518 |
| 519 panel_strip_->ResizePanelWindow(this, new_window_size); |
| 512 } | 520 } |
| 513 | 521 |
| 514 void Panel::OnWindowResizedByMouse(const gfx::Rect& new_bounds) { | 522 void Panel::OnWindowResizedByMouse(const gfx::Rect& new_bounds) { |
| 515 if (panel_strip_) | 523 if (panel_strip_) |
| 516 panel_strip_->OnPanelResizedByMouse(this, new_bounds); | 524 panel_strip_->OnPanelResizedByMouse(this, new_bounds); |
| 517 } | 525 } |
| 518 | 526 |
| 519 void Panel::EnableWebContentsAutoResize(content::WebContents* web_contents) { | 527 void Panel::EnableWebContentsAutoResize(content::WebContents* web_contents) { |
| 520 DCHECK(web_contents); | 528 DCHECK(web_contents); |
| 521 ConfigureAutoResize(web_contents); | 529 ConfigureAutoResize(web_contents); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 | 768 |
| 761 void Panel::LoadingStateChanged(bool is_loading) { | 769 void Panel::LoadingStateChanged(bool is_loading) { |
| 762 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); | 770 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); |
| 763 native_panel_->UpdatePanelLoadingAnimations(is_loading); | 771 native_panel_->UpdatePanelLoadingAnimations(is_loading); |
| 764 UpdateTitleBar(); | 772 UpdateTitleBar(); |
| 765 } | 773 } |
| 766 | 774 |
| 767 void Panel::WebContentsFocused(content::WebContents* contents) { | 775 void Panel::WebContentsFocused(content::WebContents* contents) { |
| 768 native_panel_->PanelWebContentsFocused(contents); | 776 native_panel_->PanelWebContentsFocused(contents); |
| 769 } | 777 } |
| OLD | NEW |