Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6156)

Unified Diff: chrome/views/controls/message_box_view.cc

Issue 93112: Make messages in javascript's alert copyable.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/views/controls/message_box_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/controls/message_box_view.cc
===================================================================
--- chrome/views/controls/message_box_view.cc (revision 14268)
+++ chrome/views/controls/message_box_view.cc (working copy)
@@ -5,8 +5,11 @@
#include "chrome/views/controls/message_box_view.h"
#include "base/message_loop.h"
+#include "base/scoped_clipboard_writer.h"
#include "base/string_util.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/views/standard_layout.h"
+#include "chrome/common/clipboard_service.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/message_box_flags.h"
#include "chrome/views/controls/button/checkbox.h"
@@ -87,6 +90,20 @@
}
}
+bool MessageBoxView::AcceleratorPressed(
+ const views::Accelerator& accelerator) {
+ // We only accepts Ctrl-C.
+ DCHECK(accelerator.GetKeyCode() == 'C' && accelerator.IsCtrlDown());
+
+ ClipboardService* clipboard = g_browser_process->clipboard_service();
+ if (!clipboard)
+ return false;
+
+ ScopedClipboardWriter scw(clipboard);
+ scw.WriteText(message_label_->GetText());
+ return true;
+}
+
///////////////////////////////////////////////////////////////////////////////
// MessageBoxView, private:
« no previous file with comments | « chrome/views/controls/message_box_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698