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

Unified Diff: chrome/browser/ui/views/speech_recognition_bubble_views.cc

Issue 167283005: Close SpeechRecognitionBubble on pressing the Escape key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comment. Created 6 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/speech_recognition_bubble_views.cc
diff --git a/chrome/browser/ui/views/speech_recognition_bubble_views.cc b/chrome/browser/ui/views/speech_recognition_bubble_views.cc
index f7a122c5f24f4c1251d2bcceca1dac7bee0eb3c2..a49e3120a0184af2f30ba969589db1eebb89ef47 100644
--- a/chrome/browser/ui/views/speech_recognition_bubble_views.cc
+++ b/chrome/browser/ui/views/speech_recognition_bubble_views.cc
@@ -64,6 +64,7 @@ class SpeechRecognitionBubbleView : public views::BubbleDelegateView,
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// views::View overrides.
+ virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
@@ -225,6 +226,17 @@ void SpeechRecognitionBubbleView::LinkClicked(views::Link* source,
content::SpeechRecognitionManager::GetInstance()->ShowAudioInputSettings();
}
+bool SpeechRecognitionBubbleView::AcceleratorPressed(
+ const ui::Accelerator& accelerator) {
+ // The accelerator is added by BubbleDelegateView.
+ if (accelerator.key_code() == ui::VKEY_ESCAPE) {
+ delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_CANCEL);
+ return true;
+ }
+
+ return BubbleDelegateView::AcceleratorPressed(accelerator);
+}
+
gfx::Size SpeechRecognitionBubbleView::GetPreferredSize() {
int width = heading_->GetPreferredSize().width();
int control_width = cancel_->GetPreferredSize().width();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698