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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 if (toolbar_bounds.IsEmpty()) | 404 if (toolbar_bounds.IsEmpty()) |
405 return toolbar_bounds; | 405 return toolbar_bounds; |
406 // The apparent toolbar edges are outside the "real" toolbar edges. | 406 // The apparent toolbar edges are outside the "real" toolbar edges. |
407 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); | 407 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); |
408 return toolbar_bounds; | 408 return toolbar_bounds; |
409 } | 409 } |
410 | 410 |
411 gfx::Rect BrowserView::GetClientAreaBounds() const { | 411 gfx::Rect BrowserView::GetClientAreaBounds() const { |
412 gfx::Rect container_bounds = contents_->bounds(); | 412 gfx::Rect container_bounds = contents_->bounds(); |
413 gfx::Point container_origin = container_bounds.origin(); | 413 gfx::Point container_origin = container_bounds.origin(); |
414 ConvertPointToView(this, parent(), &container_origin); | 414 ConvertPointToTarget(this, parent(), &container_origin); |
415 container_bounds.set_origin(container_origin); | 415 container_bounds.set_origin(container_origin); |
416 return container_bounds; | 416 return container_bounds; |
417 } | 417 } |
418 | 418 |
419 gfx::Rect BrowserView::GetFindBarBoundingBox() const { | 419 gfx::Rect BrowserView::GetFindBarBoundingBox() const { |
420 return GetBrowserViewLayout()->GetFindBarBoundingBox(); | 420 return GetBrowserViewLayout()->GetFindBarBoundingBox(); |
421 } | 421 } |
422 | 422 |
423 int BrowserView::GetTabStripHeight() const { | 423 int BrowserView::GetTabStripHeight() const { |
424 // We want to return tabstrip_->height(), but we might be called in the midst | 424 // We want to return tabstrip_->height(), but we might be called in the midst |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 827 |
828 // Inform the InfoBarContainer that the distance to the location icon may have | 828 // Inform the InfoBarContainer that the distance to the location icon may have |
829 // changed. We have to do this after the block above so that the toolbars are | 829 // changed. We have to do this after the block above so that the toolbars are |
830 // laid out correctly for calculating the maximum arrow height below. | 830 // laid out correctly for calculating the maximum arrow height below. |
831 { | 831 { |
832 const LocationIconView* location_icon_view = | 832 const LocationIconView* location_icon_view = |
833 toolbar_->location_bar()->location_icon_view(); | 833 toolbar_->location_bar()->location_icon_view(); |
834 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 834 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
835 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 835 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
836 LocationBarView::kIconInternalPadding + 1); | 836 LocationBarView::kIconInternalPadding + 1); |
837 ConvertPointToView(location_icon_view, this, &icon_bottom); | 837 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
838 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 838 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
839 ConvertPointToView(infobar_container_, this, &infobar_top); | 839 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
840 | 840 |
841 AutoReset<CallState> resetter(&call_state, | 841 AutoReset<CallState> resetter(&call_state, |
842 is_animating ? REENTRANT_FORCE_FAST_RESIZE : REENTRANT); | 842 is_animating ? REENTRANT_FORCE_FAST_RESIZE : REENTRANT); |
843 infobar_container_->SetMaxTopArrowHeight(infobar_top.y() - icon_bottom.y()); | 843 infobar_container_->SetMaxTopArrowHeight(infobar_top.y() - icon_bottom.y()); |
844 } | 844 } |
845 | 845 |
846 // When transitioning from animating to not animating we need to make sure the | 846 // When transitioning from animating to not animating we need to make sure the |
847 // contents_container_ gets layed out. If we don't do this and the bounds | 847 // contents_container_ gets layed out. If we don't do this and the bounds |
848 // haven't changed contents_container_ won't get a Layout out and we'll end up | 848 // haven't changed contents_container_ won't get a Layout out and we'll end up |
849 // with a gray rect because the clip wasn't updated. Note that a reentrant | 849 // with a gray rect because the clip wasn't updated. Note that a reentrant |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 | 1847 |
1848 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { | 1848 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { |
1849 ToolbarSizeChanged(is_animating); | 1849 ToolbarSizeChanged(is_animating); |
1850 } | 1850 } |
1851 | 1851 |
1852 bool BrowserView::DrawInfoBarArrows(int* x) const { | 1852 bool BrowserView::DrawInfoBarArrows(int* x) const { |
1853 if (x) { | 1853 if (x) { |
1854 const LocationIconView* location_icon_view = | 1854 const LocationIconView* location_icon_view = |
1855 toolbar_->location_bar()->location_icon_view(); | 1855 toolbar_->location_bar()->location_icon_view(); |
1856 gfx::Point icon_center(location_icon_view->GetImageBounds().CenterPoint()); | 1856 gfx::Point icon_center(location_icon_view->GetImageBounds().CenterPoint()); |
1857 ConvertPointToView(location_icon_view, this, &icon_center); | 1857 ConvertPointToTarget(location_icon_view, this, &icon_center); |
1858 *x = icon_center.x(); | 1858 *x = icon_center.x(); |
1859 } | 1859 } |
1860 return true; | 1860 return true; |
1861 } | 1861 } |
1862 | 1862 |
1863 bool BrowserView::SplitHandleMoved(views::SingleSplitView* sender) { | 1863 bool BrowserView::SplitHandleMoved(views::SingleSplitView* sender) { |
1864 for (int i = 0; i < sender->child_count(); ++i) | 1864 for (int i = 0; i < sender->child_count(); ++i) |
1865 sender->child_at(i)->InvalidateLayout(); | 1865 sender->child_at(i)->InvalidateLayout(); |
1866 SchedulePaint(); | 1866 SchedulePaint(); |
1867 Layout(); | 1867 Layout(); |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 | 2603 |
2604 Browser* modal_browser = | 2604 Browser* modal_browser = |
2605 browser::FindBrowserWithWebContents(active_dialog->web_contents()); | 2605 browser::FindBrowserWithWebContents(active_dialog->web_contents()); |
2606 if (modal_browser && (browser_ != modal_browser)) { | 2606 if (modal_browser && (browser_ != modal_browser)) { |
2607 modal_browser->window()->FlashFrame(true); | 2607 modal_browser->window()->FlashFrame(true); |
2608 modal_browser->window()->Activate(); | 2608 modal_browser->window()->Activate(); |
2609 } | 2609 } |
2610 | 2610 |
2611 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); | 2611 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); |
2612 } | 2612 } |
OLD | NEW |