| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 } | 604 } |
| 605 | 605 |
| 606 WebContents* BrowserView::GetActiveWebContents() const { | 606 WebContents* BrowserView::GetActiveWebContents() const { |
| 607 return browser_->tab_strip_model()->GetActiveWebContents(); | 607 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 608 } | 608 } |
| 609 | 609 |
| 610 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { | 610 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { |
| 611 return *GetThemeProvider()->GetImageSkiaNamed(GetOTRIconResourceID()); | 611 return *GetThemeProvider()->GetImageSkiaNamed(GetOTRIconResourceID()); |
| 612 } | 612 } |
| 613 | 613 |
| 614 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { | |
| 615 if (window_switcher_button_) { | |
| 616 gfx::Point window_switcher_point(point); | |
| 617 views::View::ConvertPointToTarget(this, window_switcher_button_, | |
| 618 &window_switcher_point); | |
| 619 if (window_switcher_button_->HitTestPoint(window_switcher_point)) | |
| 620 return false; | |
| 621 } | |
| 622 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); | |
| 623 } | |
| 624 | |
| 625 /////////////////////////////////////////////////////////////////////////////// | 614 /////////////////////////////////////////////////////////////////////////////// |
| 626 // BrowserView, BrowserWindow implementation: | 615 // BrowserView, BrowserWindow implementation: |
| 627 | 616 |
| 628 void BrowserView::Show() { | 617 void BrowserView::Show() { |
| 629 // If the window is already visible, just activate it. | 618 // If the window is already visible, just activate it. |
| 630 if (frame_->IsVisible()) { | 619 if (frame_->IsVisible()) { |
| 631 frame_->Activate(); | 620 frame_->Activate(); |
| 632 return; | 621 return; |
| 633 } | 622 } |
| 634 | 623 |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 } | 1779 } |
| 1791 | 1780 |
| 1792 // Empty TabStripModel, it's now safe to allow the Window to be closed. | 1781 // Empty TabStripModel, it's now safe to allow the Window to be closed. |
| 1793 content::NotificationService::current()->Notify( | 1782 content::NotificationService::current()->Notify( |
| 1794 chrome::NOTIFICATION_WINDOW_CLOSED, | 1783 chrome::NOTIFICATION_WINDOW_CLOSED, |
| 1795 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()), | 1784 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()), |
| 1796 content::NotificationService::NoDetails()); | 1785 content::NotificationService::NoDetails()); |
| 1797 return true; | 1786 return true; |
| 1798 } | 1787 } |
| 1799 | 1788 |
| 1800 int BrowserView::NonClientHitTest(const gfx::Point& point) { | 1789 int BrowserView::NonClientHitTest(const gfx::Point& point) const { |
| 1801 return GetBrowserViewLayout()->NonClientHitTest(point); | 1790 return GetBrowserViewLayout()->NonClientHitTest(point); |
| 1802 } | 1791 } |
| 1803 | 1792 |
| 1804 gfx::Size BrowserView::GetMinimumSize() { | 1793 gfx::Size BrowserView::GetMinimumSize() { |
| 1805 return GetBrowserViewLayout()->GetMinimumSize(); | 1794 return GetBrowserViewLayout()->GetMinimumSize(); |
| 1806 } | 1795 } |
| 1807 | 1796 |
| 1808 /////////////////////////////////////////////////////////////////////////////// | 1797 /////////////////////////////////////////////////////////////////////////////// |
| 1809 // BrowserView, views::View overrides: | 1798 // BrowserView, views::View overrides: |
| 1810 | 1799 |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2741 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2730 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2742 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2731 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2743 LocationBarView::kIconInternalPadding + 1); | 2732 LocationBarView::kIconInternalPadding + 1); |
| 2744 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2733 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2745 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2734 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2746 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2735 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2747 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2736 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2748 } | 2737 } |
| 2749 return top_arrow_height; | 2738 return top_arrow_height; |
| 2750 } | 2739 } |
| OLD | NEW |