summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 18:03:35 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 18:03:35 +0000
commitd63109949c8c665f8235fa100e1c43b6a5ebdfef (patch)
tree3b492d20e58fc08e782851007f2ad71b765be238 /chrome/browser/bookmarks
parente133781225547774dab6be9dbbb323b38671a730 (diff)
downloadchromium_src-d63109949c8c665f8235fa100e1c43b6a5ebdfef.zip
chromium_src-d63109949c8c665f8235fa100e1c43b6a5ebdfef.tar.gz
chromium_src-d63109949c8c665f8235fa100e1c43b6a5ebdfef.tar.bz2
gtk: Show confirmation dialog while opening a lot of bookmarks.
BUG=34481, 35911 TEST=have at least 15 bookmarks on bookmarks bar or other bookmarks, right click on one of those and click on Open all bookmarks. An confirmation dialog box should be shown. Patch from Thiago Farina <thiago.farina@gmail.com> Review URL: http://codereview.chromium.org/1535001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index 5aada78..2214e4c 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -41,6 +41,7 @@
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#elif defined(TOOLKIT_GTK)
+#include "app/gtk_util.h"
#include "chrome/browser/gtk/custom_drag.h"
#endif
@@ -163,13 +164,31 @@ bool ShouldOpenAll(gfx::NativeWindow parent,
if (descendant_count < bookmark_utils::num_urls_before_prompting)
return true;
+ // Bug 40011: we should refactor this into a cross-platform "prompt before
+ // continuing" function.
+#if defined(OS_WIN)
std::wstring message =
l10n_util::GetStringF(IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL,
IntToWString(descendant_count));
-#if defined(OS_WIN)
return MessageBox(parent, message.c_str(),
l10n_util::GetString(IDS_PRODUCT_NAME).c_str(),
MB_YESNO | MB_ICONWARNING | MB_TOPMOST) == IDYES;
+#elif defined(TOOLKIT_GTK)
+ std::string message = l10n_util::GetStringFUTF8(
+ IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL,
+ IntToString16(descendant_count));
+ GtkWidget* dialog = gtk_message_dialog_new(parent,
+ static_cast<GtkDialogFlags>(
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "%s", message.c_str());
+ gtk_util::ApplyMessageDialogQuirks(dialog);
+ gtk_window_set_title(GTK_WINDOW(dialog),
+ l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
+ gint result = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ return (result == GTK_RESPONSE_YES);
#else
// TODO(port): Display a dialog prompt.
// http://crbug.com/34481