Chromium Code Reviews| Index: chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc |
| diff --git a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc |
| index e80f31904d26a0f5088d37c087fe9d0875d19f63..a86888519a107f86ee9da76daee8ea32fdcbbf45 100644 |
| --- a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc |
| +++ b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc |
| @@ -227,6 +227,38 @@ void OpenAll(gfx::NativeWindow parent, |
| OpenAll(parent, navigator, nodes, initial_disposition, browser_context); |
| } |
| +int OpenCount(gfx::NativeWindow parent, |
| + const std::vector<const bookmarks::BookmarkNode*>& nodes, |
| + bool offTheRecord, |
| + content::BrowserContext* browser_context) { |
| + int count = 0; |
| + if (!ShouldOpenAll(parent, nodes)) |
| + return count; |
| + // Counts all |nodes| of type URL and any children of |nodes| that are of type |
| + // URL. |
| + OpenURLIterator iterator(nodes); |
| + while (iterator.has_next()) { |
|
Peter Kasting
2017/04/13 04:52:09
This feels very copy-and-pasted from OpenAll(). I
Paezagon
2017/04/14 01:00:29
I have added a second get vector function that ret
|
| + const GURL* url = iterator.NextURL(); |
| + // When |initial_disposition| is OFF_THE_RECORD, a node which can't be |
| + // opened in incognito window, it is detected using |browser_context|, is |
| + // not opened. |
|
Peter Kasting
2017/04/13 04:52:09
This comment doesn't make much sense. I realize y
Paezagon
2017/04/14 01:00:29
Done.
|
| + if (offTheRecord && !IsURLAllowedInIncognito(*url, browser_context)) |
| + continue; |
| + |
| + count++; |
| + } |
| + return count; |
| +} |
| + |
| +int OpenCount(gfx::NativeWindow parent, |
| + const BookmarkNode* node, |
| + bool offTheRecord, |
| + content::BrowserContext* browser_context) { |
| + std::vector<const BookmarkNode*> nodes; |
| + nodes.push_back(node); |
| + return OpenCount(parent, nodes, offTheRecord, browser_context); |
|
Peter Kasting
2017/04/13 04:52:09
Nit: Simpler:
return OpenCount(parent, {node},
Paezagon
2017/04/14 01:00:29
When I make the change, the compiler complains tha
Peter Kasting
2017/04/14 08:17:14
Might need to do something like:
return OpenCou
Paezagon
2017/04/14 18:47:24
Done.
|
| +} |
| + |
| bool ConfirmDeleteBookmarkNode(const BookmarkNode* node, |
| gfx::NativeWindow window) { |
| DCHECK(node && node->is_folder() && !node->empty()); |