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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1841 return chrome::ExecuteCommand(browser_.get(), command_id); | 1841 return chrome::ExecuteCommand(browser_.get(), command_id); |
1842 } | 1842 } |
1843 | 1843 |
1844 /////////////////////////////////////////////////////////////////////////////// | 1844 /////////////////////////////////////////////////////////////////////////////// |
1845 // BrowserView, OmniboxPopupModelObserver overrides: | 1845 // BrowserView, OmniboxPopupModelObserver overrides: |
1846 void BrowserView::OnOmniboxPopupShownOrHidden() { | 1846 void BrowserView::OnOmniboxPopupShownOrHidden() { |
1847 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); | 1847 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); |
1848 } | 1848 } |
1849 | 1849 |
1850 /////////////////////////////////////////////////////////////////////////////// | 1850 /////////////////////////////////////////////////////////////////////////////// |
1851 // BrowserView, ScrollEndEffectControllerDelegate overrides: | |
1852 | |
1853 ContentsContainer* BrowserView::GetContentsContainer() { | |
1854 return contents_container_; | |
1855 } | |
1856 | |
1857 gfx::Rect BrowserView::GetFrameBounds() { | |
1858 return frame_->GetWindowBoundsInScreen(); | |
1859 } | |
1860 | |
1861 void BrowserView::SetFrameBounds(gfx::Rect bounds) { | |
1862 frame_->SetBounds(bounds); | |
1863 } | |
1864 | |
1865 /////////////////////////////////////////////////////////////////////////////// | |
1851 // BrowserView, ImmersiveModeController::Delegate overrides: | 1866 // BrowserView, ImmersiveModeController::Delegate overrides: |
1852 | 1867 |
1853 BookmarkBarView* BrowserView::GetBookmarkBar() { | 1868 BookmarkBarView* BrowserView::GetBookmarkBar() { |
1854 return bookmark_bar_view_.get(); | 1869 return bookmark_bar_view_.get(); |
1855 } | 1870 } |
1856 | 1871 |
1857 FullscreenController* BrowserView::GetFullscreenController() { | 1872 FullscreenController* BrowserView::GetFullscreenController() { |
1858 // Cannot be injected into ImmersiveModeController because it is constructed | 1873 // Cannot be injected into ImmersiveModeController because it is constructed |
1859 // after BrowserView. | 1874 // after BrowserView. |
1860 return browser()->fullscreen_controller(); | 1875 return browser()->fullscreen_controller(); |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2569 password_generator, | 2584 password_generator, |
2570 browser_.get(), | 2585 browser_.get(), |
2571 GetWidget()->GetThemeProvider()); | 2586 GetWidget()->GetThemeProvider()); |
2572 | 2587 |
2573 views::BubbleDelegateView::CreateBubble(bubble); | 2588 views::BubbleDelegateView::CreateBubble(bubble); |
2574 bubble->SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); | 2589 bubble->SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); |
2575 bubble->GetWidget()->Show(); | 2590 bubble->GetWidget()->Show(); |
2576 } | 2591 } |
2577 | 2592 |
2578 void BrowserView::OverscrollUpdate(int delta_y) { | 2593 void BrowserView::OverscrollUpdate(int delta_y) { |
2579 if (scroll_end_effect_controller_) | 2594 // TODO(rharrison): Remove the check for fullscreen & maximized once the |
2595 // related cases have been fixed in the effect. | |
sadrul
2013/10/25 18:28:25
Reference the crbug here.
rharrison
2013/11/18 21:52:26
Done.
| |
2596 if (scroll_end_effect_controller_ && !IsFullscreen() && !IsMaximized()) | |
2580 scroll_end_effect_controller_->OverscrollUpdate(delta_y); | 2597 scroll_end_effect_controller_->OverscrollUpdate(delta_y); |
2581 } | 2598 } |
2582 | 2599 |
2583 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 2600 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
2584 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || | 2601 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || |
2585 !bookmark_bar_view_.get() || !bookmark_bar_view_->IsDetached()) { | 2602 !bookmark_bar_view_.get() || !bookmark_bar_view_->IsDetached()) { |
2586 return 0; | 2603 return 0; |
2587 } | 2604 } |
2588 // Don't use bookmark_bar_view_->height() which won't be the final height if | 2605 // Don't use bookmark_bar_view_->height() which won't be the final height if |
2589 // the bookmark bar is animating. | 2606 // the bookmark bar is animating. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2674 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2691 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
2675 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2692 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
2676 LocationBarView::kIconInternalPadding + 1); | 2693 LocationBarView::kIconInternalPadding + 1); |
2677 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2694 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
2678 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2695 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2679 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2696 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2680 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2697 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2681 } | 2698 } |
2682 return top_arrow_height; | 2699 return top_arrow_height; |
2683 } | 2700 } |
OLD | NEW |