OLD | NEW |
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_menu_delegate.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 10 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 bool BookmarkMenuDelegate::AreDropTypesRequired(MenuItemView* menu) { | 176 bool BookmarkMenuDelegate::AreDropTypesRequired(MenuItemView* menu) { |
177 return true; | 177 return true; |
178 } | 178 } |
179 | 179 |
180 bool BookmarkMenuDelegate::CanDrop(MenuItemView* menu, | 180 bool BookmarkMenuDelegate::CanDrop(MenuItemView* menu, |
181 const ui::OSExchangeData& data) { | 181 const ui::OSExchangeData& data) { |
182 // Only accept drops of 1 node, which is the case for all data dragged from | 182 // Only accept drops of 1 node, which is the case for all data dragged from |
183 // bookmark bar and menus. | 183 // bookmark bar and menus. |
184 | 184 |
185 if (!drop_data_.Read(data) || drop_data_.elements.size() != 1 || | 185 if (!drop_data_.Read(data) || drop_data_.elements.size() != 1 || |
186 !profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled)) | 186 !profile_->GetPrefs()->GetBoolean( |
| 187 bookmarks::prefs::kEditBookmarksEnabled)) |
187 return false; | 188 return false; |
188 | 189 |
189 if (drop_data_.has_single_url()) | 190 if (drop_data_.has_single_url()) |
190 return true; | 191 return true; |
191 | 192 |
192 const BookmarkNode* drag_node = | 193 const BookmarkNode* drag_node = |
193 drop_data_.GetFirstNode(GetBookmarkModel(), profile_->GetPath()); | 194 drop_data_.GetFirstNode(GetBookmarkModel(), profile_->GetPath()); |
194 if (!drag_node) { | 195 if (!drag_node) { |
195 // Dragging a folder from another profile, always accept. | 196 // Dragging a folder from another profile, always accept. |
196 return true; | 197 return true; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 BuildMenu(node, 0, submenu, next_menu_id); | 516 BuildMenu(node, 0, submenu, next_menu_id); |
516 } else { | 517 } else { |
517 NOTREACHED(); | 518 NOTREACHED(); |
518 } | 519 } |
519 } | 520 } |
520 } | 521 } |
521 | 522 |
522 bool BookmarkMenuDelegate::IsOutsideMenuIdRange(int menu_id) const { | 523 bool BookmarkMenuDelegate::IsOutsideMenuIdRange(int menu_id) const { |
523 return menu_id < min_menu_id_ || menu_id > max_menu_id_; | 524 return menu_id < min_menu_id_ || menu_id > max_menu_id_; |
524 } | 525 } |
OLD | NEW |