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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 devtools_window_(NULL), | 405 devtools_window_(NULL), |
406 initialized_(false), | 406 initialized_(false), |
407 in_process_fullscreen_(false), | 407 in_process_fullscreen_(false), |
408 #if defined(OS_WIN) && !defined(USE_AURA) | 408 #if defined(OS_WIN) && !defined(USE_AURA) |
409 hung_window_detector_(&hung_plugin_action_), | 409 hung_window_detector_(&hung_plugin_action_), |
410 ticker_(0), | 410 ticker_(0), |
411 #endif | 411 #endif |
412 force_location_bar_focus_(false), | 412 force_location_bar_focus_(false), |
413 immersive_mode_controller_(chrome::CreateImmersiveModeController()), | 413 immersive_mode_controller_(chrome::CreateImmersiveModeController()), |
414 #if defined(OS_CHROMEOS) | 414 #if defined(OS_CHROMEOS) |
415 scroll_end_effect_controller_(ScrollEndEffectController::Create()), | 415 scroll_end_effect_controller_(ScrollEndEffectController::Create(this)), |
416 #endif | 416 #endif |
417 color_change_listener_(this), | 417 color_change_listener_(this), |
418 activate_modal_dialog_factory_(this) { | 418 activate_modal_dialog_factory_(this) { |
419 } | 419 } |
420 | 420 |
421 BrowserView::~BrowserView() { | 421 BrowserView::~BrowserView() { |
422 // Immersive mode may need to reparent views before they are removed/deleted. | 422 // Immersive mode may need to reparent views before they are removed/deleted. |
423 immersive_mode_controller_.reset(); | 423 immersive_mode_controller_.reset(); |
424 | 424 |
425 browser_->tab_strip_model()->RemoveObserver(this); | 425 browser_->tab_strip_model()->RemoveObserver(this); |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 return chrome::ExecuteCommand(browser_.get(), command_id); | 1865 return chrome::ExecuteCommand(browser_.get(), command_id); |
1866 } | 1866 } |
1867 | 1867 |
1868 /////////////////////////////////////////////////////////////////////////////// | 1868 /////////////////////////////////////////////////////////////////////////////// |
1869 // BrowserView, OmniboxPopupModelObserver overrides: | 1869 // BrowserView, OmniboxPopupModelObserver overrides: |
1870 void BrowserView::OnOmniboxPopupShownOrHidden() { | 1870 void BrowserView::OnOmniboxPopupShownOrHidden() { |
1871 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); | 1871 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); |
1872 } | 1872 } |
1873 | 1873 |
1874 /////////////////////////////////////////////////////////////////////////////// | 1874 /////////////////////////////////////////////////////////////////////////////// |
| 1875 // BrowserView, ScrollEndEffectControllerDelegate overrides: |
| 1876 |
| 1877 ContentsContainer* BrowserView::GetContentsContainer() { |
| 1878 return contents_container_; |
| 1879 } |
| 1880 |
| 1881 gfx::Rect BrowserView::GetFrameBounds() { |
| 1882 return frame_->GetWindowBoundsInScreen(); |
| 1883 } |
| 1884 |
| 1885 void BrowserView::SetFrameBounds(gfx::Rect bounds) { |
| 1886 frame_->SetBounds(bounds); |
| 1887 } |
| 1888 |
| 1889 /////////////////////////////////////////////////////////////////////////////// |
1875 // BrowserView, InfoBarContainer::Delegate overrides: | 1890 // BrowserView, InfoBarContainer::Delegate overrides: |
1876 | 1891 |
1877 SkColor BrowserView::GetInfoBarSeparatorColor() const { | 1892 SkColor BrowserView::GetInfoBarSeparatorColor() const { |
1878 // NOTE: Keep this in sync with ToolbarView::OnPaint()! | 1893 // NOTE: Keep this in sync with ToolbarView::OnPaint()! |
1879 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? | 1894 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? |
1880 ThemeProperties::GetDefaultColor( | 1895 ThemeProperties::GetDefaultColor( |
1881 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) : | 1896 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) : |
1882 SK_ColorBLACK; | 1897 SK_ColorBLACK; |
1883 } | 1898 } |
1884 | 1899 |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2553 password_generator, | 2568 password_generator, |
2554 browser_.get(), | 2569 browser_.get(), |
2555 GetWidget()->GetThemeProvider()); | 2570 GetWidget()->GetThemeProvider()); |
2556 | 2571 |
2557 views::BubbleDelegateView::CreateBubble(bubble); | 2572 views::BubbleDelegateView::CreateBubble(bubble); |
2558 bubble->SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); | 2573 bubble->SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); |
2559 bubble->GetWidget()->Show(); | 2574 bubble->GetWidget()->Show(); |
2560 } | 2575 } |
2561 | 2576 |
2562 void BrowserView::OverscrollUpdate(int delta_y) { | 2577 void BrowserView::OverscrollUpdate(int delta_y) { |
2563 if (scroll_end_effect_controller_) | 2578 // TODO(308164): Remove the check for fullscreen & maximized once the |
| 2579 // related cases have been fixed in the effect. |
| 2580 if (scroll_end_effect_controller_ && !IsFullscreen() && !IsMaximized()) |
2564 scroll_end_effect_controller_->OverscrollUpdate(delta_y); | 2581 scroll_end_effect_controller_->OverscrollUpdate(delta_y); |
2565 } | 2582 } |
2566 | 2583 |
2567 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 2584 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
2568 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || | 2585 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || |
2569 !bookmark_bar_view_.get() || !bookmark_bar_view_->IsDetached()) { | 2586 !bookmark_bar_view_.get() || !bookmark_bar_view_->IsDetached()) { |
2570 return 0; | 2587 return 0; |
2571 } | 2588 } |
2572 // Don't use bookmark_bar_view_->height() which won't be the final height if | 2589 // Don't use bookmark_bar_view_->height() which won't be the final height if |
2573 // the bookmark bar is animating. | 2590 // the bookmark bar is animating. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 !GetLocationBar()->GetLocationEntry()->model()->popup_model()->IsOpen()) { | 2660 !GetLocationBar()->GetLocationEntry()->model()->popup_model()->IsOpen()) { |
2644 gfx::Point icon_bottom( | 2661 gfx::Point icon_bottom( |
2645 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2662 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2646 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2663 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2647 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2664 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2648 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2665 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2649 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2666 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2650 } | 2667 } |
2651 return top_arrow_height; | 2668 return top_arrow_height; |
2652 } | 2669 } |
OLD | NEW |