OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 return true; | 534 return true; |
535 } | 535 } |
536 | 536 |
537 bool BookmarkBarView::AreDropTypesRequired() { | 537 bool BookmarkBarView::AreDropTypesRequired() { |
538 return true; | 538 return true; |
539 } | 539 } |
540 | 540 |
541 bool BookmarkBarView::CanDrop(const ui::OSExchangeData& data) { | 541 bool BookmarkBarView::CanDrop(const ui::OSExchangeData& data) { |
542 if (!model_ || !model_->IsLoaded()) | 542 if (!model_ || !model_->IsLoaded()) |
543 return false; | 543 return false; |
544 if (!profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled)) | |
sky
2011/04/13 14:28:55
Combine with previous if.
Joao da Silva
2011/04/13 14:42:42
Done.
| |
545 return false; | |
544 | 546 |
545 if (!drop_info_.get()) | 547 if (!drop_info_.get()) |
546 drop_info_.reset(new DropInfo()); | 548 drop_info_.reset(new DropInfo()); |
547 | 549 |
548 // Only accept drops of 1 node, which is the case for all data dragged from | 550 // Only accept drops of 1 node, which is the case for all data dragged from |
549 // bookmark bar and menus. | 551 // bookmark bar and menus. |
550 return drop_info_->data.Read(data) && drop_info_->data.size() == 1; | 552 return drop_info_->data.Read(data) && drop_info_->data.size() == 1; |
551 } | 553 } |
552 | 554 |
553 void BookmarkBarView::OnDragEntered(const DropTargetEvent& event) { | 555 void BookmarkBarView::OnDragEntered(const DropTargetEvent& event) { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1107 // Don't let the user drag while animating open or we're closed (and not on | 1109 // Don't let the user drag while animating open or we're closed (and not on |
1108 // the new tab page, on the new tab page size_animation_ is always 0). This | 1110 // the new tab page, on the new tab page size_animation_ is always 0). This |
1109 // typically is only hit if the user does something to inadvertanty trigger | 1111 // typically is only hit if the user does something to inadvertanty trigger |
1110 // dnd, such as pressing the mouse and hitting control-b. | 1112 // dnd, such as pressing the mouse and hitting control-b. |
1111 return ui::DragDropTypes::DRAG_NONE; | 1113 return ui::DragDropTypes::DRAG_NONE; |
1112 } | 1114 } |
1113 | 1115 |
1114 for (int i = 0; i < GetBookmarkButtonCount(); ++i) { | 1116 for (int i = 0; i < GetBookmarkButtonCount(); ++i) { |
1115 if (sender == GetBookmarkButton(i)) { | 1117 if (sender == GetBookmarkButton(i)) { |
1116 return bookmark_utils::BookmarkDragOperation( | 1118 return bookmark_utils::BookmarkDragOperation( |
1117 model_->GetBookmarkBarNode()->GetChild(i)); | 1119 profile_, model_->GetBookmarkBarNode()->GetChild(i)); |
1118 } | 1120 } |
1119 } | 1121 } |
1120 NOTREACHED(); | 1122 NOTREACHED(); |
1121 return ui::DragDropTypes::DRAG_NONE; | 1123 return ui::DragDropTypes::DRAG_NONE; |
1122 } | 1124 } |
1123 | 1125 |
1124 bool BookmarkBarView::CanStartDragForView(views::View* sender, | 1126 bool BookmarkBarView::CanStartDragForView(views::View* sender, |
1125 const gfx::Point& press_pt, | 1127 const gfx::Point& press_pt, |
1126 const gfx::Point& p) { | 1128 const gfx::Point& p) { |
1127 // Check if we have not moved enough horizontally but we have moved downward | 1129 // Check if we have not moved enough horizontally but we have moved downward |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1782 // The tooltip is the only way we have to display text explaining the error | 1784 // The tooltip is the only way we have to display text explaining the error |
1783 // to the user. | 1785 // to the user. |
1784 sync_error_button->SetTooltipText( | 1786 sync_error_button->SetTooltipText( |
1785 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC))); | 1787 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC))); |
1786 sync_error_button->SetAccessibleName( | 1788 sync_error_button->SetAccessibleName( |
1787 l10n_util::GetStringUTF16(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1789 l10n_util::GetStringUTF16(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
1788 sync_error_button->SetIcon( | 1790 sync_error_button->SetIcon( |
1789 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1791 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
1790 return sync_error_button; | 1792 return sync_error_button; |
1791 } | 1793 } |
OLD | NEW |