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 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 while (iterator.has_next()) { | 133 while (iterator.has_next()) { |
134 iterator.NextURL(); | 134 iterator.NextURL(); |
135 child_count++; | 135 child_count++; |
136 } | 136 } |
137 | 137 |
138 if (child_count < num_bookmark_urls_before_prompting) | 138 if (child_count < num_bookmark_urls_before_prompting) |
139 return true; | 139 return true; |
140 | 140 |
141 return ShowQuestionMessageBox( | 141 return ShowQuestionMessageBox( |
142 parent, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 142 parent, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
143 l10n_util::GetStringFUTF16(IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL, | 143 l10n_util::GetPluralStringFUTF16(IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL, |
144 base::IntToString16(child_count))) == | 144 child_count)) == |
145 MESSAGE_BOX_RESULT_YES; | 145 MESSAGE_BOX_RESULT_YES; |
146 } | 146 } |
147 #endif | 147 #endif |
148 | 148 |
149 // Returns the total number of descendants nodes. | 149 // Returns the total number of descendants nodes. |
150 int ChildURLCountTotal(const BookmarkNode* node) { | 150 int ChildURLCountTotal(const BookmarkNode* node) { |
151 int result = 0; | 151 int result = 0; |
152 for (int i = 0; i < node->child_count(); ++i) { | 152 for (int i = 0; i < node->child_count(); ++i) { |
153 const BookmarkNode* child = node->GetChild(i); | 153 const BookmarkNode* child = node->GetChild(i); |
154 result++; | 154 result++; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 std::vector<const BookmarkNode*> nodes; | 224 std::vector<const BookmarkNode*> nodes; |
225 nodes.push_back(node); | 225 nodes.push_back(node); |
226 OpenAll(parent, navigator, nodes, initial_disposition, browser_context); | 226 OpenAll(parent, navigator, nodes, initial_disposition, browser_context); |
227 } | 227 } |
228 | 228 |
229 bool ConfirmDeleteBookmarkNode(const BookmarkNode* node, | 229 bool ConfirmDeleteBookmarkNode(const BookmarkNode* node, |
230 gfx::NativeWindow window) { | 230 gfx::NativeWindow window) { |
231 DCHECK(node && node->is_folder() && !node->empty()); | 231 DCHECK(node && node->is_folder() && !node->empty()); |
232 return ShowQuestionMessageBox( | 232 return ShowQuestionMessageBox( |
233 window, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 233 window, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
234 l10n_util::GetStringFUTF16Int(IDS_BOOKMARK_EDITOR_CONFIRM_DELETE, | 234 l10n_util::GetPluralStringFUTF16( |
235 ChildURLCountTotal(node))) == | 235 IDS_BOOKMARK_EDITOR_CONFIRM_DELETE, |
| 236 ChildURLCountTotal(node))) == |
236 MESSAGE_BOX_RESULT_YES; | 237 MESSAGE_BOX_RESULT_YES; |
237 } | 238 } |
238 | 239 |
239 void ShowBookmarkAllTabsDialog(Browser* browser) { | 240 void ShowBookmarkAllTabsDialog(Browser* browser) { |
240 Profile* profile = browser->profile(); | 241 Profile* profile = browser->profile(); |
241 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); | 242 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); |
242 DCHECK(model && model->loaded()); | 243 DCHECK(model && model->loaded()); |
243 | 244 |
244 const BookmarkNode* parent = model->GetParentForNewNodes(); | 245 const BookmarkNode* parent = model->GetParentForNewNodes(); |
245 BookmarkEditor::EditDetails details = | 246 BookmarkEditor::EditDetails details = |
(...skipping 17 matching lines...) Expand all Loading... |
263 while (iterator.has_next()) { | 264 while (iterator.has_next()) { |
264 const GURL* url = iterator.NextURL(); | 265 const GURL* url = iterator.NextURL(); |
265 if (IsURLAllowedInIncognito(*url, browser_context)) | 266 if (IsURLAllowedInIncognito(*url, browser_context)) |
266 return true; | 267 return true; |
267 } | 268 } |
268 return false; | 269 return false; |
269 } | 270 } |
270 #endif // !defined(OS_ANDROID) | 271 #endif // !defined(OS_ANDROID) |
271 | 272 |
272 } // namespace chrome | 273 } // namespace chrome |
OLD | NEW |