| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 static_cast<int>( | 672 static_cast<int>( |
| 673 (chrome::kNTPBookmarkBarHeight - chrome::kBookmarkBarHeight) * | 673 (chrome::kNTPBookmarkBarHeight - chrome::kBookmarkBarHeight) * |
| 674 (1 - size_animation_->GetCurrentValue()))); | 674 (1 - size_animation_->GetCurrentValue()))); |
| 675 } else { | 675 } else { |
| 676 prefsize.set_height(static_cast<int>(chrome::kBookmarkBarHeight * | 676 prefsize.set_height(static_cast<int>(chrome::kBookmarkBarHeight * |
| 677 size_animation_->GetCurrentValue())); | 677 size_animation_->GetCurrentValue())); |
| 678 } | 678 } |
| 679 return prefsize; | 679 return prefsize; |
| 680 } | 680 } |
| 681 | 681 |
| 682 bool BookmarkBarView::HitTestRect(const gfx::Rect& rect) const { | 682 bool BookmarkBarView::CanProcessEventsWithinSubtree() const { |
| 683 // If bookmark bar is attached and omnibox popup is open (on top of the bar), | 683 // If the bookmark bar is attached and the omnibox popup is open (on top of |
| 684 // force hit-testing to fail. This prevents hovers/clicks just above the | 684 // the bar), prevent events from targeting the bookmark bar or any of its |
| 685 // omnibox popup from activating the top few pixels of items on the bookmark | 685 // descendants. This will prevent hovers/clicks just above the omnibox popup |
| 686 // bar. | 686 // from activating the top few pixels of items on the bookmark bar. |
| 687 if (!IsDetached() && browser_view_ && | 687 if (!IsDetached() && browser_view_ && |
| 688 browser_view_->GetLocationBar()->GetOmniboxView()->model()-> | 688 browser_view_->GetLocationBar()->GetOmniboxView()->model()-> |
| 689 popup_model()->IsOpen()) { | 689 popup_model()->IsOpen()) { |
| 690 return false; | 690 return false; |
| 691 } | 691 } |
| 692 return DetachableToolbarView::HitTestRect(rect); | 692 return true; |
| 693 } | 693 } |
| 694 | 694 |
| 695 gfx::Size BookmarkBarView::GetMinimumSize() const { | 695 gfx::Size BookmarkBarView::GetMinimumSize() const { |
| 696 // The minimum width of the bookmark bar should at least contain the overflow | 696 // The minimum width of the bookmark bar should at least contain the overflow |
| 697 // button, by which one can access all the Bookmark Bar items, and the "Other | 697 // button, by which one can access all the Bookmark Bar items, and the "Other |
| 698 // Bookmarks" folder, along with appropriate margins and button padding. | 698 // Bookmarks" folder, along with appropriate margins and button padding. |
| 699 int width = kLeftMargin; | 699 int width = kLeftMargin; |
| 700 | 700 |
| 701 int height = chrome::kBookmarkBarHeight; | 701 int height = chrome::kBookmarkBarHeight; |
| 702 if (IsDetached()) { | 702 if (IsDetached()) { |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 DCHECK(apps_page_shortcut_); | 1829 DCHECK(apps_page_shortcut_); |
| 1830 // Only perform layout if required. | 1830 // Only perform layout if required. |
| 1831 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1831 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
| 1832 browser_->profile(), browser_->host_desktop_type()); | 1832 browser_->profile(), browser_->host_desktop_type()); |
| 1833 if (apps_page_shortcut_->visible() == visible) | 1833 if (apps_page_shortcut_->visible() == visible) |
| 1834 return; | 1834 return; |
| 1835 apps_page_shortcut_->SetVisible(visible); | 1835 apps_page_shortcut_->SetVisible(visible); |
| 1836 UpdateBookmarksSeparatorVisibility(); | 1836 UpdateBookmarksSeparatorVisibility(); |
| 1837 Layout(); | 1837 Layout(); |
| 1838 } | 1838 } |
| OLD | NEW |