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 "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // COPY, LINK then MOVE. | 32 // COPY, LINK then MOVE. |
33 int PreferredDropOperation(int source_operations, int operations); | 33 int PreferredDropOperation(int source_operations, int operations); |
34 | 34 |
35 // Returns the drag operations for the specified node. | 35 // Returns the drag operations for the specified node. |
36 int BookmarkDragOperation(BookmarkNode* node); | 36 int BookmarkDragOperation(BookmarkNode* node); |
37 | 37 |
38 // Returns the preferred drop operation on a bookmark menu/bar. | 38 // Returns the preferred drop operation on a bookmark menu/bar. |
39 // |parent| is the parent node the drop is to occur on and |index| the index the | 39 // |parent| is the parent node the drop is to occur on and |index| the index the |
40 // drop is over. | 40 // drop is over. |
41 int BookmarkDropOperation(Profile* profile, | 41 int BookmarkDropOperation(Profile* profile, |
42 » » » const views::DropTargetEvent& event, | 42 const views::DropTargetEvent& event, |
43 » » » const BookmarkDragData& data, | 43 const BookmarkDragData& data, |
44 » » » BookmarkNode* parent, | 44 BookmarkNode* parent, |
45 » » » int index); | 45 int index); |
46 | 46 |
47 // Performs a drop of bookmark data onto |parent_node| at |index|. Returns the | 47 // Performs a drop of bookmark data onto |parent_node| at |index|. Returns the |
48 // type of drop the resulted. | 48 // type of drop the resulted. |
49 int PerformBookmarkDrop(Profile* profile, | 49 int PerformBookmarkDrop(Profile* profile, |
50 » » » const BookmarkDragData& data, | 50 const BookmarkDragData& data, |
51 » » » BookmarkNode* parent_node, | 51 BookmarkNode* parent_node, |
52 » » » int index); | 52 int index); |
53 | 53 |
54 // Returns true if the bookmark data can be dropped on |drop_parent| at | 54 // Returns true if the bookmark data can be dropped on |drop_parent| at |
55 // |index|. A drop from a separate profile is always allowed, where as | 55 // |index|. A drop from a separate profile is always allowed, where as |
56 // a drop from the same profile is only allowed if none of the nodes in | 56 // a drop from the same profile is only allowed if none of the nodes in |
57 // |data| are an ancestor of |drop_parent| and one of the nodes isn't already | 57 // |data| are an ancestor of |drop_parent| and one of the nodes isn't already |
58 // a child of |drop_parent| at |index|. | 58 // a child of |drop_parent| at |index|. |
59 bool IsValidDropLocation(Profile* profile, | 59 bool IsValidDropLocation(Profile* profile, |
60 const BookmarkDragData& data, | 60 const BookmarkDragData& data, |
61 BookmarkNode* drop_parent, | 61 BookmarkNode* drop_parent, |
62 int index); | 62 int index); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 BookmarkNode* node; | 120 BookmarkNode* node; |
121 | 121 |
122 // Location of the matching words in the title of the node. | 122 // Location of the matching words in the title of the node. |
123 Snippet::MatchPositions match_positions; | 123 Snippet::MatchPositions match_positions; |
124 }; | 124 }; |
125 | 125 |
126 // Returns true if |n1| was added more recently than |n2|. | 126 // Returns true if |n1| was added more recently than |n2|. |
127 bool MoreRecentlyAdded(BookmarkNode* n1, BookmarkNode* n2); | 127 bool MoreRecentlyAdded(BookmarkNode* n1, BookmarkNode* n2); |
128 | 128 |
129 // Returns up to |max_count| bookmarks from |model| whose url or title contains | 129 // Returns up to |max_count| bookmarks from |model| whose url or title contains |
130 // the text |text|. | 130 // the text |text|. |languages| is user's accept-language setting to decode |
| 131 // IDN. |
131 void GetBookmarksContainingText(BookmarkModel* model, | 132 void GetBookmarksContainingText(BookmarkModel* model, |
132 const std::wstring& text, | 133 const std::wstring& text, |
133 size_t max_count, | 134 size_t max_count, |
| 135 const std::wstring& languages, |
134 std::vector<BookmarkNode*>* nodes); | 136 std::vector<BookmarkNode*>* nodes); |
135 | 137 |
136 // Returns true if |node|'s url or title contains the string |text|. | 138 // Returns true if |node|'s url or title contains the string |text|. |
137 bool DoesBookmarkContainText(BookmarkNode* node, const std::wstring& text); | 139 // |languages| is user's accept-language setting to decode IDN. |
| 140 bool DoesBookmarkContainText(BookmarkNode* node, |
| 141 const std::wstring& text, |
| 142 const std::wstring& languages); |
138 | 143 |
139 // Modifies a bookmark node (assuming that there's no magic that needs to be | 144 // Modifies a bookmark node (assuming that there's no magic that needs to be |
140 // done regarding moving from one folder to another). | 145 // done regarding moving from one folder to another). |
141 void ApplyEditsWithNoGroupChange(BookmarkModel* model, | 146 void ApplyEditsWithNoGroupChange(BookmarkModel* model, |
142 BookmarkNode* parent, | 147 BookmarkNode* parent, |
143 BookmarkNode* node, | 148 BookmarkNode* node, |
144 const std::wstring& new_title, | 149 const std::wstring& new_title, |
145 const GURL& new_url, | 150 const GURL& new_url, |
146 BookmarkEditor::Handler* handler); | 151 BookmarkEditor::Handler* handler); |
147 | 152 |
(...skipping 16 matching lines...) Expand all Loading... |
164 // Number of bookmarks we'll open before prompting the user to see if they | 169 // Number of bookmarks we'll open before prompting the user to see if they |
165 // really want to open all. | 170 // really want to open all. |
166 // | 171 // |
167 // NOTE: treat this as a const. It is not const as various tests change the | 172 // NOTE: treat this as a const. It is not const as various tests change the |
168 // value. | 173 // value. |
169 extern int num_urls_before_prompting; | 174 extern int num_urls_before_prompting; |
170 | 175 |
171 } // namespace bookmark_utils | 176 } // namespace bookmark_utils |
172 | 177 |
173 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ | 178 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ |
OLD | NEW |