| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BOOKMARKS_BOOKMARK_UTILS_DESKTOP_H_ | 5 #ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_DESKTOP_H_ |
| 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_DESKTOP_H_ | 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_DESKTOP_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ui/base/window_open_disposition.h" | 10 #include "ui/base/window_open_disposition.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class PageNavigator; | 21 class PageNavigator; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace chrome { | 24 namespace chrome { |
| 25 | 25 |
| 26 // Number of bookmarks we'll open before prompting the user to see if they | 26 // Number of bookmarks we'll open before prompting the user to see if they |
| 27 // really want to open all. | 27 // really want to open all. |
| 28 // | 28 // |
| 29 // NOTE: treat this as a const. It is not const so unit tests can change the | 29 // NOTE: treat this as a const. It is not const so unit tests can change the |
| 30 // value. | 30 // value. |
| 31 extern int num_bookmark_urls_before_prompting; | 31 extern size_t kNumBookmarkUrlsBeforePrompting; |
| 32 | 32 |
| 33 // Opens all the bookmarks in |nodes| that are of type url and all the child | 33 // Opens all the bookmarks in |nodes| that are of type url and all the child |
| 34 // bookmarks that are of type url for folders in |nodes|. |initial_disposition| | 34 // bookmarks that are of type url for folders in |nodes|. |initial_disposition| |
| 35 // dictates how the first URL is opened, all subsequent URLs are opened as | 35 // dictates how the first URL is opened, all subsequent URLs are opened as |
| 36 // background tabs. |navigator| is used to open the URLs. | 36 // background tabs. |navigator| is used to open the URLs. |
| 37 void OpenAll(gfx::NativeWindow parent, | 37 void OpenAll(gfx::NativeWindow parent, |
| 38 content::PageNavigator* navigator, | 38 content::PageNavigator* navigator, |
| 39 const std::vector<const bookmarks::BookmarkNode*>& nodes, | 39 const std::vector<const bookmarks::BookmarkNode*>& nodes, |
| 40 WindowOpenDisposition initial_disposition, | 40 WindowOpenDisposition initial_disposition, |
| 41 content::BrowserContext* browser_context); | 41 content::BrowserContext* browser_context); |
| 42 | 42 |
| 43 // Convenience for OpenAll() with a single BookmarkNode. | 43 // Convenience for OpenAll() with a single BookmarkNode. |
| 44 void OpenAll(gfx::NativeWindow parent, | 44 void OpenAll(gfx::NativeWindow parent, |
| 45 content::PageNavigator* navigator, | 45 content::PageNavigator* navigator, |
| 46 const bookmarks::BookmarkNode* node, | 46 const bookmarks::BookmarkNode* node, |
| 47 WindowOpenDisposition initial_disposition, | 47 WindowOpenDisposition initial_disposition, |
| 48 content::BrowserContext* browser_context); | 48 content::BrowserContext* browser_context); |
| 49 | 49 |
| 50 // Returns the count of bookmarks that would be opened by OpenAll. If |
| 51 // |incognito_context| is set, the function will use it to check if the URLs can |
| 52 // be opened in incognito mode, which may affect the count. |
| 53 int OpenCount(gfx::NativeWindow parent, |
| 54 const std::vector<const bookmarks::BookmarkNode*>& nodes, |
| 55 content::BrowserContext* incognito_context = nullptr); |
| 56 |
| 57 // Convenience for OpenCount() with a single BookmarkNode. |
| 58 int OpenCount(gfx::NativeWindow parent, |
| 59 const bookmarks::BookmarkNode* node, |
| 60 content::BrowserContext* incognito_context = nullptr); |
| 61 |
| 50 // Asks the user before deleting a non-empty bookmark folder. | 62 // Asks the user before deleting a non-empty bookmark folder. |
| 51 bool ConfirmDeleteBookmarkNode(const bookmarks::BookmarkNode* node, | 63 bool ConfirmDeleteBookmarkNode(const bookmarks::BookmarkNode* node, |
| 52 gfx::NativeWindow window); | 64 gfx::NativeWindow window); |
| 53 | 65 |
| 54 // Shows the bookmark all tabs dialog. | 66 // Shows the bookmark all tabs dialog. |
| 55 void ShowBookmarkAllTabsDialog(Browser* browser); | 67 void ShowBookmarkAllTabsDialog(Browser* browser); |
| 56 | 68 |
| 57 // Returns true if OpenAll() can open at least one bookmark of type url | 69 // Returns true if OpenAll() can open at least one bookmark of type url |
| 58 // in |selection|. | 70 // in |selection|. |
| 59 bool HasBookmarkURLs( | 71 bool HasBookmarkURLs( |
| 60 const std::vector<const bookmarks::BookmarkNode*>& selection); | 72 const std::vector<const bookmarks::BookmarkNode*>& selection); |
| 61 | 73 |
| 62 // Returns true if OpenAll() can open at least one bookmark of type url | 74 // Returns true if OpenAll() can open at least one bookmark of type url |
| 63 // in |selection| with incognito mode. | 75 // in |selection| with incognito mode. |
| 64 bool HasBookmarkURLsAllowedInIncognitoMode( | 76 bool HasBookmarkURLsAllowedInIncognitoMode( |
| 65 const std::vector<const bookmarks::BookmarkNode*>& selection, | 77 const std::vector<const bookmarks::BookmarkNode*>& selection, |
| 66 content::BrowserContext* browser_context); | 78 content::BrowserContext* browser_context); |
| 67 | 79 |
| 68 } // namespace chrome | 80 } // namespace chrome |
| 69 | 81 |
| 70 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_DESKTOP_H_ | 82 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_DESKTOP_H_ |
| OLD | NEW |