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

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

Issue 467017: Downward drag after mouse-down is now causing bookmark bar folders to open, r... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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/views/bookmark_bar_view.h ('k') | chrome/browser/views/toolbar_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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 NOTREACHED(); 1109 NOTREACHED();
1110 } 1110 }
1111 1111
1112 void BookmarkBarView::WriteDragData(const BookmarkNode* node, 1112 void BookmarkBarView::WriteDragData(const BookmarkNode* node,
1113 OSExchangeData* data) { 1113 OSExchangeData* data) {
1114 DCHECK(node && data); 1114 DCHECK(node && data);
1115 BookmarkDragData drag_data(node); 1115 BookmarkDragData drag_data(node);
1116 drag_data.Write(profile_, data); 1116 drag_data.Write(profile_, data);
1117 } 1117 }
1118 1118
1119 bool BookmarkBarView::CanStartDrag(views::View* sender,
1120 int press_x,
1121 int press_y,
1122 int x,
1123 int y) {
1124 // Check if we have not moved enough horizontally but we have moved downward
1125 // vertically - downward drag.
1126 if (!View::ExceededDragThreshold(press_x - x, 0) && press_y < y) {
1127 for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
1128 if (sender == GetBookmarkButton(i)) {
1129 const BookmarkNode* node = model_->GetBookmarkBarNode()->GetChild(i);
1130 // If the folder button was dragged, show the menu instead.
1131 if (node && node->is_folder()) {
1132 views::MenuButton* menu_button =
1133 static_cast<views::MenuButton*>(sender);
1134 menu_button->Activate();
1135 return false;
1136 }
1137 break;
1138 }
1139 }
1140 }
1141 return true;
1142 }
1143
1119 int BookmarkBarView::GetDragOperations(View* sender, int x, int y) { 1144 int BookmarkBarView::GetDragOperations(View* sender, int x, int y) {
1120 if (size_animation_->IsAnimating() || 1145 if (size_animation_->IsAnimating() ||
1121 (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) { 1146 (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) {
1122 // Don't let the user drag while animating open or we're closed (and not on 1147 // Don't let the user drag while animating open or we're closed (and not on
1123 // the new tab page, on the new tab page size_animation_ is always 0). This 1148 // the new tab page, on the new tab page size_animation_ is always 0). This
1124 // typically is only hit if the user does something to inadvertanty trigger 1149 // typically is only hit if the user does something to inadvertanty trigger
1125 // dnd, such as pressing the mouse and hitting control-b. 1150 // dnd, such as pressing the mouse and hitting control-b.
1126 return DragDropTypes::DRAG_NONE; 1151 return DragDropTypes::DRAG_NONE;
1127 } 1152 }
1128 1153
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 // The tooltip is the only way we have to display text explaining the error 1738 // The tooltip is the only way we have to display text explaining the error
1714 // to the user. 1739 // to the user.
1715 sync_error_button->SetTooltipText( 1740 sync_error_button->SetTooltipText(
1716 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); 1741 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
1717 sync_error_button->SetAccessibleName( 1742 sync_error_button->SetAccessibleName(
1718 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); 1743 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
1719 sync_error_button->SetIcon( 1744 sync_error_button->SetIcon(
1720 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); 1745 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
1721 return sync_error_button; 1746 return sync_error_button;
1722 } 1747 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.h ('k') | chrome/browser/views/toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698