172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Use of this source code is governed by a BSD-style license that can be
3c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// found in the LICENSE file.
4c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
5c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_
6c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_
73345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#pragma once
8c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
9c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include <string>
10c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include <vector>
11c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
123345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "base/string16.h"
13c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "chrome/browser/bookmarks/bookmark_editor.h"
14ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "chrome/browser/bookmarks/bookmark_node_data.h"
15c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "chrome/browser/history/snippet.h"
1672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen#include "ui/gfx/native_widget_types.h"
17c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "webkit/glue/window_open_disposition.h"
18c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
19c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass BookmarkModel;
20c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass BookmarkNode;
21c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass Browser;
22c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass PageNavigator;
23c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass PrefService;
24c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass Profile;
25c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TabContents;
26c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
27c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace views {
28c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass DropTargetEvent;
29c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch}
30c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
31c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// A collection of bookmark utility functions used by various parts of the UI
32c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// that show bookmarks: bookmark manager, bookmark bar view ...
33c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace bookmark_utils {
34c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
35c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Calculates the drop operation given |source_operations| and the ideal
36c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// set of drop operations (|operations|). This prefers the following ordering:
37c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// COPY, LINK then MOVE.
38c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochint PreferredDropOperation(int source_operations, int operations);
39c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
40c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns the drag operations for the specified node.
41ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsenint BookmarkDragOperation(Profile* profile, const BookmarkNode* node);
42c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
43c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns the preferred drop operation on a bookmark menu/bar.
44c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |parent| is the parent node the drop is to occur on and |index| the index the
45c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// drop is over.
46c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochint BookmarkDropOperation(Profile* profile,
47c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                          const views::DropTargetEvent& event,
48201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch                          const BookmarkNodeData& data,
49c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                          const BookmarkNode* parent,
50c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                          int index);
51c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
52c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Performs a drop of bookmark data onto |parent_node| at |index|. Returns the
53c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// type of drop the resulted.
54c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochint PerformBookmarkDrop(Profile* profile,
55201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch                        const BookmarkNodeData& data,
56c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                        const BookmarkNode* parent_node,
57c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                        int index);
58c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
59c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns true if the bookmark data can be dropped on |drop_parent| at
60c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |index|. A drop from a separate profile is always allowed, where as
61c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// a drop from the same profile is only allowed if none of the nodes in
62c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |data| are an ancestor of |drop_parent| and one of the nodes isn't already
63c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// a child of |drop_parent| at |index|.
64c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochbool IsValidDropLocation(Profile* profile,
65201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch                         const BookmarkNodeData& data,
66c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                         const BookmarkNode* drop_parent,
67c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                         int index);
68c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
694a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch// Clones bookmark node, adding newly created nodes to |parent| starting at
70c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |index_to_add_at|.
714a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdochvoid CloneBookmarkNode(BookmarkModel* model,
72201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch                       const std::vector<BookmarkNodeData::Element>& elements,
734a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch                       const BookmarkNode* parent,
744a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch                       int index_to_add_at);
75c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
76ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Begins dragging a folder of bookmarks.
77c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid DragBookmarks(Profile* profile,
78c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                   const std::vector<const BookmarkNode*>& nodes,
79c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                   gfx::NativeView view);
80c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
81ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Opens all the bookmarks in |nodes| that are of type url and all the child
82ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// bookmarks that are of type url for folders in |nodes|. |initial_disposition|
83ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// dictates how the first URL is opened, all subsequent URLs are opened as
84ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// background tabs.  |navigator| is used to open the URLs. If |navigator| is
85ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// NULL the last tabbed browser with the profile |profile| is used. If there is
86ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// no browser with the specified profile a new one is created.
87c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid OpenAll(gfx::NativeWindow parent,
88c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             Profile* profile,
89c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             PageNavigator* navigator,
90c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             const std::vector<const BookmarkNode*>& nodes,
91c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             WindowOpenDisposition initial_disposition);
92c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
93ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Convenience for |OpenAll| with a single BookmarkNode.
94c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid OpenAll(gfx::NativeWindow parent,
95c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             Profile* profile,
96c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             PageNavigator* navigator,
97c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             const BookmarkNode* node,
98c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch             WindowOpenDisposition initial_disposition);
99c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
100c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Copies nodes onto the clipboard. If |remove_nodes| is true the nodes are
101c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// removed after copied to the clipboard. The nodes are copied in such a way
102c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// that if pasted again copies are made.
103c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid CopyToClipboard(BookmarkModel* model,
104c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                     const std::vector<const BookmarkNode*>& nodes,
105c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                     bool remove_nodes);
106c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
107c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Pastes from the clipboard. The new nodes are added to |parent|, unless
108c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |parent| is null in which case this does nothing. The nodes are inserted
109c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// at |index|. If |index| is -1 the nodes are added to the end.
110c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid PasteFromClipboard(BookmarkModel* model,
111c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                        const BookmarkNode* parent,
112c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                        int index);
113c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
114c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns true if the user can copy from the pasteboard.
115c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochbool CanPasteFromClipboard(const BookmarkNode* node);
116c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
117c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns a name for the given URL. Used for drags into bookmark areas when
118c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// the source doesn't specify a title.
11972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsenstring16 GetNameForURL(const GURL& url);
120c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
121c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns a vector containing up to |max_count| of the most recently modified
122ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// folders. This never returns an empty vector.
123ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsenstd::vector<const BookmarkNode*> GetMostRecentlyModifiedFolders(
124c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    BookmarkModel* model, size_t max_count);
125c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
126ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Returns the most recently added bookmarks. This does not return folders,
127c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// only nodes of type url.
128c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid GetMostRecentlyAddedEntries(BookmarkModel* model,
129c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                                 size_t count,
130c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                                 std::vector<const BookmarkNode*>* nodes);
131c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
132c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Used by GetBookmarksMatchingText to return a matching node and the location
133c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// of the match in the title.
134c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochstruct TitleMatch {
13572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen  TitleMatch();
13672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen  ~TitleMatch();
13772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen
138c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  const BookmarkNode* node;
139c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
140c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // Location of the matching words in the title of the node.
141c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  Snippet::MatchPositions match_positions;
142c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch};
143c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
144c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns true if |n1| was added more recently than |n2|.
145c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochbool MoreRecentlyAdded(const BookmarkNode* n1, const BookmarkNode* n2);
146c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
147c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns up to |max_count| bookmarks from |model| whose url or title contains
148c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// the text |text|.  |languages| is user's accept-language setting to decode
149c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// IDN.
150c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid GetBookmarksContainingText(BookmarkModel* model,
1513345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick                                const string16& text,
152c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                                size_t max_count,
1533345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick                                const std::string& languages,
154c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                                std::vector<const BookmarkNode*>* nodes);
155c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
156c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns true if |node|'s url or title contains the string |text|.
157c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |languages| is user's accept-language setting to decode IDN.
158c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochbool DoesBookmarkContainText(const BookmarkNode* node,
1593345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick                             const string16& text,
1603345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick                             const std::string& languages);
161c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
162c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Modifies a bookmark node (assuming that there's no magic that needs to be
163c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// done regarding moving from one folder to another).  If a new node is
164c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// explicitly being added, returns a pointer to the new node that was created.
165c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Otherwise the return value is identically |node|.
166ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsenconst BookmarkNode* ApplyEditsWithNoFolderChange(
167c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    BookmarkModel* model,
168c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const BookmarkNode* parent,
169c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const BookmarkEditor::EditDetails& details,
1703345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick    const string16& new_title,
171c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const GURL& new_url);
172c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
173c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Modifies a bookmark node assuming that the parent of the node may have
174c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// changed and the node will need to be removed and reinserted.  If a new node
175c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// is explicitly being added, returns a pointer to the new node that was
176c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// created.  Otherwise the return value is identically |node|.
177ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsenconst BookmarkNode* ApplyEditsWithPossibleFolderChange(
178c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    BookmarkModel* model,
179c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const BookmarkNode* new_parent,
180c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const BookmarkEditor::EditDetails& details,
1813345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick    const string16& new_title,
182c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const GURL& new_url);
183c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
184c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Toggles whether the bookmark bar is shown only on the new tab page or on
185c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// all tabs.  This is a preference modifier, not a visual modifier.
186c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid ToggleWhenVisible(Profile* profile);
187c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
188c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Register user preferences for BookmarksBar.
189c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid RegisterUserPrefs(PrefService* prefs);
190c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
191c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Fills in the URL and title for a bookmark of |tab_contents|.
192c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid GetURLAndTitleToBookmark(TabContents* tab_contents,
193c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch                              GURL* url,
1943345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick                              string16* title);
195c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
196c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns, by reference in |urls|, the url and title pairs for each open
197c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// tab in browser.
198c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid GetURLsForOpenTabs(Browser* browser,
1993345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick                        std::vector<std::pair<GURL, string16> >* urls);
200c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
201c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns the parent for newly created folders/bookmarks. If |selection| has
202c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// one element and it is a folder, |selection[0]| is returned, otherwise
203c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |parent| is returned. If |index| is non-null it is set to the index newly
204c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// added nodes should be added at.
205c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochconst BookmarkNode* GetParentForNewNodes(
206c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const BookmarkNode* parent,
207c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    const std::vector<const BookmarkNode*>& selection,
208c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch    int* index);
209c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
210201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch// Returns true if the specified node is of type URL, or has a descendant
211201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch// of type URL.
212201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdochbool NodeHasURLs(const BookmarkNode* node);
213201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch
214c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Number of bookmarks we'll open before prompting the user to see if they
215c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// really want to open all.
216c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch//
217c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// NOTE: treat this as a const. It is not const as various tests change the
218c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// value.
219c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochextern int num_urls_before_prompting;
220c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
221c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch}  // namespace bookmark_utils
222c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
223c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#endif  // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_
224