diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-23 17:58:08 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-23 17:58:08 +0000 |
commit | b4329dc5eb2479619709d35c4bec1ca7a6659507 (patch) | |
tree | db8153bd676802a8224e44c7b1c379181efbd687 | |
parent | 0b5cabf89066b80446138ecfe288af25a5f4e3f9 (diff) | |
download | chromium_src-b4329dc5eb2479619709d35c4bec1ca7a6659507.zip chromium_src-b4329dc5eb2479619709d35c4bec1ca7a6659507.tar.gz chromium_src-b4329dc5eb2479619709d35c4bec1ca7a6659507.tar.bz2 |
When waiting for server, show a 'Working' message instead of 'Speak now'.
Also request the server to return a max of 3 results in the response. This is in preparation to test
multiple recognition results in a future CL.
BUG=none
TEST=no change in functionality.
Review URL: http://codereview.chromium.org/5281003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67115 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 19 insertions, 4 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 17fd479..74f3d62 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -11068,6 +11068,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_SPEECH_INPUT_BUBBLE_HEADING" desc="First line in the content area of the speech input bubble. Instructs the user that they can start speaking."> Speak now </message> + <message name="IDS_SPEECH_INPUT_BUBBLE_WORKING" desc="Message shown to the user while waiting for speech recognition results to arrive."> + Working + </message> <message name="IDS_SPEECH_INPUT_ERROR" desc="Message shown when audio recording failed with an error during speech recognition."> Audio recording device returned an error. </message> diff --git a/chrome/browser/cocoa/speech_input_window_controller.mm b/chrome/browser/cocoa/speech_input_window_controller.mm index 76d1dd1..005f37a 100644 --- a/chrome/browser/cocoa/speech_input_window_controller.mm +++ b/chrome/browser/cocoa/speech_input_window_controller.mm @@ -146,12 +146,15 @@ const int kBubbleHorizontalMargin = 5; // Space on either sides of controls. [iconImage_ setHidden:YES]; [tryAgainButton_ setHidden:NO]; } else { - [instructionLabel_ setStringValue:l10n_util::GetNSString( - IDS_SPEECH_INPUT_BUBBLE_HEADING)]; if (mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING) { + [instructionLabel_ setStringValue:l10n_util::GetNSString( + IDS_SPEECH_INPUT_BUBBLE_HEADING)]; NSImage* icon = ResourceBundle::GetSharedInstance().GetNativeImageNamed( IDR_SPEECH_INPUT_MIC_EMPTY); [iconImage_ setImage:icon]; + } else { + [instructionLabel_ setStringValue:l10n_util::GetNSString( + IDS_SPEECH_INPUT_BUBBLE_WORKING)]; } [iconImage_ setHidden:NO]; [iconImage_ setNeedsDisplay:YES]; diff --git a/chrome/browser/speech/speech_input_bubble_gtk.cc b/chrome/browser/speech/speech_input_bubble_gtk.cc index 923f327..2b159bf 100644 --- a/chrome/browser/speech/speech_input_bubble_gtk.cc +++ b/chrome/browser/speech/speech_input_bubble_gtk.cc @@ -179,14 +179,17 @@ void SpeechInputBubbleGtk::UpdateLayout() { } else { // Heading text, icon and cancel button are visible, hide the Try Again // button. - gtk_label_set_text(GTK_LABEL(label_), - l10n_util::GetStringUTF8(IDS_SPEECH_INPUT_BUBBLE_HEADING).c_str()); if (display_mode() == DISPLAY_MODE_RECORDING) { + gtk_label_set_text(GTK_LABEL(label_), + l10n_util::GetStringUTF8(IDS_SPEECH_INPUT_BUBBLE_HEADING).c_str()); SkBitmap* image = ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_SPEECH_INPUT_MIC_EMPTY); GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(image); gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), pixbuf); g_object_unref(pixbuf); + } else { + gtk_label_set_text(GTK_LABEL(label_), + l10n_util::GetStringUTF8(IDS_SPEECH_INPUT_BUBBLE_WORKING).c_str()); } gtk_widget_show(icon_); gtk_widget_hide(try_again_button_); diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index 7f2d52a..2dd624f 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -103,8 +103,11 @@ void ContentView::UpdateLayout(SpeechInputBubbleBase::DisplayMode mode, if (mode == SpeechInputBubbleBase::DISPLAY_MODE_MESSAGE) { message_->SetText(UTF16ToWideHack(message_text)); } else if (mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING) { + heading_->SetText(l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_HEADING)); icon_->SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_SPEECH_INPUT_MIC_EMPTY)); + } else { + heading_->SetText(l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_WORKING)); } } diff --git a/chrome/browser/speech/speech_recognition_request.cc b/chrome/browser/speech/speech_recognition_request.cc index 63a6c92..b1234b0 100644 --- a/chrome/browser/speech/speech_recognition_request.cc +++ b/chrome/browser/speech/speech_recognition_request.cc @@ -148,6 +148,9 @@ bool SpeechRecognitionRequest::Send(const std::string& language, parts.push_back("lm=" + EscapeQueryParamValue(grammar, true)); if (!hardware_info.empty()) parts.push_back("xhw=" + EscapeQueryParamValue(hardware_info, true)); + // TODO(satish): Remove this hardcoded value once the page is allowed to + // set this via an attribute. + parts.push_back("maxresults=3"); GURL url(std::string(kDefaultSpeechRecognitionUrl) + JoinString(parts, '&')); |