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

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

Issue 463001: Downward drag after mouse-down is now causing bookmark bar folders to open, r... (Closed) Base URL: http://src.chromium.org/svn/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 21 matching lines...) Expand all
32 #include "chrome/browser/views/location_bar_view.h" 32 #include "chrome/browser/views/location_bar_view.h"
33 #include "chrome/common/notification_service.h" 33 #include "chrome/common/notification_service.h"
34 #include "chrome/common/page_transition_types.h" 34 #include "chrome/common/page_transition_types.h"
35 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
36 #include "chrome/common/pref_service.h" 36 #include "chrome/common/pref_service.h"
37 #include "grit/app_resources.h" 37 #include "grit/app_resources.h"
38 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
39 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
40 #include "views/controls/button/menu_button.h" 40 #include "views/controls/button/menu_button.h"
41 #include "views/controls/label.h" 41 #include "views/controls/label.h"
42 #include "views/controls/button/menu_button.h"
43 #include "views/controls/menu/menu_item_view.h" 42 #include "views/controls/menu/menu_item_view.h"
44 #include "views/drag_utils.h" 43 #include "views/drag_utils.h"
45 #include "views/view_constants.h" 44 #include "views/view_constants.h"
46 #include "views/widget/tooltip_manager.h" 45 #include "views/widget/tooltip_manager.h"
47 #include "views/widget/widget.h" 46 #include "views/widget/widget.h"
48 #include "views/window/window.h" 47 #include "views/window/window.h"
49 48
50 #if defined(OS_WIN) 49 #if defined(OS_WIN)
51 #include "chrome/browser/views/importer_view.h" 50 #include "chrome/browser/views/importer_view.h"
52 #endif 51 #endif
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 NOTREACHED(); 1124 NOTREACHED();
1126 } 1125 }
1127 1126
1128 void BookmarkBarView::WriteDragData(const BookmarkNode* node, 1127 void BookmarkBarView::WriteDragData(const BookmarkNode* node,
1129 OSExchangeData* data) { 1128 OSExchangeData* data) {
1130 DCHECK(node && data); 1129 DCHECK(node && data);
1131 BookmarkDragData drag_data(node); 1130 BookmarkDragData drag_data(node);
1132 drag_data.Write(profile_, data); 1131 drag_data.Write(profile_, data);
1133 } 1132 }
1134 1133
1134 bool BookmarkBarView::CanStartDrag(views::View* sender,
1135 int press_x,
1136 int press_y,
1137 int x,
1138 int y) {
1139 // Check if we have not moved enough horizontally but we have moved downward
1140 // vertically - downward drag.
1141 if (!View::ExceededDragThreshold(press_x - x, 0) && press_y < y) {
1142 for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
1143 if (sender == GetBookmarkButton(i)) {
1144 const BookmarkNode* node = model_->GetBookmarkBarNode()->GetChild(i);
1145 // If the folder button was dragged, show the menu instead.
1146 if (node && node->is_folder()) {
1147 views::MenuButton* menu_button =
1148 static_cast<views::MenuButton*>(sender);
1149 menu_button->Activate();
1150 return false;
1151 }
1152 break;
1153 }
1154 }
1155 }
1156 return true;
1157 }
1158
1135 int BookmarkBarView::GetDragOperations(View* sender, int x, int y) { 1159 int BookmarkBarView::GetDragOperations(View* sender, int x, int y) {
1136 if (size_animation_->IsAnimating() || 1160 if (size_animation_->IsAnimating() ||
1137 (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) { 1161 (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) {
1138 // Don't let the user drag while animating open or we're closed (and not on 1162 // Don't let the user drag while animating open or we're closed (and not on
1139 // the new tab page, on the new tab page size_animation_ is always 0). This 1163 // the new tab page, on the new tab page size_animation_ is always 0). This
1140 // typically is only hit if the user does something to inadvertanty trigger 1164 // typically is only hit if the user does something to inadvertanty trigger
1141 // dnd, such as pressing the mouse and hitting control-b. 1165 // dnd, such as pressing the mouse and hitting control-b.
1142 return DragDropTypes::DRAG_NONE; 1166 return DragDropTypes::DRAG_NONE;
1143 } 1167 }
1144 1168
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 // The tooltip is the only way we have to display text explaining the error 1753 // The tooltip is the only way we have to display text explaining the error
1730 // to the user. 1754 // to the user.
1731 sync_error_button->SetTooltipText( 1755 sync_error_button->SetTooltipText(
1732 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); 1756 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
1733 sync_error_button->SetAccessibleName( 1757 sync_error_button->SetAccessibleName(
1734 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); 1758 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
1735 sync_error_button->SetIcon( 1759 sync_error_button->SetIcon(
1736 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); 1760 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
1737 return sync_error_button; 1761 return sync_error_button;
1738 } 1762 }
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