Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 286313003: Remove override of View::HitTestRect() from BookmarkBarView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 // detached states. 661 // detached states.
662 return detached_overlap + static_cast<int>( 662 return detached_overlap + static_cast<int>(
663 (attached_overlap - detached_overlap) * 663 (attached_overlap - detached_overlap) *
664 size_animation_->GetCurrentValue()); 664 size_animation_->GetCurrentValue());
665 } 665 }
666 666
667 gfx::Size BookmarkBarView::GetPreferredSize() { 667 gfx::Size BookmarkBarView::GetPreferredSize() {
668 return LayoutItems(true); 668 return LayoutItems(true);
669 } 669 }
670 670
671 bool BookmarkBarView::HitTestRect(const gfx::Rect& rect) const {
672 // If bookmark bar is attached and omnibox popup is open (on top of the bar),
673 // force hit-testing to fail. This prevents hovers/clicks just above the
674 // omnibox popup from activating the top few pixels of items on the bookmark
675 // bar.
676 if (!IsDetached() && browser_view_ &&
677 browser_view_->GetLocationBar()->GetOmniboxView()->model()->
678 popup_model()->IsOpen()) {
679 return false;
680 }
681 return DetachableToolbarView::HitTestRect(rect);
682 }
683
684 gfx::Size BookmarkBarView::GetMinimumSize() { 671 gfx::Size BookmarkBarView::GetMinimumSize() {
685 // The minimum width of the bookmark bar should at least contain the overflow 672 // The minimum width of the bookmark bar should at least contain the overflow
686 // button, by which one can access all the Bookmark Bar items, and the "Other 673 // button, by which one can access all the Bookmark Bar items, and the "Other
687 // Bookmarks" folder, along with appropriate margins and button padding. 674 // Bookmarks" folder, along with appropriate margins and button padding.
688 int width = kLeftMargin; 675 int width = kLeftMargin;
689 676
690 int height = chrome::kBookmarkBarHeight; 677 int height = chrome::kBookmarkBarHeight;
691 if (IsDetached()) { 678 if (IsDetached()) {
692 double current_state = 1 - size_animation_->GetCurrentValue(); 679 double current_state = 1 - size_animation_->GetCurrentValue();
693 width += 2 * static_cast<int>(kNewtabHorizontalPadding * current_state); 680 width += 2 * static_cast<int>(kNewtabHorizontalPadding * current_state);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 899 }
913 900
914 void BookmarkBarView::OnThemeChanged() { 901 void BookmarkBarView::OnThemeChanged() {
915 UpdateColors(); 902 UpdateColors();
916 } 903 }
917 904
918 const char* BookmarkBarView::GetClassName() const { 905 const char* BookmarkBarView::GetClassName() const {
919 return kViewClassName; 906 return kViewClassName;
920 } 907 }
921 908
909 bool BookmarkBarView::CanAcceptEvent(const ui::Event& event) {
910 // If bookmark bar is attached and omnibox popup is open (on top of the bar),
911 // do not allow the bookmark bar to accept events. This prevents, for example,
912 // hovers/clicks just above the omnibox popup from activating the top few
913 // pixels of items on the bookmark bar.
914 if (!IsDetached() && browser_view_ &&
915 browser_view_->GetLocationBar()->GetOmniboxView()->model()->
916 popup_model()->IsOpen()) {
917 return false;
918 }
919
920 return true;
sadrul 2014/05/21 15:46:04 return View::CanAcceptEvent(event)?
tdanderson 2014/05/21 21:11:25 Done.
921 }
922
922 void BookmarkBarView::GetAccessibleState(ui::AXViewState* state) { 923 void BookmarkBarView::GetAccessibleState(ui::AXViewState* state) {
923 state->role = ui::AX_ROLE_TOOLBAR; 924 state->role = ui::AX_ROLE_TOOLBAR;
924 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS); 925 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS);
925 } 926 }
926 927
927 void BookmarkBarView::AnimationProgressed(const gfx::Animation* animation) { 928 void BookmarkBarView::AnimationProgressed(const gfx::Animation* animation) {
928 // |browser_view_| can be NULL during tests. 929 // |browser_view_| can be NULL during tests.
929 if (browser_view_) 930 if (browser_view_)
930 browser_view_->ToolbarSizeChanged(true); 931 browser_view_->ToolbarSizeChanged(true);
931 } 932 }
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 DCHECK(apps_page_shortcut_); 1855 DCHECK(apps_page_shortcut_);
1855 // Only perform layout if required. 1856 // Only perform layout if required.
1856 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( 1857 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar(
1857 browser_->profile(), browser_->host_desktop_type()); 1858 browser_->profile(), browser_->host_desktop_type());
1858 if (apps_page_shortcut_->visible() == visible) 1859 if (apps_page_shortcut_->visible() == visible)
1859 return; 1860 return;
1860 apps_page_shortcut_->SetVisible(visible); 1861 apps_page_shortcut_->SetVisible(visible);
1861 UpdateBookmarksSeparatorVisibility(); 1862 UpdateBookmarksSeparatorVisibility();
1862 Layout(); 1863 Layout();
1863 } 1864 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698