OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_VIEWS_BOOKMARKS_BOOKMARK_DRAG_DROP_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_DRAG_DROP_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_DRAG_DROP_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_DRAG_DROP_VIEWS_H_ |
7 | 7 |
8 class BookmarkNode; | 8 class BookmarkNode; |
| 9 class Profile; |
| 10 |
| 11 namespace bookmarks { |
9 struct BookmarkNodeData; | 12 struct BookmarkNodeData; |
10 class Profile; | 13 } |
11 | 14 |
12 namespace content { | 15 namespace content { |
13 class BrowserContext; | 16 class BrowserContext; |
14 } | 17 } |
15 | 18 |
16 namespace ui { | 19 namespace ui { |
17 class DropTargetEvent; | 20 class DropTargetEvent; |
18 } | 21 } |
19 | 22 |
20 namespace chrome { | 23 namespace chrome { |
21 | 24 |
22 // Returns the drag operations for the specified node. | 25 // Returns the drag operations for the specified node. |
23 int GetBookmarkDragOperation(content::BrowserContext* browser_context, | 26 int GetBookmarkDragOperation(content::BrowserContext* browser_context, |
24 const BookmarkNode* node); | 27 const BookmarkNode* node); |
25 | 28 |
26 // Calculates the drop operation given |source_operations| and the ideal | 29 // Calculates the drop operation given |source_operations| and the ideal |
27 // set of drop operations (|operations|). This prefers the following ordering: | 30 // set of drop operations (|operations|). This prefers the following ordering: |
28 // COPY, LINK then MOVE. | 31 // COPY, LINK then MOVE. |
29 int GetPreferredBookmarkDropOperation(int source_operations, int operations); | 32 int GetPreferredBookmarkDropOperation(int source_operations, int operations); |
30 | 33 |
31 // Returns the preferred drop operation on a bookmark menu/bar. | 34 // Returns the preferred drop operation on a bookmark menu/bar. |
32 // |parent| is the parent node the drop is to occur on and |index| the index the | 35 // |parent| is the parent node the drop is to occur on and |index| the index the |
33 // drop is over. | 36 // drop is over. |
34 int GetBookmarkDropOperation(Profile* profile, | 37 int GetBookmarkDropOperation(Profile* profile, |
35 const ui::DropTargetEvent& event, | 38 const ui::DropTargetEvent& event, |
36 const BookmarkNodeData& data, | 39 const bookmarks::BookmarkNodeData& data, |
37 const BookmarkNode* parent, | 40 const BookmarkNode* parent, |
38 int index); | 41 int index); |
39 | 42 |
40 // Returns true if the bookmark data can be dropped on |drop_parent| at | 43 // Returns true if the bookmark data can be dropped on |drop_parent| at |
41 // |index|. A drop from a separate profile is always allowed, where as | 44 // |index|. A drop from a separate profile is always allowed, where as |
42 // a drop from the same profile is only allowed if none of the nodes in | 45 // a drop from the same profile is only allowed if none of the nodes in |
43 // |data| are an ancestor of |drop_parent| and one of the nodes isn't already | 46 // |data| are an ancestor of |drop_parent| and one of the nodes isn't already |
44 // a child of |drop_parent| at |index|. | 47 // a child of |drop_parent| at |index|. |
45 bool IsValidBookmarkDropLocation(Profile* profile, | 48 bool IsValidBookmarkDropLocation(Profile* profile, |
46 const BookmarkNodeData& data, | 49 const bookmarks::BookmarkNodeData& data, |
47 const BookmarkNode* drop_parent, | 50 const BookmarkNode* drop_parent, |
48 int index); | 51 int index); |
49 | 52 |
50 } // namespace chrome | 53 } // namespace chrome |
51 | 54 |
52 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_DRAG_DROP_VIEWS_H_ | 55 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_DRAG_DROP_VIEWS_H_ |
OLD | NEW |