| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 devtools_window_(NULL), | 408 devtools_window_(NULL), |
| 409 initialized_(false), | 409 initialized_(false), |
| 410 ignore_layout_(true), | 410 ignore_layout_(true), |
| 411 #if defined(OS_WIN) && !defined(USE_AURA) | 411 #if defined(OS_WIN) && !defined(USE_AURA) |
| 412 hung_window_detector_(&hung_plugin_action_), | 412 hung_window_detector_(&hung_plugin_action_), |
| 413 ticker_(0), | 413 ticker_(0), |
| 414 #endif | 414 #endif |
| 415 force_location_bar_focus_(false), | 415 force_location_bar_focus_(false), |
| 416 immersive_mode_controller_(chrome::CreateImmersiveModeController()), | 416 immersive_mode_controller_(chrome::CreateImmersiveModeController()), |
| 417 #if defined(OS_CHROMEOS) | 417 #if defined(OS_CHROMEOS) |
| 418 scroll_end_effect_controller_(ScrollEndEffectController::Create()), | 418 scroll_end_effect_controller_(ScrollEndEffectController::Create(this)), |
| 419 #endif | 419 #endif |
| 420 color_change_listener_(this), | 420 color_change_listener_(this), |
| 421 activate_modal_dialog_factory_(this) { | 421 activate_modal_dialog_factory_(this) { |
| 422 } | 422 } |
| 423 | 423 |
| 424 BrowserView::~BrowserView() { | 424 BrowserView::~BrowserView() { |
| 425 #if defined(USE_ASH) | 425 #if defined(USE_ASH) |
| 426 // Destroy BrowserLauncherItemController early on as it listens to the | 426 // Destroy BrowserLauncherItemController early on as it listens to the |
| 427 // TabstripModel, which is destroyed by the browser. | 427 // TabstripModel, which is destroyed by the browser. |
| 428 launcher_item_controller_.reset(); | 428 launcher_item_controller_.reset(); |
| (...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 return chrome::ExecuteCommand(browser_.get(), command_id); | 1847 return chrome::ExecuteCommand(browser_.get(), command_id); |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 /////////////////////////////////////////////////////////////////////////////// | 1850 /////////////////////////////////////////////////////////////////////////////// |
| 1851 // BrowserView, OmniboxPopupModelObserver overrides: | 1851 // BrowserView, OmniboxPopupModelObserver overrides: |
| 1852 void BrowserView::OnOmniboxPopupShownOrHidden() { | 1852 void BrowserView::OnOmniboxPopupShownOrHidden() { |
| 1853 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); | 1853 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); |
| 1854 } | 1854 } |
| 1855 | 1855 |
| 1856 /////////////////////////////////////////////////////////////////////////////// | 1856 /////////////////////////////////////////////////////////////////////////////// |
| 1857 // BrowserView, ScrollEndEffectControllerDelegate overrides: |
| 1858 |
| 1859 ui::Layer* BrowserView::GetBrowserFrameLayer() { |
| 1860 if (frame_ == NULL) |
| 1861 return NULL; |
| 1862 return frame_->GetLayer(); |
| 1863 } |
| 1864 |
| 1865 ui::Layer* BrowserView::GetWebContentsLayer() { |
| 1866 return GetActiveWebContents()->GetView()->GetNativeView()->layer(); |
| 1867 } |
| 1868 |
| 1869 ui::Layer* BrowserView::GetDevToolsLayer() { |
| 1870 return devtools_container_->GetWebContents()->GetView()->GetNativeView()-> |
| 1871 layer(); |
| 1872 } |
| 1873 |
| 1874 views::View* BrowserView::GetNonClientView() { |
| 1875 if (frame_ == NULL) |
| 1876 return NULL; |
| 1877 return frame_->GetContentsView(); |
| 1878 } |
| 1879 |
| 1880 views::View* BrowserView::GetDownloadView() { |
| 1881 return static_cast<DownloadShelfView*>(GetDownloadShelf()); |
| 1882 } |
| 1883 |
| 1884 int BrowserView::GetDevToolsHeight() { |
| 1885 views::View* devtools_view = contents_split_->child_at(1); |
| 1886 return devtools_view->visible() ? devtools_view->bounds().height() : 0; |
| 1887 } |
| 1888 |
| 1889 int BrowserView::GetDividerHeight() { |
| 1890 return contents_split_->GetDividerSize(); |
| 1891 } |
| 1892 |
| 1893 |
| 1894 /////////////////////////////////////////////////////////////////////////////// |
| 1857 // BrowserView, ImmersiveModeController::Delegate overrides: | 1895 // BrowserView, ImmersiveModeController::Delegate overrides: |
| 1858 | 1896 |
| 1859 BookmarkBarView* BrowserView::GetBookmarkBar() { | 1897 BookmarkBarView* BrowserView::GetBookmarkBar() { |
| 1860 return bookmark_bar_view_.get(); | 1898 return bookmark_bar_view_.get(); |
| 1861 } | 1899 } |
| 1862 | 1900 |
| 1863 FullscreenController* BrowserView::GetFullscreenController() { | 1901 FullscreenController* BrowserView::GetFullscreenController() { |
| 1864 // Cannot be injected into ImmersiveModeController because it is constructed | 1902 // Cannot be injected into ImmersiveModeController because it is constructed |
| 1865 // after BrowserView. | 1903 // after BrowserView. |
| 1866 return browser()->fullscreen_controller(); | 1904 return browser()->fullscreen_controller(); |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2691 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2729 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2692 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2730 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2693 LocationBarView::kIconInternalPadding + 1); | 2731 LocationBarView::kIconInternalPadding + 1); |
| 2694 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2732 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2695 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2733 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2696 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2734 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2697 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2735 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2698 } | 2736 } |
| 2699 return top_arrow_height; | 2737 return top_arrow_height; |
| 2700 } | 2738 } |
| OLD | NEW |