| OLD | NEW | 
|---|
| 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_window_gtk.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" | 
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" | 
| 10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" | 
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 410 } | 410 } | 
| 411 | 411 | 
| 412 gfx::Size PanelBrowserWindowGtk::ContentSizeFromWindowSize( | 412 gfx::Size PanelBrowserWindowGtk::ContentSizeFromWindowSize( | 
| 413     const gfx::Size& window_size) const { | 413     const gfx::Size& window_size) const { | 
| 414   gfx::Size frame = GetNonClientFrameSize(); | 414   gfx::Size frame = GetNonClientFrameSize(); | 
| 415   return gfx::Size(window_size.width() - frame.width(), | 415   return gfx::Size(window_size.width() - frame.width(), | 
| 416                    window_size.height() - frame.height()); | 416                    window_size.height() - frame.height()); | 
| 417 } | 417 } | 
| 418 | 418 | 
| 419 int PanelBrowserWindowGtk::TitleOnlyHeight() const { | 419 int PanelBrowserWindowGtk::TitleOnlyHeight() const { | 
| 420   return titlebar_widget()->allocation.height; | 420   GtkAllocation allocation; | 
|  | 421   gtk_widget_get_allocation(titlebar_widget(), &allocation); | 
|  | 422   return allocation.height; | 
| 421 } | 423 } | 
| 422 | 424 | 
| 423 void PanelBrowserWindowGtk::StartBoundsAnimation( | 425 void PanelBrowserWindowGtk::StartBoundsAnimation( | 
| 424     const gfx::Rect& from_bounds, const gfx::Rect& to_bounds) { | 426     const gfx::Rect& from_bounds, const gfx::Rect& to_bounds) { | 
| 425   if (bounds_animator_.get() && bounds_animator_->is_animating()) { | 427   if (bounds_animator_.get() && bounds_animator_->is_animating()) { | 
| 426     animation_start_bounds_ = last_animation_progressed_bounds_; | 428     animation_start_bounds_ = last_animation_progressed_bounds_; | 
| 427   } else { | 429   } else { | 
| 428     animation_start_bounds_ = from_bounds; | 430     animation_start_bounds_ = from_bounds; | 
| 429   } | 431   } | 
| 430 | 432 | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 557   } | 559   } | 
| 558 } | 560 } | 
| 559 | 561 | 
| 560 GdkRectangle PanelBrowserWindowGtk::GetTitlebarRectForDrawAttention() const { | 562 GdkRectangle PanelBrowserWindowGtk::GetTitlebarRectForDrawAttention() const { | 
| 561   GdkRectangle rect; | 563   GdkRectangle rect; | 
| 562   rect.x = 0; | 564   rect.x = 0; | 
| 563   rect.y = 0; | 565   rect.y = 0; | 
| 564   // We get the window width and not the titlebar_widget() width because we'd | 566   // We get the window width and not the titlebar_widget() width because we'd | 
| 565   // like for the window borders on either side of the title bar to be the same | 567   // like for the window borders on either side of the title bar to be the same | 
| 566   // color. | 568   // color. | 
| 567   rect.width = GTK_WIDGET(window())->allocation.width; | 569   GtkAllocation window_allocation; | 
| 568   rect.height = titlebar_widget()->allocation.height; | 570   gtk_widget_get_allocation(GTK_WIDGET(window()), &window_allocation); | 
|  | 571   rect.width = window_allocation.width; | 
|  | 572 | 
|  | 573   GtkAllocation titlebar_allocation; | 
|  | 574   gtk_widget_get_allocation(titlebar_widget(), &titlebar_allocation); | 
|  | 575   rect.height = titlebar_allocation.height; | 
| 569 | 576 | 
| 570   return rect; | 577   return rect; | 
| 571 } | 578 } | 
| 572 | 579 | 
| 573 gboolean PanelBrowserWindowGtk::OnTitlebarButtonPressEvent( | 580 gboolean PanelBrowserWindowGtk::OnTitlebarButtonPressEvent( | 
| 574     GtkWidget* widget, GdkEventButton* event) { | 581     GtkWidget* widget, GdkEventButton* event) { | 
| 575   // Early return if animation in progress. | 582   // Early return if animation in progress. | 
| 576   if (IsAnimatingBounds()) | 583   if (IsAnimatingBounds()) | 
| 577     return TRUE; | 584     return TRUE; | 
| 578 | 585 | 
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 769   } | 776   } | 
| 770 } | 777 } | 
| 771 | 778 | 
| 772 bool NativePanelTestingGtk::IsWindowSizeKnown() const { | 779 bool NativePanelTestingGtk::IsWindowSizeKnown() const { | 
| 773   return panel_browser_window_gtk_->window_size_known_; | 780   return panel_browser_window_gtk_->window_size_known_; | 
| 774 } | 781 } | 
| 775 | 782 | 
| 776 bool NativePanelTestingGtk::IsAnimatingBounds() const { | 783 bool NativePanelTestingGtk::IsAnimatingBounds() const { | 
| 777   return panel_browser_window_gtk_->IsAnimatingBounds(); | 784   return panel_browser_window_gtk_->IsAnimatingBounds(); | 
| 778 } | 785 } | 
| OLD | NEW | 
|---|