| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 devtools_window_(NULL), | 407 devtools_window_(NULL), |
| 408 initialized_(false), | 408 initialized_(false), |
| 409 ignore_layout_(true), | 409 ignore_layout_(true), |
| 410 #if defined(OS_WIN) && !defined(USE_AURA) | 410 #if defined(OS_WIN) && !defined(USE_AURA) |
| 411 hung_window_detector_(&hung_plugin_action_), | 411 hung_window_detector_(&hung_plugin_action_), |
| 412 ticker_(0), | 412 ticker_(0), |
| 413 #endif | 413 #endif |
| 414 force_location_bar_focus_(false), | 414 force_location_bar_focus_(false), |
| 415 immersive_mode_controller_(chrome::CreateImmersiveModeController()), | 415 immersive_mode_controller_(chrome::CreateImmersiveModeController()), |
| 416 #if defined(OS_CHROMEOS) | 416 #if defined(OS_CHROMEOS) |
| 417 scroll_end_effect_controller_(ScrollEndEffectController::Create()), | 417 scroll_end_effect_controller_(ScrollEndEffectController::Create(this)), |
| 418 #endif | 418 #endif |
| 419 color_change_listener_(this), | 419 color_change_listener_(this), |
| 420 activate_modal_dialog_factory_(this) { | 420 activate_modal_dialog_factory_(this) { |
| 421 } | 421 } |
| 422 | 422 |
| 423 BrowserView::~BrowserView() { | 423 BrowserView::~BrowserView() { |
| 424 // Immersive mode may need to reparent views before they are removed/deleted. | 424 // Immersive mode may need to reparent views before they are removed/deleted. |
| 425 immersive_mode_controller_.reset(); | 425 immersive_mode_controller_.reset(); |
| 426 | 426 |
| 427 browser_->tab_strip_model()->RemoveObserver(this); | 427 browser_->tab_strip_model()->RemoveObserver(this); |
| (...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 return chrome::ExecuteCommand(browser_.get(), command_id); | 1832 return chrome::ExecuteCommand(browser_.get(), command_id); |
| 1833 } | 1833 } |
| 1834 | 1834 |
| 1835 /////////////////////////////////////////////////////////////////////////////// | 1835 /////////////////////////////////////////////////////////////////////////////// |
| 1836 // BrowserView, OmniboxPopupModelObserver overrides: | 1836 // BrowserView, OmniboxPopupModelObserver overrides: |
| 1837 void BrowserView::OnOmniboxPopupShownOrHidden() { | 1837 void BrowserView::OnOmniboxPopupShownOrHidden() { |
| 1838 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); | 1838 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 /////////////////////////////////////////////////////////////////////////////// | 1841 /////////////////////////////////////////////////////////////////////////////// |
| 1842 // BrowserView, ScrollEndEffectControllerDelegate overrides: |
| 1843 |
| 1844 ui::Layer* BrowserView::GetBrowserFrameLayer() { |
| 1845 if (frame_ == NULL) |
| 1846 return NULL; |
| 1847 return frame_->GetLayer(); |
| 1848 } |
| 1849 |
| 1850 ui::Layer* BrowserView::GetWebContentsLayer() { |
| 1851 return GetActiveWebContents()->GetView()->GetNativeView()->layer(); |
| 1852 } |
| 1853 |
| 1854 ui::Layer* BrowserView::GetDevToolsLayer() { |
| 1855 return devtools_container_->GetWebContents()->GetView()->GetNativeView()-> |
| 1856 layer(); |
| 1857 } |
| 1858 |
| 1859 views::View* BrowserView::GetNonClientView() { |
| 1860 if (frame_ == NULL) |
| 1861 return NULL; |
| 1862 return frame_->GetContentsView(); |
| 1863 } |
| 1864 |
| 1865 views::View* BrowserView::GetDownloadView() { |
| 1866 return static_cast<DownloadShelfView*>(GetDownloadShelf()); |
| 1867 } |
| 1868 |
| 1869 int BrowserView::GetDevToolsHeight() { |
| 1870 views::View* devtools_view = contents_split_->child_at(1); |
| 1871 return devtools_view->visible() ? devtools_view->bounds().height() : 0; |
| 1872 } |
| 1873 |
| 1874 int BrowserView::GetDividerHeight() { |
| 1875 return contents_split_->GetDividerSize(); |
| 1876 } |
| 1877 |
| 1878 |
| 1879 /////////////////////////////////////////////////////////////////////////////// |
| 1842 // BrowserView, ImmersiveModeController::Delegate overrides: | 1880 // BrowserView, ImmersiveModeController::Delegate overrides: |
| 1843 | 1881 |
| 1844 BookmarkBarView* BrowserView::GetBookmarkBar() { | 1882 BookmarkBarView* BrowserView::GetBookmarkBar() { |
| 1845 return bookmark_bar_view_.get(); | 1883 return bookmark_bar_view_.get(); |
| 1846 } | 1884 } |
| 1847 | 1885 |
| 1848 FullscreenController* BrowserView::GetFullscreenController() { | 1886 FullscreenController* BrowserView::GetFullscreenController() { |
| 1849 // Cannot be injected into ImmersiveModeController because it is constructed | 1887 // Cannot be injected into ImmersiveModeController because it is constructed |
| 1850 // after BrowserView. | 1888 // after BrowserView. |
| 1851 return browser()->fullscreen_controller(); | 1889 return browser()->fullscreen_controller(); |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2704 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2667 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2705 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2668 LocationBarView::kIconInternalPadding + 1); | 2706 LocationBarView::kIconInternalPadding + 1); |
| 2669 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2707 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2670 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2708 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2671 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2709 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2672 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2710 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2673 } | 2711 } |
| 2674 return top_arrow_height; | 2712 return top_arrow_height; |
| 2675 } | 2713 } |
| OLD | NEW |