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

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

Issue 384021: Fixes regression in showing bookmark menus where the wrong menu would... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | « no previous file | views/view.h » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/bookmark_bar_view.h" 5 #include "chrome/browser/views/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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 return bookmark_drop_menu_ ? bookmark_drop_menu_->menu() : NULL; 793 return bookmark_drop_menu_ ? bookmark_drop_menu_->menu() : NULL;
794 } 794 }
795 795
796 const BookmarkNode* BookmarkBarView::GetNodeForButtonAt(const gfx::Point& loc, 796 const BookmarkNode* BookmarkBarView::GetNodeForButtonAt(const gfx::Point& loc,
797 int* start_index) { 797 int* start_index) {
798 *start_index = 0; 798 *start_index = 0;
799 799
800 if (loc.x() < 0 || loc.x() >= width() || loc.y() < 0 || loc.y() >= height()) 800 if (loc.x() < 0 || loc.x() >= width() || loc.y() < 0 || loc.y() >= height())
801 return NULL; 801 return NULL;
802 802
803 gfx::Point adjusted_loc(MirroredXCoordinateInsideView(loc.x()), loc.y());
804
803 // Check the buttons first. 805 // Check the buttons first.
804 for (int i = 0; i < GetBookmarkButtonCount(); ++i) { 806 for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
805 views::View* child = GetChildViewAt(i); 807 views::View* child = GetChildViewAt(i);
806 if (!child->IsVisible()) 808 if (!child->IsVisible())
807 break; 809 break;
808 if (child->bounds().Contains(loc)) 810 if (child->bounds().Contains(adjusted_loc))
809 return model_->GetBookmarkBarNode()->GetChild(i); 811 return model_->GetBookmarkBarNode()->GetChild(i);
810 } 812 }
811 813
812 // Then the overflow button. 814 // Then the overflow button.
813 if (overflow_button_->IsVisible() && 815 if (overflow_button_->IsVisible() &&
814 overflow_button_->bounds().Contains(loc)) { 816 overflow_button_->bounds().Contains(adjusted_loc)) {
815 *start_index = GetFirstHiddenNodeIndex(); 817 *start_index = GetFirstHiddenNodeIndex();
816 return model_->GetBookmarkBarNode(); 818 return model_->GetBookmarkBarNode();
817 } 819 }
818 820
819 // And finally the other folder. 821 // And finally the other folder.
820 if (other_bookmarked_button_->bounds().Contains(loc)) 822 if (other_bookmarked_button_->bounds().Contains(adjusted_loc))
821 return model_->other_node(); 823 return model_->other_node();
822 824
823 return NULL; 825 return NULL;
824 } 826 }
825 827
826 views::MenuButton* BookmarkBarView::GetMenuButtonForNode( 828 views::MenuButton* BookmarkBarView::GetMenuButtonForNode(
827 const BookmarkNode* node) { 829 const BookmarkNode* node) {
828 if (node == model_->other_node()) 830 if (node == model_->other_node())
829 return other_bookmarked_button_; 831 return other_bookmarked_button_;
830 if (node == model_->GetBookmarkBarNode()) 832 if (node == model_->GetBookmarkBarNode())
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 // The tooltip is the only way we have to display text explaining the error 1706 // The tooltip is the only way we have to display text explaining the error
1705 // to the user. 1707 // to the user.
1706 sync_error_button->SetTooltipText( 1708 sync_error_button->SetTooltipText(
1707 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); 1709 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
1708 sync_error_button->SetAccessibleName( 1710 sync_error_button->SetAccessibleName(
1709 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); 1711 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
1710 sync_error_button->SetIcon( 1712 sync_error_button->SetIcon(
1711 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); 1713 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
1712 return sync_error_button; 1714 return sync_error_button;
1713 } 1715 }
OLDNEW
« no previous file with comments | « no previous file | views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698