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 return frame_ ? frame_->GetLayer() : NULL; | |
sky
2013/09/05 21:12:57
Do you really need the NULL checks for frame_ here
rharrison
2013/09/09 20:01:17
Looking at the code again, I don't think so. I was
| |
1846 } | |
1847 | |
1848 ui::Layer* BrowserView::GetWebContentsLayer() { | |
1849 return GetActiveWebContents()->GetView()->GetNativeView()->layer(); | |
1850 } | |
1851 | |
1852 ui::Layer* BrowserView::GetDevToolsLayer() { | |
1853 return devtools_container_->GetWebContents()->GetView()->GetNativeView()-> | |
1854 layer(); | |
1855 } | |
1856 | |
1857 views::View* BrowserView::GetNonClientView() { | |
1858 return frame_ ? frame_->GetContentsView() : NULL; | |
1859 } | |
1860 | |
1861 views::View* BrowserView::GetDownloadView() { | |
1862 return download_shelf_.get(); | |
1863 } | |
1864 | |
1865 int BrowserView::GetDevToolsHeight() { | |
1866 views::View* devtools_view = contents_split_->child_at(1); | |
sky
2013/09/05 21:12:57
Can't you use devtools_container_ directly?
rharrison
2013/09/09 20:01:17
Done.
| |
1867 return devtools_view->visible() ? devtools_view->bounds().height() : 0; | |
1868 } | |
1869 | |
1870 int BrowserView::GetDividerHeight() { | |
1871 return contents_split_->GetDividerSize(); | |
1872 } | |
1873 | |
1874 | |
sky
2013/09/05 21:12:57
nit: only one newline.
rharrison
2013/09/09 20:01:17
Done.
| |
1875 /////////////////////////////////////////////////////////////////////////////// | |
1842 // BrowserView, ImmersiveModeController::Delegate overrides: | 1876 // BrowserView, ImmersiveModeController::Delegate overrides: |
1843 | 1877 |
1844 BookmarkBarView* BrowserView::GetBookmarkBar() { | 1878 BookmarkBarView* BrowserView::GetBookmarkBar() { |
1845 return bookmark_bar_view_.get(); | 1879 return bookmark_bar_view_.get(); |
1846 } | 1880 } |
1847 | 1881 |
1848 FullscreenController* BrowserView::GetFullscreenController() { | 1882 FullscreenController* BrowserView::GetFullscreenController() { |
1849 // Cannot be injected into ImmersiveModeController because it is constructed | 1883 // Cannot be injected into ImmersiveModeController because it is constructed |
1850 // after BrowserView. | 1884 // after BrowserView. |
1851 return browser()->fullscreen_controller(); | 1885 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. | 2700 // 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() - | 2701 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
2668 LocationBarView::kIconInternalPadding + 1); | 2702 LocationBarView::kIconInternalPadding + 1); |
2669 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2703 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
2670 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2704 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2671 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2705 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2672 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2706 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2673 } | 2707 } |
2674 return top_arrow_height; | 2708 return top_arrow_height; |
2675 } | 2709 } |
OLD | NEW |