| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
| 11 #include "webkit/glue/window_open_disposition.h" | 11 #include "webkit/glue/window_open_disposition.h" |
| 12 | 12 |
| 13 class BookmarkNode; | 13 class BookmarkNode; |
| 14 class PageNavigator; | 14 class PageNavigator; |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace views { | |
| 18 class DropTargetEvent; | |
| 19 } | |
| 20 | |
| 21 // A collection of bookmark utility functions used by various parts of the UI | 17 // A collection of bookmark utility functions used by various parts of the UI |
| 22 // that show bookmarks: bookmark manager, bookmark bar view ... | 18 // that show bookmarks: bookmark manager, bookmark bar view ... |
| 23 namespace bookmark_utils { | 19 namespace bookmark_utils { |
| 24 | 20 |
| 25 // Calculates the drop operation given the event and supported set of | 21 // Calculates the drop operation given |source_operations| and the ideal |
| 26 // operations. This prefers the following ordering: COPY, LINK then MOVE. | 22 // set of drop operations (|operations|). This prefers the following ordering: |
| 27 int PreferredDropOperation(const views::DropTargetEvent& event, | 23 // COPY, LINK then MOVE. |
| 28 int operation); | 24 int PreferredDropOperation(int source_operations, int operations); |
| 29 | 25 |
| 30 // Returns true if the bookmark data can be dropped on |drop_parent| at | 26 // Returns true if the bookmark data can be dropped on |drop_parent| at |
| 31 // |index|. A drop from a separate profile is always allowed, where as | 27 // |index|. A drop from a separate profile is always allowed, where as |
| 32 // a drop from the same profile is only allowed if none of the nodes in | 28 // a drop from the same profile is only allowed if none of the nodes in |
| 33 // |data| are an ancestor of |drop_parent| and one of the nodes isn't already | 29 // |data| are an ancestor of |drop_parent| and one of the nodes isn't already |
| 34 // a child of |drop_parent| at |index|. | 30 // a child of |drop_parent| at |index|. |
| 35 bool IsValidDropLocation(Profile* profile, | 31 bool IsValidDropLocation(Profile* profile, |
| 36 const BookmarkDragData& data, | 32 const BookmarkDragData& data, |
| 37 BookmarkNode* drop_parent, | 33 BookmarkNode* drop_parent, |
| 38 int index); | 34 int index); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 58 // Convenience for opening a single BookmarkNode. | 54 // Convenience for opening a single BookmarkNode. |
| 59 void OpenAll(HWND parent, | 55 void OpenAll(HWND parent, |
| 60 Profile* profile, | 56 Profile* profile, |
| 61 PageNavigator* navigator, | 57 PageNavigator* navigator, |
| 62 BookmarkNode* node, | 58 BookmarkNode* node, |
| 63 WindowOpenDisposition initial_disposition); | 59 WindowOpenDisposition initial_disposition); |
| 64 | 60 |
| 65 } // namespace bookmark_utils | 61 } // namespace bookmark_utils |
| 66 | 62 |
| 67 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ | 63 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ |
| OLD | NEW |