summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-02 22:05:41 +0000
committerhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-02 22:05:41 +0000
commit25bed9245b56e3f22644bd27e223ca03c4ca467e (patch)
tree9c57395fb55c1587a163f911d511339e29fad5d8
parentc660de10b58b985273675396a214a3f4bf968a20 (diff)
downloadchromium_src-25bed9245b56e3f22644bd27e223ca03c4ca467e.zip
chromium_src-25bed9245b56e3f22644bd27e223ca03c4ca467e.tar.gz
chromium_src-25bed9245b56e3f22644bd27e223ca03c4ca467e.tar.bz2
Start removing support for the experimental x-webkit-speech API
The API has been considered deprecated for some time, and was disabled in https://src.chromium.org/viewvc/blink?revision=171373&view=revision BUG=223198 TBR=jam@chromium.org Review URL: https://codereview.chromium.org/260903010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267937 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/ios/grit_whitelist.txt6
-rw-r--r--chrome/app/chrome_command_ids.h5
-rw-r--r--chrome/app/generated_resources.grd28
-rw-r--r--chrome/app/nibs/SpeechRecognitionBubble.xib825
-rw-r--r--chrome/app/theme/default_100_percent/common/speech_input_mic_empty.pngbin107 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/speech_input_mic_full.pngbin101 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/speech_input_mic_mask.pngbin86 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/speech_input_mic_noise.pngbin102 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/speech_input_spinner.pngbin16546 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/speech_input_mic_empty.pngbin152 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/speech_input_mic_full.pngbin136 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/speech_input_mic_mask.pngbin105 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/speech_input_mic_noise.pngbin136 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/speech_input_spinner.pngbin13035 -> 0 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd5
-rw-r--r--chrome/browser/chrome_content_browser_client.cc10
-rw-r--r--chrome/browser/renderer_context_menu/render_view_context_menu.cc54
-rw-r--r--chrome/browser/renderer_context_menu/render_view_context_menu.h2
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc41
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_manager_delegate.h3
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.cc220
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.h62
-rw-r--r--chrome/browser/speech/speech_recognition_bubble.cc283
-rw-r--r--chrome/browser/speech/speech_recognition_bubble.h205
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_browsertest.cc77
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_controller.cc218
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_controller.h136
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc209
-rw-r--r--chrome/browser/ui/browser_commands.cc7
-rw-r--r--chrome/browser/ui/cocoa/speech_recognition_bubble_cocoa.mm142
-rw-r--r--chrome/browser/ui/cocoa/speech_recognition_window_controller.h62
-rw-r--r--chrome/browser/ui/cocoa/speech_recognition_window_controller.mm232
-rw-r--r--chrome/browser/ui/views/speech_recognition_bubble_views.cc438
-rw-r--r--chrome/chrome_browser.gypi12
-rw-r--r--chrome/chrome_browser_ui.gypi5
-rw-r--r--chrome/chrome_nibs.gyp2
-rw-r--r--chrome/chrome_nibs.gypi1
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/chrome_tests_unit.gypi1
-rw-r--r--chrome/common/url_constants.cc3
-rw-r--r--chrome/common/url_constants.h3
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc5
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc4
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h1
-rw-r--r--content/browser/speech/input_tag_speech_browsertest.cc139
-rw-r--r--content/browser/speech/input_tag_speech_dispatcher_host.cc240
-rw-r--r--content/browser/speech/input_tag_speech_dispatcher_host.h93
-rw-r--r--content/browser/speech/speech_recognition_dispatcher_host.cc4
-rw-r--r--content/browser/speech/speech_recognition_manager_impl.cc4
-rw-r--r--content/common/frame_messages.h1
-rw-r--r--content/common/speech_recognition_messages.h61
-rw-r--r--content/content_browser.gypi8
-rw-r--r--content/content_renderer.gypi8
-rw-r--r--content/content_tests.gypi1
-rw-r--r--content/public/browser/render_view_host.h2
-rw-r--r--content/public/browser/speech_recognition_session_config.h2
-rw-r--r--content/public/browser/speech_recognition_session_context.cc3
-rw-r--r--content/public/browser/speech_recognition_session_context.h8
-rw-r--r--content/public/common/context_menu_params.cc1
-rw-r--r--content/public/common/context_menu_params.h3
-rw-r--r--content/renderer/context_menu_params_builder.cc1
-rw-r--r--content/renderer/input_tag_speech_dispatcher.cc147
-rw-r--r--content/renderer/input_tag_speech_dispatcher.h56
-rw-r--r--content/renderer/render_view_impl.cc12
-rw-r--r--content/renderer/render_view_impl.h8
-rw-r--r--content/shell/renderer/test_runner/MockWebSpeechInputController.h2
-rw-r--r--content/test/data/speech/basic_recognition.html24
-rw-r--r--content/test/data/speech/grammar_attribute.html25
68 files changed, 21 insertions, 4140 deletions
diff --git a/build/ios/grit_whitelist.txt b/build/ios/grit_whitelist.txt
index a9f660b..e7673e4 100644
--- a/build/ios/grit_whitelist.txt
+++ b/build/ios/grit_whitelist.txt
@@ -833,12 +833,6 @@ IDS_SHOW_HISTORY
IDS_SIGNED_IN_WITH_SYNC_DISABLED
IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED
IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE
-IDS_SPEECH_INPUT_ABORTED
-IDS_SPEECH_INPUT_MIC_ERROR
-IDS_SPEECH_INPUT_NET_ERROR
-IDS_SPEECH_INPUT_NO_MIC
-IDS_SPEECH_INPUT_NO_RESULTS
-IDS_SPEECH_INPUT_NO_SPEECH
IDS_SSL_BLOCKING_PAGE_TITLE
IDS_SYNC_ACCOUNT_SYNCING_TO_USER
IDS_SYNC_ACCOUNT_SYNCING_TO_USER_WITH_MANAGE_LINK
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h
index 2bec758..75a3a44 100644
--- a/chrome/app/chrome_command_ids.h
+++ b/chrome/app/chrome_command_ids.h
@@ -343,11 +343,6 @@
// Context menu items in the status tray
#define IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND 51100
-// Context menu items for speech recognition
-#define IDC_SPEECH_INPUT_MENU 51200
-#define IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES 51201
-#define IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT 51202
-
// Context menu items for media stream status tray
#define IDC_MEDIA_STREAM_DEVICE_STATUS_TRAY 51300
#define IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_FIRST 51301
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 3044785..0ebde23 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -13329,34 +13329,6 @@ Some features may be unavailable. Please check that the profile exists and you
Keep using <ph name="CURRENT_GOOGLE_HOST">$1<ex>google.fr</ex></ph>
</message>
- <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_ABORTED" desc="Message shown when speech recognition is aborted (due to another request).">
- Speech recognition was aborted.
- </message>
- <message name="IDS_SPEECH_INPUT_MIC_ERROR" desc="Message shown when audio recording failed with an error during speech recognition.">
- There was a problem with your microphone.
- </message>
- <message name="IDS_SPEECH_INPUT_NO_MIC" desc="Message shown when speech recognizer could not find a suitable microphone or other audio input device.">
- No microphone found.
- </message>
- <message name="IDS_SPEECH_INPUT_NO_SPEECH" desc="Message shown when speech recognizer detected no speech in the recorded audio.">
- No speech heard.
- </message>
- <message name="IDS_SPEECH_INPUT_NO_RESULTS" desc="Message shown when speech recognizer returned zero results.">
- Speech not recognized.
- </message>
- <message name="IDS_SPEECH_INPUT_TRY_AGAIN" desc="Text shown on a button to retry speech recognition">
- Try again
- </message>
- <message name="IDS_SPEECH_INPUT_NET_ERROR" desc="Message shown when a network error occurred and no results were received from the recognition server.">
- Connection to speech servers failed.
- </message>
- <message name="IDS_SPEECH_INPUT_MIC_SETTINGS" desc="Text displayed on a button or link to open the microphone settings window.">
- Microphone settings
- </message>
-
<message name="IDS_IMAGE_FILES" desc="The description of the image file extensions in the select file dialog.">
Image Files
</message>
diff --git a/chrome/app/nibs/SpeechRecognitionBubble.xib b/chrome/app/nibs/SpeechRecognitionBubble.xib
deleted file mode 100644
index 1ff4190..0000000
--- a/chrome/app/nibs/SpeechRecognitionBubble.xib
+++ /dev/null
@@ -1,825 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1070</int>
- <string key="IBDocument.SystemVersion">12B19</string>
- <string key="IBDocument.InterfaceBuilderVersion">2549</string>
- <string key="IBDocument.AppKitVersion">1187</string>
- <string key="IBDocument.HIToolboxVersion">624.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">2549</string>
- </object>
- <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSButton</string>
- <string>NSButtonCell</string>
- <string>NSCustomObject</string>
- <string>NSCustomView</string>
- <string>NSImageCell</string>
- <string>NSImageView</string>
- <string>NSTextField</string>
- <string>NSTextFieldCell</string>
- <string>NSView</string>
- <string>NSWindowTemplate</string>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
- <integer value="1" key="NS.object.0"/>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1021">
- <string key="NSClassName">SpeechRecognitionWindowController</string>
- </object>
- <object class="NSCustomObject" id="1014">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1050">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="513744381">
- <int key="NSWindowStyleMask">15</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 320}, {190, 190}}</string>
- <int key="NSWTFlags">611847168</int>
- <string key="NSWindowTitle">Window</string>
- <string key="NSWindowClass">InfoBubbleWindow</string>
- <nil key="NSViewClass"/>
- <nil key="NSUserInterfaceItemIdentifier"/>
- <object class="NSView" key="NSWindowView" id="414427165">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomView" id="926910107">
- <reference key="NSNextResponder" ref="414427165"/>
- <int key="NSvFlags">301</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSButton" id="476113060">
- <reference key="NSNextResponder" ref="926910107"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{7, 113}, {96, 32}}</string>
- <reference key="NSSuperview" ref="926910107"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="607686812">
- <int key="NSCellFlags">67108864</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">^IDS_SPEECH_INPUT_MIC_SETTINGS</string>
- <object class="NSFont" key="NSSupport" id="487155245">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="476113060"/>
- <int key="NSButtonFlags">-2046672896</int>
- <int key="NSButtonFlags2">134</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
- </object>
- <object class="NSButton" id="1038338233">
- <reference key="NSNextResponder" ref="926910107"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{14, 12}, {82, 32}}</string>
- <reference key="NSSuperview" ref="926910107"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="84459405">
- <int key="NSCellFlags">67108864</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">^IDS_SPEECH_INPUT_TRY_AGAIN</string>
- <reference key="NSSupport" ref="487155245"/>
- <reference key="NSControlView" ref="1038338233"/>
- <int key="NSButtonFlags">-2038284288</int>
- <int key="NSButtonFlags2">129</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
- </object>
- <object class="NSButton" id="789820196">
- <reference key="NSNextResponder" ref="926910107"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{88, 12}, {88, 32}}</string>
- <reference key="NSSuperview" ref="926910107"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="541512844">
- <int key="NSCellFlags">67108864</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">^IDS_CANCEL</string>
- <reference key="NSSupport" ref="487155245"/>
- <reference key="NSControlView" ref="789820196"/>
- <int key="NSButtonFlags">-2038284288</int>
- <int key="NSButtonFlags2">129</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
- </object>
- <object class="NSImageView" id="793691203">
- <reference key="NSNextResponder" ref="926910107"/>
- <int key="NSvFlags">268</int>
- <object class="NSMutableSet" key="NSDragTypes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="set.sortedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>Apple PDF pasteboard type</string>
- <string>Apple PICT pasteboard type</string>
- <string>Apple PNG pasteboard type</string>
- <string>NSFilenamesPboardType</string>
- <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
- <string>NeXT TIFF v4.0 pasteboard type</string>
- </object>
- </object>
- <string key="NSFrame">{{69, 72}, {51, 51}}</string>
- <reference key="NSSuperview" ref="926910107"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSImageCell" key="NSCell" id="709197696">
- <int key="NSCellFlags">134217728</int>
- <int key="NSCellFlags2">33587200</int>
- <object class="NSCustomResource" key="NSContents">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">speech_input_recording</string>
- </object>
- <int key="NSAlign">0</int>
- <int key="NSScale">0</int>
- <int key="NSStyle">0</int>
- <bool key="NSAnimates">NO</bool>
- </object>
- <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
- <bool key="NSEditable">YES</bool>
- </object>
- <object class="NSTextField" id="530565492">
- <reference key="NSNextResponder" ref="926910107"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{17, 153}, {156, 17}}</string>
- <reference key="NSSuperview" ref="926910107"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="806350986">
- <int key="NSCellFlags">67108864</int>
- <int key="NSCellFlags2">138444800</int>
- <string key="NSContents">^IDS_SPEECH_INPUT_BUBBLE_HEADING</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">16</int>
- </object>
- <reference key="NSControlView" ref="530565492"/>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlTextColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- </object>
- </object>
- <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
- </object>
- </object>
- <string key="NSFrameSize">{190, 190}</string>
- <reference key="NSSuperview" ref="414427165"/>
- <reference key="NSWindow"/>
- <string key="NSClassName">InfoBubbleView</string>
- </object>
- </object>
- <string key="NSFrameSize">{190, 190}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
- <bool key="NSWindowIsRestorable">YES</bool>
- </object>
- <object class="NSCustomObject" id="19393743">
- <string key="NSClassName">ChromeUILocalizer</string>
- </object>
- <object class="NSCustomObject" id="184494044">
- <string key="NSClassName">GTMUILocalizerAndLayoutTweaker</string>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">cancelButton_</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="789820196"/>
- </object>
- <int key="connectionID">829</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">iconImage_</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="793691203"/>
- </object>
- <int key="connectionID">830</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="513744381"/>
- </object>
- <int key="connectionID">833</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">cancel:</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="789820196"/>
- </object>
- <int key="connectionID">834</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">bubble_</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="926910107"/>
- </object>
- <int key="connectionID">835</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">instructionLabel_</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="530565492"/>
- </object>
- <int key="connectionID">836</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tryAgainButton_</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="1038338233"/>
- </object>
- <int key="connectionID">840</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">tryAgain:</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="1038338233"/>
- </object>
- <int key="connectionID">841</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">micSettings:</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="476113060"/>
- </object>
- <int key="connectionID">844</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">micSettingsButton_</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="476113060"/>
- </object>
- <int key="connectionID">845</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="513744381"/>
- <reference key="destination" ref="1021"/>
- </object>
- <int key="connectionID">828</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">owner_</string>
- <reference key="source" ref="19393743"/>
- <reference key="destination" ref="1021"/>
- </object>
- <int key="connectionID">837</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1048"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1021"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1014"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1050"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">367</int>
- <reference key="object" ref="513744381"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="414427165"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">368</int>
- <reference key="object" ref="414427165"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="926910107"/>
- </object>
- <reference key="parent" ref="513744381"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">818</int>
- <reference key="object" ref="19393743"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">819</int>
- <reference key="object" ref="184494044"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">825</int>
- <reference key="object" ref="926910107"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="530565492"/>
- <reference ref="793691203"/>
- <reference ref="789820196"/>
- <reference ref="1038338233"/>
- <reference ref="476113060"/>
- </object>
- <reference key="parent" ref="414427165"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">811</int>
- <reference key="object" ref="530565492"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="806350986"/>
- </object>
- <reference key="parent" ref="926910107"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">812</int>
- <reference key="object" ref="806350986"/>
- <reference key="parent" ref="530565492"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">815</int>
- <reference key="object" ref="793691203"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="709197696"/>
- </object>
- <reference key="parent" ref="926910107"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">816</int>
- <reference key="object" ref="709197696"/>
- <reference key="parent" ref="793691203"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">813</int>
- <reference key="object" ref="789820196"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="541512844"/>
- </object>
- <reference key="parent" ref="926910107"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">814</int>
- <reference key="object" ref="541512844"/>
- <reference key="parent" ref="789820196"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">838</int>
- <reference key="object" ref="1038338233"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="84459405"/>
- </object>
- <reference key="parent" ref="926910107"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">839</int>
- <reference key="object" ref="84459405"/>
- <reference key="parent" ref="1038338233"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">842</int>
- <reference key="object" ref="476113060"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="607686812"/>
- </object>
- <reference key="parent" ref="926910107"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">843</int>
- <reference key="object" ref="607686812"/>
- <reference key="parent" ref="476113060"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.IBPluginDependency</string>
- <string>-2.IBPluginDependency</string>
- <string>-3.IBPluginDependency</string>
- <string>367.IBPluginDependency</string>
- <string>367.IBWindowTemplateEditedContentRect</string>
- <string>367.NSWindowTemplate.visibleAtLaunch</string>
- <string>368.IBPluginDependency</string>
- <string>811.IBPluginDependency</string>
- <string>812.IBPluginDependency</string>
- <string>813.IBPluginDependency</string>
- <string>814.IBPluginDependency</string>
- <string>815.IBPluginDependency</string>
- <string>816.IBPluginDependency</string>
- <string>818.IBPluginDependency</string>
- <string>819.IBPluginDependency</string>
- <string>825.IBPluginDependency</string>
- <string>838.IBPluginDependency</string>
- <string>839.IBPluginDependency</string>
- <string>842.IBPluginDependency</string>
- <string>843.CustomClassName</string>
- <string>843.IBPluginDependency</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{541, 417}, {190, 190}}</string>
- <boolean value="NO"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>HyperlinkButtonCell</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">845</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">BaseBubbleController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">bubble_</string>
- <string key="NS.object.0">InfoBubbleView</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">bubble_</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">bubble_</string>
- <string key="candidateClassName">InfoBubbleView</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/BaseBubbleController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ChromeEventProcessingWindow</string>
- <string key="superclassName">UnderlayOpenGLHostingWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/ChromeEventProcessingWindow.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ChromeUILocalizer</string>
- <string key="superclassName">GTMUILocalizer</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/ChromeUILocalizer.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">GTMUILocalizer</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>otherObjectToLocalize_</string>
- <string>owner_</string>
- <string>yetAnotherObjectToLocalize_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>otherObjectToLocalize_</string>
- <string>owner_</string>
- <string>yetAnotherObjectToLocalize_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">otherObjectToLocalize_</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">owner_</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">yetAnotherObjectToLocalize_</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/GTMUILocalizer.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">GTMUILocalizerAndLayoutTweaker</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>localizerOwner_</string>
- <string>localizer_</string>
- <string>uiObject_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>GTMUILocalizer</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>localizerOwner_</string>
- <string>localizer_</string>
- <string>uiObject_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">localizerOwner_</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">localizer_</string>
- <string key="candidateClassName">GTMUILocalizer</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">uiObject_</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/GTMUILocalizerAndLayoutTweaker.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">HyperlinkButtonCell</string>
- <string key="superclassName">NSButtonCell</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/HyperlinkButtonCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">InfoBubbleView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/InfoBubbleView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">InfoBubbleWindow</string>
- <string key="superclassName">ChromeEventProcessingWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/InfoBubbleWindow.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">SpeechRecognitionWindowController</string>
- <string key="superclassName">BaseBubbleController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>cancel:</string>
- <string>micSettings:</string>
- <string>tryAgain:</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>cancel:</string>
- <string>micSettings:</string>
- <string>tryAgain:</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">cancel:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">micSettings:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">tryAgain:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>cancelButton_</string>
- <string>iconImage_</string>
- <string>instructionLabel_</string>
- <string>micSettingsButton_</string>
- <string>myOutlet1</string>
- <string>tryAgainButton_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSButton</string>
- <string>NSImageView</string>
- <string>NSTextField</string>
- <string>NSButton</string>
- <string>id</string>
- <string>NSButton</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>cancelButton_</string>
- <string>iconImage_</string>
- <string>instructionLabel_</string>
- <string>micSettingsButton_</string>
- <string>myOutlet1</string>
- <string>tryAgainButton_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">cancelButton_</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">iconImage_</string>
- <string key="candidateClassName">NSImageView</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">instructionLabel_</string>
- <string key="candidateClassName">NSTextField</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">micSettingsButton_</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">myOutlet1</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">tryAgainButton_</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/SpeechRecognitionWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UnderlayOpenGLHostingWindow</string>
- <string key="superclassName">NSWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/UnderlayOpenGLHostingWindow.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <real value="1070" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <string key="NS.key.0">speech_input_recording</string>
- <string key="NS.object.0">{128, 128}</string>
- </object>
- </data>
-</archive>
diff --git a/chrome/app/theme/default_100_percent/common/speech_input_mic_empty.png b/chrome/app/theme/default_100_percent/common/speech_input_mic_empty.png
deleted file mode 100644
index d17dc9c..0000000
--- a/chrome/app/theme/default_100_percent/common/speech_input_mic_empty.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/speech_input_mic_full.png b/chrome/app/theme/default_100_percent/common/speech_input_mic_full.png
deleted file mode 100644
index 247307c..0000000
--- a/chrome/app/theme/default_100_percent/common/speech_input_mic_full.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/speech_input_mic_mask.png b/chrome/app/theme/default_100_percent/common/speech_input_mic_mask.png
deleted file mode 100644
index 11696c0..0000000
--- a/chrome/app/theme/default_100_percent/common/speech_input_mic_mask.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/speech_input_mic_noise.png b/chrome/app/theme/default_100_percent/common/speech_input_mic_noise.png
deleted file mode 100644
index ef57c0d..0000000
--- a/chrome/app/theme/default_100_percent/common/speech_input_mic_noise.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/speech_input_spinner.png b/chrome/app/theme/default_100_percent/common/speech_input_spinner.png
deleted file mode 100644
index 108236b..0000000
--- a/chrome/app/theme/default_100_percent/common/speech_input_spinner.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/speech_input_mic_empty.png b/chrome/app/theme/default_200_percent/common/speech_input_mic_empty.png
deleted file mode 100644
index 9830ae1..0000000
--- a/chrome/app/theme/default_200_percent/common/speech_input_mic_empty.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/speech_input_mic_full.png b/chrome/app/theme/default_200_percent/common/speech_input_mic_full.png
deleted file mode 100644
index d7943de..0000000
--- a/chrome/app/theme/default_200_percent/common/speech_input_mic_full.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/speech_input_mic_mask.png b/chrome/app/theme/default_200_percent/common/speech_input_mic_mask.png
deleted file mode 100644
index 73211f3..0000000
--- a/chrome/app/theme/default_200_percent/common/speech_input_mic_mask.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/speech_input_mic_noise.png b/chrome/app/theme/default_200_percent/common/speech_input_mic_noise.png
deleted file mode 100644
index 37d53aa..0000000
--- a/chrome/app/theme/default_200_percent/common/speech_input_mic_noise.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/speech_input_spinner.png b/chrome/app/theme/default_200_percent/common/speech_input_spinner.png
deleted file mode 100644
index 4e78e79..0000000
--- a/chrome/app/theme/default_200_percent/common/speech_input_spinner.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 67e3392..cb07883 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -1078,11 +1078,6 @@
<structure type="chrome_scaled_image" name="IDR_ORIGIN_CHIP_MALWARE_HOVER_TOP_RIGHT" file="common/chip_malware_hover_top_right.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_SETTINGS_FAVICON" file="common/favicon_settings.png" />
- <structure type="chrome_scaled_image" name="IDR_SPEECH_INPUT_MIC_EMPTY" file="common/speech_input_mic_empty.png" />
- <structure type="chrome_scaled_image" name="IDR_SPEECH_INPUT_MIC_FULL" file="common/speech_input_mic_full.png" />
- <structure type="chrome_scaled_image" name="IDR_SPEECH_INPUT_MIC_MASK" file="common/speech_input_mic_mask.png" />
- <structure type="chrome_scaled_image" name="IDR_SPEECH_INPUT_MIC_NOISE" file="common/speech_input_mic_noise.png" />
- <structure type="chrome_scaled_image" name="IDR_SPEECH_INPUT_SPINNER" file="common/speech_input_spinner.png" />
<structure type="chrome_scaled_image" name="IDR_SHARE" file="share.png" />
<structure type="chrome_scaled_image" name="IDR_STAR" file="star.png" />
<structure type="chrome_scaled_image" name="IDR_STAR_LIT" file="star_lit.png" />
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 5063700..83055d5 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -215,10 +215,6 @@
#include "chrome/browser/media/webrtc_logging_handler_host.h"
#endif
-#if defined(ENABLE_INPUT_SPEECH)
-#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.h"
-#endif
-
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/file_manager/app_id.h"
#endif
@@ -2179,13 +2175,7 @@ void ChromeContentBrowserClient::ResourceDispatcherHostCreated() {
// TODO(tommi): Rename from Get to Create.
content::SpeechRecognitionManagerDelegate*
ChromeContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
-#if defined(ENABLE_INPUT_SPEECH)
- return new speech::ChromeSpeechRecognitionManagerDelegateBubbleUI();
-#else
- // Platforms who don't implement x-webkit-speech (a.k.a INPUT_SPEECH) just
- // need the base delegate without the bubble UI.
return new speech::ChromeSpeechRecognitionManagerDelegate();
-#endif
}
net::NetLog* ChromeContentBrowserClient::GetNetLog() {
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index a7e58d8..406a8f0 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -199,9 +199,6 @@ const struct UmaEnumCommandIdPair {
{ 46, IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS },
{ 47, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS },
{ 48, IDC_CONTENT_CONTEXT_ADDSEARCHENGINE },
- { 49, IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES },
- { 50, IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT },
- { 51, IDC_SPEECH_INPUT_MENU },
{ 52, IDC_CONTENT_CONTEXT_OPENLINKWITH },
{ 53, IDC_CHECK_SPELLING_WHILE_TYPING },
{ 54, IDC_SPELLCHECK_MENU },
@@ -412,7 +409,6 @@ RenderViewContextMenu::RenderViewContextMenu(
this,
&menu_model_,
base::Bind(MenuItemMatchesParams, params_)),
- speech_input_submenu_model_(this),
protocol_handler_submenu_model_(this),
protocol_handler_registry_(
ProtocolHandlerRegistryFactory::GetForProfile(profile_)),
@@ -1022,7 +1018,6 @@ void RenderViewContextMenu::AppendEditableItems() {
if (use_spellcheck_and_search)
AppendSpellcheckOptionsSubMenu();
- AppendSpeechInputOptionsSubMenu();
AppendPlatformEditableItems();
menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
@@ -1046,24 +1041,6 @@ void RenderViewContextMenu::AppendSpellcheckOptionsSubMenu() {
observers_.AddObserver(spellchecker_submenu_observer_.get());
}
-void RenderViewContextMenu::AppendSpeechInputOptionsSubMenu() {
- if (params_.speech_input_enabled) {
- speech_input_submenu_model_.AddCheckItem(
- IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES,
- l10n_util::GetStringUTF16(
- IDS_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES));
-
- speech_input_submenu_model_.AddItemWithStringId(
- IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT,
- IDS_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT);
-
- menu_model_.AddSubMenu(
- IDC_SPEECH_INPUT_MENU,
- l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPEECH_INPUT_MENU),
- &speech_input_submenu_model_);
- }
-}
-
void RenderViewContextMenu::AppendProtocolHandlerSubMenu() {
const ProtocolHandlerRegistry::ProtocolHandlerList handlers =
GetHandlersForLinkUrl();
@@ -1377,11 +1354,6 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
case IDC_SPELLCHECK_MENU:
return true;
- case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES:
- case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT:
- case IDC_SPEECH_INPUT_MENU:
- return true;
-
case IDC_CONTENT_CONTEXT_OPENLINKWITH:
return true;
@@ -1427,14 +1399,6 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const {
return extension_items_.IsCommandIdChecked(id);
}
-#if defined(ENABLE_INPUT_SPEECH)
- // Check box for menu item 'Block offensive words'.
- if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES) {
- return profile_->GetPrefs()->GetBoolean(
- prefs::kSpeechRecognitionFilterProfanities);
- }
-#endif
-
return false;
}
@@ -1861,24 +1825,6 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
break;
}
-#if defined(ENABLE_INPUT_SPEECH)
- case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: {
- profile_->GetPrefs()->SetBoolean(
- prefs::kSpeechRecognitionFilterProfanities,
- !profile_->GetPrefs()->GetBoolean(
- prefs::kSpeechRecognitionFilterProfanities));
- break;
- }
-#endif
- case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: {
- GURL url(chrome::kSpeechInputAboutURL);
- GURL localized_url = google_util::AppendGoogleLocaleParam(url);
- // Open URL with no referrer field (because user clicked on menu item).
- OpenURL(localized_url, GURL(), NEW_FOREGROUND_TAB,
- content::PAGE_TRANSITION_LINK);
- break;
- }
-
default:
NOTREACHED();
break;
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h
index 257bf15..2c9cac2 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.h
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h
@@ -226,7 +226,6 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate,
void AppendSearchWebForImageItems();
void AppendSpellingSuggestionsSubMenu();
void AppendSpellcheckOptionsSubMenu();
- void AppendSpeechInputOptionsSubMenu();
void AppendProtocolHandlerSubMenu();
// Opens the specified URL string in a new tab.
@@ -265,7 +264,6 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate,
// a text selection.
GURL selection_navigation_url_;
- ui::SimpleMenuModel speech_input_submenu_model_;
ui::SimpleMenuModel protocol_handler_submenu_model_;
ProtocolHandlerRegistry* protocol_handler_registry_;
diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc
index 668aae0..8761c8f 100644
--- a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc
+++ b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc
@@ -373,8 +373,7 @@ void ChromeSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
base::Bind(&CheckRenderViewType,
callback,
render_process_id,
- render_view_id,
- !context.requested_by_page_element));
+ render_view_id));
}
content::SpeechRecognitionEventListener*
@@ -397,8 +396,7 @@ bool ChromeSpeechRecognitionManagerDelegate::FilterProfanities(
void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType(
base::Callback<void(bool ask_user, bool is_allowed)> callback,
int render_process_id,
- int render_view_id,
- bool js_api) {
+ int render_view_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
const content::RenderViewHost* render_view_host =
content::RenderViewHost::FromID(render_process_id, render_view_id);
@@ -407,16 +405,9 @@ void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType(
bool check_permission = false;
if (!render_view_host) {
- if (!js_api) {
- // If there is no render view, we cannot show the speech bubble, so this
- // is not allowed.
- allowed = false;
- check_permission = false;
- } else {
- // This happens for extensions. Manifest should be checked for permission.
- allowed = true;
- check_permission = false;
- }
+ // This happens for extensions. Manifest should be checked for permission.
+ allowed = true;
+ check_permission = false;
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(callback, check_permission, allowed));
return;
@@ -434,28 +425,14 @@ void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType(
extensions::ViewType view_type = extensions::GetViewType(web_contents);
- // TODO(kalman): Also enable speech bubble for extension popups
- // (VIEW_TYPE_EXTENSION_POPUP) once popup-like control UI works properly in
- // extensions: http://crbug.com/163851.
- // Right now the extension popup closes and dismisses immediately on user
- // click.
if (view_type == extensions::VIEW_TYPE_TAB_CONTENTS ||
view_type == extensions::VIEW_TYPE_APP_WINDOW ||
view_type == extensions::VIEW_TYPE_VIRTUAL_KEYBOARD ||
- // Only allow requests through JavaScript API (|js_api| = true).
- // Requests originating from html element (|js_api| = false) would want
- // to show bubble which isn't quite intuitive from a background page. Also
- // see todo above about issues with rendering such bubbles from extension
- // popups.
- (view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE &&
- js_api)) {
- // If it is a tab, we can show the speech input bubble or check for
- // permission. For apps, this means manifest would be checked for
- // permission.
-
+ view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
+ // If it is a tab, we can check for permission. For apps, this means
+ // manifest would be checked for permission.
allowed = true;
- if (js_api)
- check_permission = true;
+ check_permission = true;
}
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h
index 1d33a71..cc57804 100644
--- a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h
+++ b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h
@@ -59,8 +59,7 @@ class ChromeSpeechRecognitionManagerDelegate
static void CheckRenderViewType(
base::Callback<void(bool ask_user, bool is_allowed)> callback,
int render_process_id,
- int render_view_id,
- bool js_api);
+ int render_view_id);
scoped_refptr<OptionalRequestInfo> optional_request_info_;
scoped_refptr<TabWatcher> tab_watcher_;
diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.cc b/chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.cc
deleted file mode 100644
index da18bd4..0000000
--- a/chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.cc
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/speech_recognition_manager.h"
-#include "content/public/browser/speech_recognition_session_context.h"
-#include "content/public/common/speech_recognition_error.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-
-using content::BrowserThread;
-using content::SpeechRecognitionManager;
-
-namespace {
-
-bool RequiresBubble(int session_id) {
- return SpeechRecognitionManager::GetInstance()->
- GetSessionContext(session_id).requested_by_page_element;
-}
-
-} // namespace
-
-namespace speech {
-
-ChromeSpeechRecognitionManagerDelegateBubbleUI
-::ChromeSpeechRecognitionManagerDelegateBubbleUI() {
-}
-
-ChromeSpeechRecognitionManagerDelegateBubbleUI
-::~ChromeSpeechRecognitionManagerDelegateBubbleUI() {
- if (bubble_controller_.get())
- bubble_controller_->CloseBubble();
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::InfoBubbleButtonClicked(
- int session_id, SpeechRecognitionBubble::Button button) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- // Note, the session might have been destroyed, therefore avoid calls to the
- // manager which imply its existance (e.g., GetSessionContext()).
-
- if (button == SpeechRecognitionBubble::BUTTON_CANCEL) {
- GetBubbleController()->CloseBubble();
- last_session_config_.reset();
-
- // We can safely call AbortSession even if the session has already ended,
- // the manager's public methods are reliable and will handle it properly.
- SpeechRecognitionManager::GetInstance()->AbortSession(session_id);
- } else if (button == SpeechRecognitionBubble::BUTTON_TRY_AGAIN) {
- GetBubbleController()->CloseBubble();
- RestartLastSession();
- } else {
- NOTREACHED();
- }
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::InfoBubbleFocusChanged(
- int session_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- // This check is needed since on some systems (MacOS), in rare cases, if the
- // user clicks repeatedly and fast on the input element, the FocusChanged
- // event (corresponding to the old session that should be aborted) can be
- // received after a new session (corresponding to the 2nd click) is started.
- if (GetBubbleController()->GetActiveSessionID() != session_id)
- return;
-
- // Note, the session might have been destroyed, therefore avoid calls to the
- // manager which imply its existance (e.g., GetSessionContext()).
- GetBubbleController()->CloseBubble();
- last_session_config_.reset();
-
- // Clicking outside the bubble means we should abort.
- SpeechRecognitionManager::GetInstance()->AbortSession(session_id);
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::OnRecognitionStart(
- int session_id) {
- ChromeSpeechRecognitionManagerDelegate::OnRecognitionStart(session_id);
-
- const content::SpeechRecognitionSessionContext& context =
- SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
-
- if (RequiresBubble(session_id)) {
- // Copy the configuration of the session (for the "try again" button).
- last_session_config_.reset(new content::SpeechRecognitionSessionConfig(
- SpeechRecognitionManager::GetInstance()->GetSessionConfig(session_id)));
-
- // Create and show the bubble. It will be closed upon the OnEnd event.
- GetBubbleController()->CreateBubble(session_id,
- context.render_process_id,
- context.render_view_id,
- context.element_rect);
- }
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::OnAudioStart(
- int session_id) {
- ChromeSpeechRecognitionManagerDelegate::OnAudioStart(session_id);
-
- if (RequiresBubble(session_id)) {
- DCHECK_EQ(session_id, GetBubbleController()->GetActiveSessionID());
- GetBubbleController()->SetBubbleRecordingMode();
- }
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::OnAudioEnd(
- int session_id) {
- ChromeSpeechRecognitionManagerDelegate::OnAudioEnd(session_id);
-
- // OnAudioEnd can be also raised after an abort, when the bubble has already
- // been closed.
- if (GetBubbleController()->GetActiveSessionID() == session_id) {
- DCHECK(RequiresBubble(session_id));
- GetBubbleController()->SetBubbleRecognizingMode();
- }
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::OnRecognitionError(
- int session_id, const content::SpeechRecognitionError& error) {
- ChromeSpeechRecognitionManagerDelegate::OnRecognitionError(session_id, error);
-
- // An error can be dispatched when the bubble is not visible anymore.
- if (GetBubbleController()->GetActiveSessionID() != session_id)
- return;
- DCHECK(RequiresBubble(session_id));
-
- int error_message_id = 0;
- switch (error.code) {
- case content::SPEECH_RECOGNITION_ERROR_AUDIO:
- switch (error.details) {
- case content::SPEECH_AUDIO_ERROR_DETAILS_NO_MIC:
- error_message_id = IDS_SPEECH_INPUT_NO_MIC;
- break;
- default:
- error_message_id = IDS_SPEECH_INPUT_MIC_ERROR;
- break;
- }
- break;
- case content::SPEECH_RECOGNITION_ERROR_ABORTED:
- error_message_id = IDS_SPEECH_INPUT_ABORTED;
- break;
- case content::SPEECH_RECOGNITION_ERROR_NO_SPEECH:
- error_message_id = IDS_SPEECH_INPUT_NO_SPEECH;
- break;
- case content::SPEECH_RECOGNITION_ERROR_NO_MATCH:
- error_message_id = IDS_SPEECH_INPUT_NO_RESULTS;
- break;
- case content::SPEECH_RECOGNITION_ERROR_NETWORK:
- error_message_id = IDS_SPEECH_INPUT_NET_ERROR;
- break;
- default:
- NOTREACHED() << "unknown error " << error.code;
- return;
- }
- GetBubbleController()->SetBubbleMessage(
- l10n_util::GetStringUTF16(error_message_id));
-
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::OnAudioLevelsChange(
- int session_id, float volume, float noise_volume) {
- ChromeSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
- session_id, volume, noise_volume);
-
- if (GetBubbleController()->GetActiveSessionID() == session_id) {
- DCHECK(RequiresBubble(session_id));
- GetBubbleController()->SetBubbleInputVolume(volume, noise_volume);
- }
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::OnRecognitionEnd(
- int session_id) {
- ChromeSpeechRecognitionManagerDelegate::OnRecognitionEnd(session_id);
-
- // The only case in which the OnRecognitionEnd should not close the bubble is
- // when we are showing an error. In this case the bubble will be closed by
- // the |InfoBubbleFocusChanged| method, when the users clicks either the
- // "Cancel" button or outside of the bubble.
- if (GetBubbleController()->GetActiveSessionID() == session_id &&
- !GetBubbleController()->IsShowingMessage()) {
- DCHECK(RequiresBubble(session_id));
- GetBubbleController()->CloseBubble();
- }
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::TabClosedCallback(
- int render_process_id, int render_view_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- ChromeSpeechRecognitionManagerDelegate::TabClosedCallback(
- render_process_id, render_view_id);
-
- // Avoid instantiating a bubble_controller_ if not needed. Thus, prefer a
- // checked access to bubble_controller_ to GetBubbleController().
- if (bubble_controller_.get())
- bubble_controller_->CloseBubbleForRenderViewOnUIThread(render_process_id,
- render_view_id);
-}
-
-SpeechRecognitionBubbleController*
-ChromeSpeechRecognitionManagerDelegateBubbleUI::GetBubbleController() {
- if (!bubble_controller_.get())
- bubble_controller_ = new SpeechRecognitionBubbleController(this);
- return bubble_controller_.get();
-}
-
-void ChromeSpeechRecognitionManagerDelegateBubbleUI::RestartLastSession() {
- DCHECK(last_session_config_.get());
- SpeechRecognitionManager* manager = SpeechRecognitionManager::GetInstance();
- const int new_session_id = manager->CreateSession(*last_session_config_);
- DCHECK_NE(SpeechRecognitionManager::kSessionIDInvalid, new_session_id);
- last_session_config_.reset();
- manager->StartSession(new_session_id);
-}
-
-} // namespace speech
diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.h b/chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.h
deleted file mode 100644
index e9e25e1..0000000
--- a/chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_BUBBLE_UI_H_
-#define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_BUBBLE_UI_H_
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
-#include "chrome/browser/speech/speech_recognition_bubble_controller.h"
-
-namespace speech {
-
-// This class extends ChromeSpeechRecognitionManagerDelegate to add the behavior
-// required to handle the (bubble) UI for speech recognition sessions initiated
-// by input elements with a x-webkit-speech attribute. This extended behavior is
-// achieved by means of overriding some SpeechRecognitionEventListener methods
-// and intercepting the calls required to show, animate and hide the bubble UI.
-class ChromeSpeechRecognitionManagerDelegateBubbleUI
- : public ChromeSpeechRecognitionManagerDelegate,
- public SpeechRecognitionBubbleControllerDelegate {
- public:
- ChromeSpeechRecognitionManagerDelegateBubbleUI();
- virtual ~ChromeSpeechRecognitionManagerDelegateBubbleUI();
-
- protected:
- // SpeechRecognitionBubbleControllerDelegate methods.
- virtual void InfoBubbleButtonClicked(
- int session_id, SpeechRecognitionBubble::Button button) OVERRIDE;
- virtual void InfoBubbleFocusChanged(int session_id) OVERRIDE;
-
- // Overridden base class SpeechRecognitionEventListener methods.
- virtual void OnRecognitionStart(int session_id) OVERRIDE;
- virtual void OnAudioStart(int session_id) OVERRIDE;
- virtual void OnAudioEnd(int session_id) OVERRIDE;
- virtual void OnRecognitionEnd(int session_id) OVERRIDE;
- virtual void OnRecognitionError(
- int session_id, const content::SpeechRecognitionError& error) OVERRIDE;
- virtual void OnAudioLevelsChange(
- int session_id, float volume, float noise_volume) OVERRIDE;
-
- // Starts a new recognition session, using the config of the last one
- // (which is copied into |last_session_config_|). Used for "try again".
- void RestartLastSession();
-
- // Called on the UI thread by the base class when tab closure was detected.
- virtual void TabClosedCallback(
- int render_process_id, int render_view_id) OVERRIDE;
-
- private:
- // Lazy initializer for bubble controller.
- SpeechRecognitionBubbleController* GetBubbleController();
-
- scoped_refptr<SpeechRecognitionBubbleController> bubble_controller_;
- scoped_ptr<content::SpeechRecognitionSessionConfig> last_session_config_;
-
- DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionManagerDelegateBubbleUI);
-};
-
-} // namespace speech
-
-#endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_BUBBLE_UI_H_
diff --git a/chrome/browser/speech/speech_recognition_bubble.cc b/chrome/browser/speech/speech_recognition_bubble.cc
deleted file mode 100644
index 611eb7f..0000000
--- a/chrome/browser/speech/speech_recognition_bubble.cc
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/speech/speech_recognition_bubble.h"
-
-#include "base/bind.h"
-#include "base/lazy_instance.h"
-#include "base/message_loop/message_loop.h"
-#include "chrome/browser/tab_contents/tab_util.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/image/image_skia_operations.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/screen.h"
-
-using content::WebContents;
-
-namespace {
-
-const color_utils::HSL kGrayscaleShift = { -1, 0, 0.6 };
-const int kWarmingUpAnimationStartMs = 500;
-const int kWarmingUpAnimationStepMs = 100;
-const int kRecognizingAnimationStepMs = 100;
-
-// A lazily initialized singleton to hold all the image used by the speech
-// recognition bubbles and safely destroy them on exit.
-class SpeechRecognitionBubbleImages {
- public:
- const std::vector<gfx::ImageSkia>& spinner() const { return spinner_; }
- const std::vector<gfx::ImageSkia>& warm_up() const { return warm_up_; }
- gfx::ImageSkia* mic_full() const { return mic_full_; }
- gfx::ImageSkia* mic_empty() const { return mic_empty_; }
- gfx::ImageSkia* mic_noise() const { return mic_noise_; }
- gfx::ImageSkia* mic_mask() const { return mic_mask_; }
-
- private:
- // Private constructor to enforce singleton.
- friend struct base::DefaultLazyInstanceTraits<SpeechRecognitionBubbleImages>;
- SpeechRecognitionBubbleImages();
-
- std::vector<gfx::ImageSkia> spinner_; // Frames for the progress spinner.
- std::vector<gfx::ImageSkia> warm_up_; // Frames for the warm up animation.
-
- // These images are owned by ResourceBundle and need not be destroyed.
- gfx::ImageSkia* mic_full_; // Mic image with full volume.
- gfx::ImageSkia* mic_noise_; // Mic image with full noise volume.
- gfx::ImageSkia* mic_empty_; // Mic image with zero volume.
- gfx::ImageSkia* mic_mask_; // Gradient mask used by the volume indicator.
-};
-
-SpeechRecognitionBubbleImages::SpeechRecognitionBubbleImages() {
- mic_empty_ = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_SPEECH_INPUT_MIC_EMPTY);
- mic_noise_ = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_SPEECH_INPUT_MIC_NOISE);
- mic_full_ = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_SPEECH_INPUT_MIC_FULL);
- mic_mask_ = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_SPEECH_INPUT_MIC_MASK);
-
- // The sprite image consists of all the animation frames put together in one
- // horizontal/wide image. Each animation frame is square in shape within the
- // sprite.
- const gfx::ImageSkia* spinner_image = ui::ResourceBundle::GetSharedInstance().
- GetImageSkiaNamed(IDR_SPEECH_INPUT_SPINNER);
- int frame_size = spinner_image->height();
-
- // When recording starts up, it may take a short while (few ms or even a
- // couple of seconds) before the audio device starts really capturing data.
- // This is more apparent on first use. To cover such cases we show a warming
- // up state in the bubble starting with a blank spinner image. If audio data
- // starts coming in within a couple hundred ms, we switch to the recording
- // UI and if it takes longer, we show the real warm up animation frames.
- // This reduces visual jank for the most part.
- SkBitmap empty_spinner;
- empty_spinner.setConfig(SkBitmap::kARGB_8888_Config, frame_size, frame_size);
- empty_spinner.allocPixels();
- empty_spinner.eraseRGB(255, 255, 255);
- // |empty_spinner| has solid color. Pixel doubling a solid color is ok.
- warm_up_.push_back(gfx::ImageSkia::CreateFrom1xBitmap(empty_spinner));
-
- for (gfx::Rect src_rect(frame_size, frame_size);
- src_rect.x() < spinner_image->width();
- src_rect.Offset(frame_size, 0)) {
- gfx::ImageSkia frame = gfx::ImageSkiaOperations::ExtractSubset(
- *spinner_image, src_rect);
-
- // The image created by ExtractSubset just points to the same pixels as
- // the original and adjusts rowBytes accordingly. However that doesn't
- // render properly and gets vertically squished in Linux due to a bug in
- // Skia. Until that gets fixed we work around by taking a real copy of it
- // below as the copied image has the correct rowBytes and renders fine.
- frame.EnsureRepsForSupportedScales();
- std::vector<gfx::ImageSkiaRep> image_reps = frame.image_reps();
- gfx::ImageSkia frame_copy;
- for (size_t i = 0; i < image_reps.size(); ++i) {
- const SkBitmap& copy_src = image_reps[i].sk_bitmap();
- SkBitmap copy_dst;
- copy_src.copyTo(&copy_dst, kPMColor_SkColorType);
- frame_copy.AddRepresentation(gfx::ImageSkiaRep(
- copy_dst, image_reps[i].scale()));
- }
- spinner_.push_back(frame_copy);
-
- // The warm up spinner animation is a gray scale version of the real one.
- warm_up_.push_back(gfx::ImageSkiaOperations::CreateHSLShiftedImage(
- frame_copy, kGrayscaleShift));
- }
-}
-
-base::LazyInstance<SpeechRecognitionBubbleImages> g_images =
- LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
-SpeechRecognitionBubble::FactoryMethod SpeechRecognitionBubble::factory_ = NULL;
-const int SpeechRecognitionBubble::kBubbleTargetOffsetX = 10;
-
-SpeechRecognitionBubble* SpeechRecognitionBubble::Create(
- int render_process_id, int render_view_id, Delegate* delegate,
- const gfx::Rect& element_rect) {
- WebContents* web_contents =
- tab_util::GetWebContentsByID(render_process_id, render_view_id);
-
- if (factory_)
- return (*factory_)(web_contents, delegate, element_rect);
-
- // Has the tab already closed before bubble create request was processed?
- if (!web_contents)
- return NULL;
-
- return CreateNativeBubble(render_process_id, render_view_id,
- delegate, element_rect);
-}
-
-SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase(
- int render_process_id, int render_view_id)
- : weak_factory_(this),
- animation_step_(0),
- display_mode_(DISPLAY_MODE_RECORDING),
- render_process_id_(render_process_id),
- render_view_id_(render_view_id),
- scale_(1.0f) {
- WebContents* web_contents = GetWebContents();
- gfx::NativeView view =
- web_contents ? web_contents->GetView()->GetNativeView() : NULL;
- gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
- gfx::Display display = screen->GetDisplayNearestWindow(view);
- scale_ = display.device_scale_factor();
-
- const gfx::ImageSkiaRep& rep =
- g_images.Get().mic_empty()->GetRepresentation(scale_);
- mic_image_.reset(new SkBitmap());
- mic_image_->setConfig(SkBitmap::kARGB_8888_Config,
- rep.pixel_width(), rep.pixel_height());
- mic_image_->allocPixels();
-
- buffer_image_.reset(new SkBitmap());
- buffer_image_->setConfig(SkBitmap::kARGB_8888_Config,
- rep.pixel_width(), rep.pixel_height());
- buffer_image_->allocPixels();
-}
-
-SpeechRecognitionBubbleBase::~SpeechRecognitionBubbleBase() {
- // This destructor is added to make sure members such as the scoped_ptr
- // get destroyed here and the derived classes don't have to care about such
- // member variables which they don't use.
-}
-
-void SpeechRecognitionBubbleBase::SetWarmUpMode() {
- weak_factory_.InvalidateWeakPtrs();
- display_mode_ = DISPLAY_MODE_WARM_UP;
- animation_step_ = 0;
- DoWarmingUpAnimationStep();
- UpdateLayout();
-}
-
-void SpeechRecognitionBubbleBase::DoWarmingUpAnimationStep() {
- SetImage(g_images.Get().warm_up()[animation_step_]);
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&SpeechRecognitionBubbleBase::DoWarmingUpAnimationStep,
- weak_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(
- animation_step_ == 0 ? kWarmingUpAnimationStartMs
- : kWarmingUpAnimationStepMs));
- if (++animation_step_ >= static_cast<int>(g_images.Get().warm_up().size()))
- animation_step_ = 1; // Frame 0 is skipped during the animation.
-}
-
-void SpeechRecognitionBubbleBase::SetRecordingMode() {
- weak_factory_.InvalidateWeakPtrs();
- display_mode_ = DISPLAY_MODE_RECORDING;
- SetInputVolume(0, 0);
- UpdateLayout();
-}
-
-void SpeechRecognitionBubbleBase::SetRecognizingMode() {
- display_mode_ = DISPLAY_MODE_RECOGNIZING;
- animation_step_ = 0;
- DoRecognizingAnimationStep();
- UpdateLayout();
-}
-
-void SpeechRecognitionBubbleBase::DoRecognizingAnimationStep() {
- SetImage(g_images.Get().spinner()[animation_step_]);
- if (++animation_step_ >= static_cast<int>(g_images.Get().spinner().size()))
- animation_step_ = 0;
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&SpeechRecognitionBubbleBase::DoRecognizingAnimationStep,
- weak_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(kRecognizingAnimationStepMs));
-}
-
-void SpeechRecognitionBubbleBase::SetMessage(const base::string16& text) {
- weak_factory_.InvalidateWeakPtrs();
- message_text_ = text;
- display_mode_ = DISPLAY_MODE_MESSAGE;
- UpdateLayout();
-}
-
-void SpeechRecognitionBubbleBase::DrawVolumeOverlay(SkCanvas* canvas,
- const gfx::ImageSkia& image,
- float volume) {
- buffer_image_->eraseARGB(0, 0, 0, 0);
-
- int width = mic_image_->width();
- int height = mic_image_->height();
- SkCanvas buffer_canvas(*buffer_image_);
-
- buffer_canvas.save();
- const int kVolumeSteps = 12;
- SkScalar clip_right =
- (((1.0f - volume) * (width * (kVolumeSteps + 1))) - width) / kVolumeSteps;
- buffer_canvas.clipRect(SkRect::MakeLTRB(0, 0,
- SkIntToScalar(width) - clip_right, SkIntToScalar(height)));
- buffer_canvas.drawBitmap(image.GetRepresentation(scale_).sk_bitmap(), 0, 0);
- buffer_canvas.restore();
- SkPaint multiply_paint;
- multiply_paint.setXfermodeMode(SkXfermode::kModulate_Mode);
- buffer_canvas.drawBitmap(
- g_images.Get().mic_mask()->GetRepresentation(scale_).sk_bitmap(),
- -clip_right, 0, &multiply_paint);
-
- canvas->drawBitmap(*buffer_image_.get(), 0, 0);
-}
-
-void SpeechRecognitionBubbleBase::SetInputVolume(float volume,
- float noise_volume) {
- mic_image_->eraseARGB(0, 0, 0, 0);
- SkCanvas canvas(*mic_image_);
-
- // Draw the empty volume image first and the current volume image on top,
- // and then the noise volume image on top of both.
- canvas.drawBitmap(
- g_images.Get().mic_empty()->GetRepresentation(scale_).sk_bitmap(),
- 0, 0);
- DrawVolumeOverlay(&canvas, *g_images.Get().mic_full(), volume);
- DrawVolumeOverlay(&canvas, *g_images.Get().mic_noise(), noise_volume);
-
- gfx::ImageSkia image(gfx::ImageSkiaRep(*mic_image_.get(), scale_));
- SetImage(image);
-}
-
-WebContents* SpeechRecognitionBubbleBase::GetWebContents() {
- return tab_util::GetWebContentsByID(render_process_id_, render_view_id_);
-}
-
-void SpeechRecognitionBubbleBase::SetImage(const gfx::ImageSkia& image) {
- icon_image_ = image;
- UpdateImage();
-}
-
-gfx::ImageSkia SpeechRecognitionBubbleBase::icon_image() {
- return icon_image_;
-}
diff --git a/chrome/browser/speech/speech_recognition_bubble.h b/chrome/browser/speech/speech_recognition_bubble.h
deleted file mode 100644
index 96a805e..0000000
--- a/chrome/browser/speech/speech_recognition_bubble.h
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_H_
-#define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_H_
-
-#include <vector>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/strings/string16.h"
-#include "ui/base/layout.h"
-#include "ui/gfx/image/image_skia.h"
-
-class SkBitmap;
-class SkCanvas;
-
-namespace content {
-class WebContents;
-}
-
-namespace gfx {
-class Canvas;
-class Rect;
-}
-
-// SpeechRecognitionBubble displays a popup info bubble during speech
-// recognition, points to the html element which requested speech recognition
-// and shows progress events. The popup is closed by the user clicking anywhere
-// outside the popup window, or by the caller destroying this object.
-class SpeechRecognitionBubble {
- public:
- // The various buttons which may be part of the bubble.
- enum Button {
- BUTTON_TRY_AGAIN,
- BUTTON_CANCEL
- };
-
- // Informs listeners of user actions in the bubble.
- class Delegate {
- public:
- // Invoked when the user selects a button in the info bubble. The InfoBubble
- // is still active and the caller should close it if necessary.
- virtual void InfoBubbleButtonClicked(Button button) = 0;
-
- // Invoked when the user clicks outside the InfoBubble causing it to close.
- // The InfoBubble window is no longer visible on screen and the caller can
- // free the InfoBubble instance. This callback is not issued if the bubble
- // got closed because the object was destroyed by the caller.
- virtual void InfoBubbleFocusChanged() = 0;
-
- protected:
- virtual ~Delegate() {
- }
- };
-
- // Factory method to create new instances.
- // Creates the bubble, call |Show| to display it on screen.
- // |render_process_id| and |render_view_id| is used to extract the
- // correct WebContents.
- // |element_rect| is the display bounds of the html element requesting speech
- // recognition (in page coordinates).
- static SpeechRecognitionBubble* Create(
- int render_process_id,
- int render_view_id,
- Delegate* delegate,
- const gfx::Rect& element_rect);
-
- // This is implemented by platform specific code to create the underlying
- // bubble window. Not to be called directly by users of this class.
- static SpeechRecognitionBubble* CreateNativeBubble(
- int render_process_id,
- int render_view_id,
- Delegate* delegate,
- const gfx::Rect& element_rect);
-
- // |Create| uses the currently registered FactoryMethod to create the
- // SpeechRecognitionBubble instances. FactoryMethod is intended for testing.
- typedef SpeechRecognitionBubble* (*FactoryMethod)(content::WebContents*,
- Delegate*,
- const gfx::Rect&);
- // Sets the factory used by the static method Create. SpeechRecognitionBubble
- // does not take ownership of |factory|. A value of NULL results in a
- // SpeechRecognitionBubble being created directly.
-#if defined(UNIT_TEST)
- static void set_factory(FactoryMethod factory) { factory_ = factory; }
-#endif
-
- virtual ~SpeechRecognitionBubble() {}
-
- // Indicates to the user that audio hardware is initializing. If the bubble is
- // hidden, |Show| must be called to make it appear on screen.
- virtual void SetWarmUpMode() = 0;
-
- // Indicates to the user that audio recording is in progress. If the bubble is
- // hidden, |Show| must be called to make it appear on screen.
- virtual void SetRecordingMode() = 0;
-
- // Indicates to the user that recognition is in progress. If the bubble is
- // hidden, |Show| must be called to make it appear on screen.
- virtual void SetRecognizingMode() = 0;
-
- // Displays the given string with the 'Try again' and 'Cancel' buttons. If the
- // bubble is hidden, |Show| must be called to make it appear on screen.
- virtual void SetMessage(const base::string16& text) = 0;
-
- // Brings up the bubble on screen.
- virtual void Show() = 0;
-
- // Hides the info bubble, resulting in a call to
- // |Delegate::InfoBubbleFocusChanged| as well.
- virtual void Hide() = 0;
-
- // Updates and draws the current captured audio volume displayed on screen.
- virtual void SetInputVolume(float volume, float noise_volume) = 0;
-
- // Returns the WebContents for which this bubble gets displayed.
- virtual content::WebContents* GetWebContents() = 0;
-
- // The horizontal distance between the start of the html widget and the speech
- // bubble's arrow.
- static const int kBubbleTargetOffsetX;
-
- private:
- static FactoryMethod factory_;
-};
-
-// Base class for the platform specific bubble implementations, this contains
-// the platform independent code for SpeechRecognitionBubble.
-class SpeechRecognitionBubbleBase : public SpeechRecognitionBubble {
- public:
- // The current display mode of the bubble, useful only for the platform
- // specific implementation.
- enum DisplayMode {
- DISPLAY_MODE_WARM_UP,
- DISPLAY_MODE_RECORDING,
- DISPLAY_MODE_RECOGNIZING,
- DISPLAY_MODE_MESSAGE
- };
-
- SpeechRecognitionBubbleBase(int render_process_id, int render_view_id);
- virtual ~SpeechRecognitionBubbleBase();
-
- // SpeechRecognitionBubble methods
- virtual void SetWarmUpMode() OVERRIDE;
- virtual void SetRecordingMode() OVERRIDE;
- virtual void SetRecognizingMode() OVERRIDE;
- virtual void SetMessage(const base::string16& text) OVERRIDE;
- virtual void SetInputVolume(float volume, float noise_volume) OVERRIDE;
- virtual content::WebContents* GetWebContents() OVERRIDE;
-
- protected:
- // Updates the platform specific UI layout for the current display mode.
- virtual void UpdateLayout() = 0;
-
- // Overridden by subclasses to copy |icon_image()| to the screen.
- virtual void UpdateImage() = 0;
-
- DisplayMode display_mode() const { return display_mode_; }
-
- const base::string16& message_text() const { return message_text_; }
-
- gfx::ImageSkia icon_image();
-
- private:
- void DoRecognizingAnimationStep();
- void DoWarmingUpAnimationStep();
- void SetImage(const gfx::ImageSkia& image);
-
- void DrawVolumeOverlay(SkCanvas* canvas,
- const gfx::ImageSkia& image_skia,
- float volume);
-
- // Task factory used for animation timer.
- base::WeakPtrFactory<SpeechRecognitionBubbleBase> weak_factory_;
- int animation_step_; // Current index/step of the animation.
-
- DisplayMode display_mode_;
- base::string16 message_text_; // Text displayed in DISPLAY_MODE_MESSAGE
-
- // The current microphone image with volume level indication.
- scoped_ptr<SkBitmap> mic_image_;
- // A temporary buffer image used in creating the above mic image.
- scoped_ptr<SkBitmap> buffer_image_;
-
- // Content in which this bubble gets displayed.
- int render_process_id_;
- int render_view_id_;
-
- // The current image displayed in the bubble's icon widget.
- gfx::ImageSkia icon_image_;
- // The scale factor used for the web-contents.
- float scale_;
-
- DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionBubbleBase);
-};
-
-// This typedef is to workaround the issue with certain versions of
-// Visual Studio where it gets confused between multiple Delegate
-// classes and gives a C2500 error. (I saw this error on the try bots -
-// the workaround was not needed for my machine).
-typedef SpeechRecognitionBubble::Delegate SpeechRecognitionBubbleDelegate;
-
-#endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_H_
diff --git a/chrome/browser/speech/speech_recognition_bubble_browsertest.cc b/chrome/browser/speech/speech_recognition_bubble_browsertest.cc
deleted file mode 100644
index dcb35f4..0000000
--- a/chrome/browser/speech/speech_recognition_bubble_browsertest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/speech/speech_recognition_bubble.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/rect.h"
-
-class SpeechRecognitionBubbleTest : public SpeechRecognitionBubbleDelegate,
- public InProcessBrowserTest {
- public:
- // SpeechRecognitionBubble::Delegate methods.
- virtual void InfoBubbleButtonClicked(
- SpeechRecognitionBubble::Button button) OVERRIDE {
- }
- virtual void InfoBubbleFocusChanged() OVERRIDE {}
-
- protected:
-};
-
-IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, CreateAndDestroy) {
- gfx::Rect element_rect(100, 100, 100, 100);
- content::WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
- scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
- web_contents->GetRenderProcessHost()->GetID(),
- web_contents->GetRenderViewHost()->GetRoutingID(),
- this, element_rect));
- EXPECT_TRUE(bubble.get());
-}
-
-IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, ShowAndDestroy) {
- gfx::Rect element_rect(100, 100, 100, 100);
- content::WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
- scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
- web_contents->GetRenderProcessHost()->GetID(),
- web_contents->GetRenderViewHost()->GetRoutingID(),
- this, element_rect));
- EXPECT_TRUE(bubble.get());
- bubble->Show();
-}
-
-IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, ShowAndHide) {
- gfx::Rect element_rect(100, 100, 100, 100);
- content::WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
- scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
- web_contents->GetRenderProcessHost()->GetID(),
- web_contents->GetRenderViewHost()->GetRoutingID(),
- this, element_rect));
- EXPECT_TRUE(bubble.get());
- bubble->Show();
- bubble->Hide();
-}
-
-IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, ShowAndHideTwice) {
- gfx::Rect element_rect(100, 100, 100, 100);
- content::WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
- scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
- web_contents->GetRenderProcessHost()->GetID(),
- web_contents->GetRenderViewHost()->GetRoutingID(),
- this, element_rect));
- EXPECT_TRUE(bubble.get());
- bubble->Show();
- bubble->Hide();
- bubble->Show();
- bubble->Hide();
-}
diff --git a/chrome/browser/speech/speech_recognition_bubble_controller.cc b/chrome/browser/speech/speech_recognition_bubble_controller.cc
deleted file mode 100644
index ede3858..0000000
--- a/chrome/browser/speech/speech_recognition_bubble_controller.cc
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/speech/speech_recognition_bubble_controller.h"
-
-#include "base/bind.h"
-#include "chrome/browser/tab_contents/tab_util.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-
-using content::BrowserThread;
-using content::WebContents;
-
-namespace {
-const int kInvalidSessionId = 0;
-}
-
-namespace speech {
-
-SpeechRecognitionBubbleController::SpeechRecognitionBubbleController(
- Delegate* delegate)
- : delegate_(delegate),
- last_request_issued_(REQUEST_CLOSE),
- current_bubble_session_id_(kInvalidSessionId),
- current_bubble_render_process_id_(0),
- current_bubble_render_view_id_(0) {
-}
-
-SpeechRecognitionBubbleController::~SpeechRecognitionBubbleController() {
- DCHECK_EQ(kInvalidSessionId, current_bubble_session_id_);
-}
-
-void SpeechRecognitionBubbleController::CreateBubble(
- int session_id,
- int render_process_id,
- int render_view_id,
- const gfx::Rect& element_rect) {
- {
- base::AutoLock auto_lock(lock_);
- current_bubble_session_id_ = session_id;
- current_bubble_render_process_id_ = render_process_id;
- current_bubble_render_view_id_ = render_view_id;
- }
-
- UIRequest request(REQUEST_CREATE);
- request.render_process_id = render_process_id;
- request.render_view_id = render_view_id;
- request.element_rect = element_rect;
- ProcessRequestInUiThread(request);
-}
-
-void SpeechRecognitionBubbleController::SetBubbleRecordingMode() {
- ProcessRequestInUiThread(UIRequest(REQUEST_SET_RECORDING_MODE));
-}
-
-void SpeechRecognitionBubbleController::SetBubbleRecognizingMode() {
- ProcessRequestInUiThread(UIRequest(REQUEST_SET_RECOGNIZING_MODE));
-}
-
-void SpeechRecognitionBubbleController::SetBubbleMessage(
- const base::string16& text) {
- UIRequest request(REQUEST_SET_MESSAGE);
- request.message = text;
- ProcessRequestInUiThread(request);
-}
-
-bool SpeechRecognitionBubbleController::IsShowingMessage() const {
- return last_request_issued_ == REQUEST_SET_MESSAGE;
-}
-
-void SpeechRecognitionBubbleController::SetBubbleInputVolume(
- float volume,
- float noise_volume) {
- UIRequest request(REQUEST_SET_INPUT_VOLUME);
- request.volume = volume;
- request.noise_volume = noise_volume;
- ProcessRequestInUiThread(request);
-}
-
-void SpeechRecognitionBubbleController::CloseBubble() {
- {
- base::AutoLock auto_lock(lock_);
- current_bubble_session_id_ = kInvalidSessionId;
- }
- ProcessRequestInUiThread(UIRequest(REQUEST_CLOSE));
-}
-
-void SpeechRecognitionBubbleController::CloseBubbleForRenderViewOnUIThread(
- int render_process_id, int render_view_id) {
- {
- base::AutoLock auto_lock(lock_);
- if (current_bubble_session_id_ == kInvalidSessionId ||
- current_bubble_render_process_id_ != render_process_id ||
- current_bubble_render_view_id_ != render_view_id) {
- return;
- }
- current_bubble_session_id_ = kInvalidSessionId;
- }
- ProcessRequestInUiThread(UIRequest(REQUEST_CLOSE));
-}
-
-int SpeechRecognitionBubbleController::GetActiveSessionID() {
- base::AutoLock auto_lock(lock_);
- return current_bubble_session_id_;
-}
-
-void SpeechRecognitionBubbleController::InfoBubbleButtonClicked(
- SpeechRecognitionBubble::Button button) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(
- &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked, this,
- button));
-}
-
-void SpeechRecognitionBubbleController::InfoBubbleFocusChanged() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(&SpeechRecognitionBubbleController::InvokeDelegateFocusChanged,
- this));
-}
-
-void SpeechRecognitionBubbleController::InvokeDelegateButtonClicked(
- SpeechRecognitionBubble::Button button) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- {
- base::AutoLock auto_lock(lock_);
- if (kInvalidSessionId == current_bubble_session_id_)
- return;
- }
- delegate_->InfoBubbleButtonClicked(current_bubble_session_id_, button);
-}
-
-void SpeechRecognitionBubbleController::InvokeDelegateFocusChanged() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- {
- base::AutoLock auto_lock(lock_);
- if (kInvalidSessionId == current_bubble_session_id_)
- return;
- }
- delegate_->InfoBubbleFocusChanged(current_bubble_session_id_);
-}
-
-void SpeechRecognitionBubbleController::ProcessRequestInUiThread(
- const UIRequest& request) {
- if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- last_request_issued_ = request.type;
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&SpeechRecognitionBubbleController::ProcessRequestInUiThread,
- this, request));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // In the case of a tab closed or crashed, the bubble can have been destroyed
- // earlier on the UI thread, while other tasks were being enqueued from the IO
- // to the UI thread. Simply return in such cases.
- if (request.type != REQUEST_CREATE && !bubble_.get())
- return;
-
- switch (request.type) {
- case REQUEST_CREATE:
- bubble_.reset(SpeechRecognitionBubble::Create(
- request.render_process_id, request.render_view_id,
- this, request.element_rect));
-
- if (!bubble_.get()) {
- // Could be null if tab or display rect were invalid.
- // Simulate the cancel button being clicked to inform the delegate.
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(
- &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked,
- this, SpeechRecognitionBubble::BUTTON_CANCEL));
- return;
- }
- bubble_->Show();
- bubble_->SetWarmUpMode();
- break;
- case REQUEST_SET_RECORDING_MODE:
- bubble_->SetRecordingMode();
- break;
- case REQUEST_SET_RECOGNIZING_MODE:
- bubble_->SetRecognizingMode();
- break;
- case REQUEST_SET_MESSAGE:
- bubble_->SetMessage(request.message);
- break;
- case REQUEST_SET_INPUT_VOLUME:
- bubble_->SetInputVolume(request.volume, request.noise_volume);
- break;
- case REQUEST_CLOSE:
- bubble_.reset();
- break;
- default:
- NOTREACHED();
- break;
- }
-}
-
-SpeechRecognitionBubbleController::UIRequest::UIRequest(RequestType type_value)
- : type(type_value),
- volume(0.0F),
- noise_volume(0.0F),
- render_process_id(0),
- render_view_id(0) {
-}
-
-SpeechRecognitionBubbleController::UIRequest::~UIRequest() {
-}
-
-} // namespace speech
diff --git a/chrome/browser/speech/speech_recognition_bubble_controller.h b/chrome/browser/speech/speech_recognition_bubble_controller.h
deleted file mode 100644
index 67e0e71..0000000
--- a/chrome/browser/speech/speech_recognition_bubble_controller.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_
-#define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/synchronization/lock.h"
-#include "chrome/browser/speech/speech_recognition_bubble.h"
-#include "ui/gfx/rect.h"
-
-namespace speech {
-
-// This class handles the speech recognition popup UI on behalf of
-// SpeechRecognitionManager, which invokes methods on the IO thread, processing
-// those requests on the UI thread. At most one bubble can be active.
-class SpeechRecognitionBubbleController
- : public base::RefCountedThreadSafe<SpeechRecognitionBubbleController>,
- public SpeechRecognitionBubbleDelegate {
- public:
- // All methods of this delegate are called on the IO thread.
- class Delegate {
- public:
- // Invoked when the user clicks on a button in the speech recognition UI.
- virtual void InfoBubbleButtonClicked(
- int session_id, SpeechRecognitionBubble::Button button) = 0;
-
- // Invoked when the user clicks outside the speech recognition info bubble
- // causing it to close and input focus to change.
- virtual void InfoBubbleFocusChanged(int session_id) = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- explicit SpeechRecognitionBubbleController(Delegate* delegate);
-
- // Creates and shows a new speech recognition UI bubble in warmup mode.
- void CreateBubble(int session_id,
- int render_process_id,
- int render_view_id,
- const gfx::Rect& element_rect);
-
- // Indicates to the user that audio recording is in progress.
- void SetBubbleRecordingMode();
-
- // Indicates to the user that recognition is in progress.
- void SetBubbleRecognizingMode();
-
- // Displays the given string with the 'Try again' and 'Cancel' buttons.
- void SetBubbleMessage(const base::string16& text);
-
- // Checks whether the bubble is active and is showing a message.
- bool IsShowingMessage() const;
-
- // Updates the current captured audio volume displayed on screen.
- void SetBubbleInputVolume(float volume, float noise_volume);
-
- // Closes the bubble.
- void CloseBubble();
-
- // This is the only method that can be called from the UI thread.
- void CloseBubbleForRenderViewOnUIThread(int render_process_id,
- int render_view_id);
-
- // Retrieves the session ID associated to the active bubble (if any).
- // Returns 0 if no bubble is currently shown.
- int GetActiveSessionID();
-
- // SpeechRecognitionBubble::Delegate methods.
- virtual void InfoBubbleButtonClicked(
- SpeechRecognitionBubble::Button button) OVERRIDE;
- virtual void InfoBubbleFocusChanged() OVERRIDE;
-
- private:
- friend class base::RefCountedThreadSafe<SpeechRecognitionBubbleController>;
-
- // The various calls received by this object and handled on the UI thread.
- enum RequestType {
- REQUEST_CREATE,
- REQUEST_SET_RECORDING_MODE,
- REQUEST_SET_RECOGNIZING_MODE,
- REQUEST_SET_MESSAGE,
- REQUEST_SET_INPUT_VOLUME,
- REQUEST_CLOSE,
- };
-
- struct UIRequest {
- RequestType type;
- base::string16 message;
- gfx::Rect element_rect;
- float volume;
- float noise_volume;
- int render_process_id;
- int render_view_id;
-
- explicit UIRequest(RequestType type_value);
- ~UIRequest();
- };
-
- virtual ~SpeechRecognitionBubbleController();
-
- void InvokeDelegateButtonClicked(SpeechRecognitionBubble::Button button);
- void InvokeDelegateFocusChanged();
- void ProcessRequestInUiThread(const UIRequest& request);
-
- // The following are accessed only on the IO thread.
- Delegate* delegate_;
- RequestType last_request_issued_;
-
- // The following are accessed only on the UI thread.
- scoped_ptr<SpeechRecognitionBubble> bubble_;
-
- // The following are accessed on both IO and UI threads.
- base::Lock lock_;
-
- // The session id for currently visible bubble.
- int current_bubble_session_id_;
-
- // The render process and view ids for the currently visible bubble.
- int current_bubble_render_process_id_;
- int current_bubble_render_view_id_;
-};
-
-// This typedef is to workaround the issue with certain versions of
-// Visual Studio where it gets confused between multiple Delegate
-// classes and gives a C2500 error. (I saw this error on the try bots -
-// the workaround was not needed for my machine).
-typedef SpeechRecognitionBubbleController::Delegate
- SpeechRecognitionBubbleControllerDelegate;
-
-} // namespace speech
-
-#endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc b/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc
deleted file mode 100644
index 80f2de7..0000000
--- a/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/bind.h"
-#include "base/run_loop.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/speech/speech_recognition_bubble_controller.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/test/base/browser_with_test_window_test.h"
-#include "chrome/test/base/testing_profile.h"
-#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/test/test_browser_thread.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/rect.h"
-
-
-using content::BrowserThread;
-using content::WebContents;
-
-namespace speech {
-
-// A mock bubble class which fakes a focus change or recognition cancel by the
-// user and closing of the info bubble.
-class MockSpeechRecognitionBubble : public SpeechRecognitionBubbleBase {
- public:
- enum BubbleType {
- BUBBLE_TEST_FOCUS_CHANGED,
- BUBBLE_TEST_CLICK_CANCEL,
- BUBBLE_TEST_CLICK_TRY_AGAIN,
- };
-
- MockSpeechRecognitionBubble(int render_process_id, int render_view_id,
- Delegate* delegate, const gfx::Rect&)
- : SpeechRecognitionBubbleBase(render_process_id, render_view_id) {
- VLOG(1) << "MockSpeechRecognitionBubble created";
- base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&InvokeDelegate, delegate));
- }
-
- static void InvokeDelegate(Delegate* delegate) {
- VLOG(1) << "MockSpeechRecognitionBubble invoking delegate for type "
- << type_;
- switch (type_) {
- case BUBBLE_TEST_FOCUS_CHANGED:
- delegate->InfoBubbleFocusChanged();
- break;
- case BUBBLE_TEST_CLICK_CANCEL:
- delegate->InfoBubbleButtonClicked(
- SpeechRecognitionBubble::BUTTON_CANCEL);
- break;
- case BUBBLE_TEST_CLICK_TRY_AGAIN:
- delegate->InfoBubbleButtonClicked(
- SpeechRecognitionBubble::BUTTON_TRY_AGAIN);
- break;
- }
- }
-
- static void set_type(BubbleType type) {
- type_ = type;
- }
- static BubbleType type() {
- return type_;
- }
-
- virtual void Show() OVERRIDE {}
- virtual void Hide() OVERRIDE {}
- virtual void UpdateLayout() OVERRIDE {}
- virtual void UpdateImage() OVERRIDE {}
-
- private:
- static BubbleType type_;
-};
-
-// The test fixture.
-class SpeechRecognitionBubbleControllerTest
- : public SpeechRecognitionBubbleControllerDelegate,
- public BrowserWithTestWindowTest {
- public:
- SpeechRecognitionBubbleControllerTest()
- : BrowserWithTestWindowTest(),
- cancel_clicked_(false),
- try_again_clicked_(false),
- focus_changed_(false),
- controller_(new SpeechRecognitionBubbleController(this)) {
- EXPECT_EQ(NULL, test_fixture_);
- test_fixture_ = this;
- }
-
- virtual ~SpeechRecognitionBubbleControllerTest() {
- test_fixture_ = NULL;
- }
-
- // SpeechRecognitionBubbleControllerDelegate methods.
- virtual void InfoBubbleButtonClicked(
- int session_id,
- SpeechRecognitionBubble::Button button) OVERRIDE {
- VLOG(1) << "Received InfoBubbleButtonClicked for button " << button;
- EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (button == SpeechRecognitionBubble::BUTTON_CANCEL) {
- cancel_clicked_ = true;
- } else if (button == SpeechRecognitionBubble::BUTTON_TRY_AGAIN) {
- try_again_clicked_ = true;
- }
- }
-
- virtual void InfoBubbleFocusChanged(int session_id) OVERRIDE {
- VLOG(1) << "Received InfoBubbleFocusChanged";
- EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
- focus_changed_ = true;
- }
-
- // testing::Test methods.
- virtual void SetUp() {
- BrowserWithTestWindowTest::SetUp();
- SpeechRecognitionBubble::set_factory(
- &SpeechRecognitionBubbleControllerTest::CreateBubble);
- }
-
- virtual void TearDown() {
- SpeechRecognitionBubble::set_factory(NULL);
- BrowserWithTestWindowTest::TearDown();
- }
-
- static void ActivateBubble() {
- if (MockSpeechRecognitionBubble::type() !=
- MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED) {
- test_fixture_->controller_->SetBubbleMessage(base::ASCIIToUTF16("Test"));
- }
- }
-
- static SpeechRecognitionBubble* CreateBubble(
- WebContents* web_contents,
- SpeechRecognitionBubble::Delegate* delegate,
- const gfx::Rect& element_rect) {
- EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // Set up to activate the bubble soon after it gets created, since we test
- // events sent by the bubble and those are handled only when the bubble is
- // active.
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&ActivateBubble));
-
- return new MockSpeechRecognitionBubble(0, 0, delegate, element_rect);
- }
-
- protected:
- bool cancel_clicked_;
- bool try_again_clicked_;
- bool focus_changed_;
- scoped_refptr<SpeechRecognitionBubbleController> controller_;
-
- static const int kBubbleSessionId;
- static SpeechRecognitionBubbleControllerTest* test_fixture_;
-};
-
-SpeechRecognitionBubbleControllerTest*
-SpeechRecognitionBubbleControllerTest::test_fixture_ = NULL;
-
-const int SpeechRecognitionBubbleControllerTest::kBubbleSessionId = 1;
-
-MockSpeechRecognitionBubble::BubbleType MockSpeechRecognitionBubble::type_ =
- MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED;
-
-// Test that the speech bubble UI gets created in the UI thread and that the
-// focus changed callback comes back in the IO thread.
-TEST_F(SpeechRecognitionBubbleControllerTest, TestFocusChanged) {
- MockSpeechRecognitionBubble::set_type(
- MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED);
-
- controller_->CreateBubble(kBubbleSessionId, 1, 1, gfx::Rect(1, 1));
- base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(focus_changed_);
- EXPECT_FALSE(cancel_clicked_);
- EXPECT_FALSE(try_again_clicked_);
- controller_->CloseBubble();
-}
-
-// Test that the speech bubble UI gets created in the UI thread and that the
-// recognition cancelled callback comes back in the IO thread.
-TEST_F(SpeechRecognitionBubbleControllerTest, TestRecognitionCancelled) {
- MockSpeechRecognitionBubble::set_type(
- MockSpeechRecognitionBubble::BUBBLE_TEST_CLICK_CANCEL);
-
- controller_->CreateBubble(kBubbleSessionId, 1, 1, gfx::Rect(1, 1));
- base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(cancel_clicked_);
- EXPECT_FALSE(try_again_clicked_);
- EXPECT_FALSE(focus_changed_);
- controller_->CloseBubble();
-}
-
-// Test that the speech bubble UI gets created in the UI thread and that the
-// try-again button click event comes back in the IO thread.
-TEST_F(SpeechRecognitionBubbleControllerTest, TestTryAgainClicked) {
- MockSpeechRecognitionBubble::set_type(
- MockSpeechRecognitionBubble::BUBBLE_TEST_CLICK_TRY_AGAIN);
-
- controller_->CreateBubble(kBubbleSessionId, 1, 1, gfx::Rect(1, 1));
- base::RunLoop().RunUntilIdle();
- EXPECT_FALSE(cancel_clicked_);
- EXPECT_TRUE(try_again_clicked_);
- EXPECT_FALSE(focus_changed_);
- controller_->CloseBubble();
-}
-
-} // namespace speech
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index a7d1217..34db678 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -1052,12 +1052,9 @@ void OpenUpdateChromeDialog(Browser* browser) {
}
void ToggleSpeechInput(Browser* browser) {
- WebContents* web_contents =
- browser->tab_strip_model()->GetActiveWebContents();
- web_contents->GetRenderViewHost()->ToggleSpeechInput();
-
SearchTabHelper* search_tab_helper =
- SearchTabHelper::FromWebContents(web_contents);
+ SearchTabHelper::FromWebContents(
+ browser->tab_strip_model()->GetActiveWebContents());
// |search_tab_helper| can be null in unit tests.
if (search_tab_helper)
search_tab_helper->ToggleVoiceSearch();
diff --git a/chrome/browser/ui/cocoa/speech_recognition_bubble_cocoa.mm b/chrome/browser/ui/cocoa/speech_recognition_bubble_cocoa.mm
deleted file mode 100644
index 8c65dad..0000000
--- a/chrome/browser/ui/cocoa/speech_recognition_bubble_cocoa.mm
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import <Cocoa/Cocoa.h>
-
-#include "chrome/browser/speech/speech_recognition_bubble.h"
-
-#import "base/mac/scoped_nsobject.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
-#include "chrome/browser/ui/cocoa/browser_window_controller.h"
-#include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
-#import "chrome/browser/ui/cocoa/speech_recognition_window_controller.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "ui/gfx/image/image_skia_util_mac.h"
-
-using content::WebContents;
-
-namespace {
-
-// A class to bridge between the speech recognition C++ code and the Objective-C
-// bubble implementation. See chrome/browser/speech/speech_recognition_bubble.h
-// for more information on how this gets used.
-class SpeechRecognitionBubbleImpl : public SpeechRecognitionBubbleBase {
- public:
- SpeechRecognitionBubbleImpl(int render_process_id,
- int render_view_id,
- Delegate* delegate,
- const gfx::Rect& element_rect);
- virtual ~SpeechRecognitionBubbleImpl();
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual void UpdateLayout() OVERRIDE;
- virtual void UpdateImage() OVERRIDE;
-
- private:
- base::scoped_nsobject<SpeechRecognitionWindowController> window_;
- Delegate* delegate_;
- gfx::Rect element_rect_;
-};
-
-SpeechRecognitionBubbleImpl::SpeechRecognitionBubbleImpl(
- int render_process_id,
- int render_view_id,
- Delegate* delegate,
- const gfx::Rect& element_rect)
- : SpeechRecognitionBubbleBase(render_process_id, render_view_id),
- delegate_(delegate),
- element_rect_(element_rect) {
-}
-
-SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() {
- if (window_.get())
- [window_.get() close];
-}
-
-void SpeechRecognitionBubbleImpl::UpdateImage() {
- if (window_.get() && GetWebContents())
- [window_.get() setImage:gfx::NSImageFromImageSkia(icon_image())];
-}
-
-void SpeechRecognitionBubbleImpl::Show() {
- if (!GetWebContents())
- return;
-
- if (window_.get()) {
- [window_.get() show];
- return;
- }
-
- // Find the screen coordinates for the given tab and position the bubble's
- // arrow anchor point inside that to point at the bottom-left of the html
- // input element rect if the position is valid, otherwise point it towards
- // the page icon in the omnibox.
- gfx::NativeView view = GetWebContents()->GetView()->GetNativeView();
- NSWindow* parent_window = [view window];
- NSRect tab_bounds = [view bounds];
- int anchor_x = tab_bounds.origin.x + element_rect_.x() +
- element_rect_.width() - kBubbleTargetOffsetX;
- int anchor_y = tab_bounds.origin.y + tab_bounds.size.height -
- element_rect_.y() - element_rect_.height();
-
- NSPoint anchor = NSMakePoint(anchor_x, anchor_y);
- if (NSPointInRect(anchor, tab_bounds)) {
- // Good, convert to window coordinates.
- anchor = [view convertPoint:anchor toView:nil];
- } else {
- LocationBarViewMac* locationBar =
- [[parent_window windowController] locationBarBridge];
-
- if (locationBar) {
- anchor = locationBar->GetPageInfoBubblePoint();
- } else {
- // This is very rare, but possible. Just use the top-left corner.
- // See http://crbug.com/119237
- anchor = NSMakePoint(NSMinX(tab_bounds), NSMaxY(tab_bounds));
- anchor = [view convertPoint:anchor toView:nil];
- }
- }
-
- anchor = [parent_window convertBaseToScreen:anchor];
-
- window_.reset([[SpeechRecognitionWindowController alloc]
- initWithParentWindow:parent_window
- delegate:delegate_
- anchoredAt:anchor]);
-
- UpdateLayout();
- [window_.get() show];
-}
-
-void SpeechRecognitionBubbleImpl::Hide() {
- if (!window_.get())
- return;
-
- [window_.get() close];
- window_.reset();
-}
-
-void SpeechRecognitionBubbleImpl::UpdateLayout() {
- if (!window_.get() || !GetWebContents())
- return;
-
- [window_.get() updateLayout:display_mode()
- messageText:message_text()
- iconImage:gfx::NSImageFromImageSkia(icon_image())];
-}
-
-} // namespace
-
-SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
- int render_process_id,
- int render_view_id,
- Delegate* delegate,
- const gfx::Rect& element_rect) {
- return new SpeechRecognitionBubbleImpl(render_process_id,
- render_view_id,
- delegate,
- element_rect);
-}
diff --git a/chrome/browser/ui/cocoa/speech_recognition_window_controller.h b/chrome/browser/ui/cocoa/speech_recognition_window_controller.h
deleted file mode 100644
index 24fa890..0000000
--- a/chrome/browser/ui/cocoa/speech_recognition_window_controller.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
-#define CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
-
-#import <Cocoa/Cocoa.h>
-
-#include "chrome/browser/speech/speech_recognition_bubble.h"
-#include "chrome/browser/ui/cocoa/base_bubble_controller.h"
-
-// Controller for the speech recognition bubble window. This bubble window gets
-// displayed when the user starts speech input in a html input element.
-@interface SpeechRecognitionWindowController : BaseBubbleController {
- @private
- SpeechRecognitionBubble::Delegate* delegate_; // weak.
- SpeechRecognitionBubbleBase::DisplayMode displayMode_;
-
- // References below are weak, being obtained from the nib.
- IBOutlet NSImageView* iconImage_;
- IBOutlet NSTextField* instructionLabel_;
- IBOutlet NSButton* cancelButton_;
- IBOutlet NSButton* tryAgainButton_;
- IBOutlet NSButton* micSettingsButton_;
-}
-
-// Initialize the window. |anchoredAt| is in screen coordinates.
-- (id)initWithParentWindow:(NSWindow*)parentWindow
- delegate:(SpeechRecognitionBubbleDelegate*)delegate
- anchoredAt:(NSPoint)anchoredAt;
-
-// Handler for the cancel button.
-- (IBAction)cancel:(id)sender;
-
-// Handler for the try again button.
-- (IBAction)tryAgain:(id)sender;
-
-// Handler for the mic settings button.
-- (IBAction)micSettings:(id)sender;
-
-// Updates the UI with data related to the given display mode.
-- (void)updateLayout:(SpeechRecognitionBubbleBase::DisplayMode)mode
- messageText:(const base::string16&)messageText
- iconImage:(NSImage*)iconImage;
-
-// Makes the speech recognition bubble visible on screen.
-- (void)show;
-
-// Hides the speech recognition bubble away from screen. This does NOT release
-// the controller and the window.
-- (void)hide;
-
-// Sets the image to be displayed in the bubble's status ImageView. A future
-// call to updateLayout may change the image.
-// TODO(satish): Clean that up and move it into the platform independent
-// SpeechRecognitionBubbleBase class.
-- (void)setImage:(NSImage*)image;
-
-@end
-
-#endif // CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/speech_recognition_window_controller.mm b/chrome/browser/ui/cocoa/speech_recognition_window_controller.mm
deleted file mode 100644
index 887f75a..0000000
--- a/chrome/browser/ui/cocoa/speech_recognition_window_controller.mm
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "speech_recognition_window_controller.h"
-
-#include "base/logging.h"
-#include "base/strings/sys_string_conversions.h"
-#include "chrome/browser/ui/cocoa/info_bubble_view.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#import "skia/ext/skia_utils_mac.h"
-#import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h"
-#include "ui/base/l10n/l10n_util_mac.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image.h"
-
-const int kBubbleControlVerticalSpacing = 10; // Space between controls.
-const int kBubbleHorizontalMargin = 5; // Space on either sides of controls.
-const int kInstructionLabelMaxWidth = 150;
-
-@interface SpeechRecognitionWindowController (Private)
-- (NSSize)calculateContentSize;
-- (void)layout:(NSSize)size;
-@end
-
-@implementation SpeechRecognitionWindowController
-
-- (id)initWithParentWindow:(NSWindow*)parentWindow
- delegate:(SpeechRecognitionBubbleDelegate*)delegate
- anchoredAt:(NSPoint)anchoredAt {
- if ((self = [super initWithWindowNibPath:@"SpeechRecognitionBubble"
- parentWindow:parentWindow
- anchoredAt:anchoredAt])) {
- DCHECK(delegate);
- delegate_ = delegate;
- displayMode_ = SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP;
- }
- return self;
-}
-
-- (void)awakeFromNib {
- [super awakeFromNib];
- InfoBubbleView* bubble = [self bubble];
- [bubble setArrowLocation:info_bubble::kTopLeft];
- NSSize arrowSize = NSMakeSize(0, info_bubble::kBubbleArrowHeight);
- arrowSize = [bubble convertSize:arrowSize toView:nil];
- NSPoint anchorPoint = self.anchorPoint;
- anchorPoint.y += arrowSize.height / 2.0;
- self.anchorPoint = anchorPoint;
-}
-
-- (IBAction)cancel:(id)sender {
- delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_CANCEL);
-}
-
-- (IBAction)tryAgain:(id)sender {
- delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_TRY_AGAIN);
-}
-
-- (IBAction)micSettings:(id)sender {
- [[NSWorkspace sharedWorkspace] openFile:
- @"/System/Library/PreferencePanes/Sound.prefPane"];
-}
-
-// Calculate the window dimensions to reflect the sum height and max width of
-// all controls, with appropriate spacing between and around them. The returned
-// size is in view coordinates.
-- (NSSize)calculateContentSize {
- [GTMUILocalizerAndLayoutTweaker sizeToFitView:cancelButton_];
- [GTMUILocalizerAndLayoutTweaker sizeToFitView:tryAgainButton_];
- [GTMUILocalizerAndLayoutTweaker sizeToFitView:micSettingsButton_];
- NSSize cancelSize = [cancelButton_ bounds].size;
- NSSize tryAgainSize = [tryAgainButton_ bounds].size;
- CGFloat newHeight = cancelSize.height + kBubbleControlVerticalSpacing;
- CGFloat newWidth = cancelSize.width;
- if (![tryAgainButton_ isHidden])
- newWidth += tryAgainSize.width;
-
- // The size of the bubble in warm up mode is fixed to be the same as in
- // recording mode, so from warm up it can transition to recording without any
- // UI jank.
- bool isWarmUp = (displayMode_ ==
- SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP);
-
- if (![iconImage_ isHidden]) {
- NSSize size = [[iconImage_ image] size];
- if (isWarmUp) {
- NSImage* volumeIcon =
- ResourceBundle::GetSharedInstance().GetNativeImageNamed(
- IDR_SPEECH_INPUT_MIC_EMPTY).ToNSImage();
- size = [volumeIcon size];
- }
- newHeight += size.height;
- newWidth = std::max(newWidth, size.width + 2 * kBubbleHorizontalMargin);
- }
-
- if (![instructionLabel_ isHidden] || isWarmUp) {
- [instructionLabel_ sizeToFit];
- NSSize textSize = [[instructionLabel_ cell] cellSize];
- NSRect boundsRect = NSMakeRect(0, 0, kInstructionLabelMaxWidth,
- CGFLOAT_MAX);
- NSSize multiLineSize =
- [[instructionLabel_ cell] cellSizeForBounds:boundsRect];
- if (textSize.width > multiLineSize.width)
- textSize = multiLineSize;
- newHeight += textSize.height + kBubbleControlVerticalSpacing;
- newWidth = std::max(newWidth, textSize.width);
- }
-
- if (![micSettingsButton_ isHidden]) {
- NSSize size = [micSettingsButton_ bounds].size;
- newHeight += size.height;
- newWidth = std::max(newWidth, size.width);
- }
-
- return NSMakeSize(newWidth + 2 * kBubbleHorizontalMargin,
- newHeight + 3 * kBubbleControlVerticalSpacing);
-}
-
-// Position the controls within the given content area bounds.
-- (void)layout:(NSSize)size {
- int y = kBubbleControlVerticalSpacing;
-
- NSRect cancelRect = [cancelButton_ bounds];
-
- if ([tryAgainButton_ isHidden]) {
- cancelRect.origin.x = (size.width - NSWidth(cancelRect)) / 2;
- } else {
- NSRect tryAgainRect = [tryAgainButton_ bounds];
- cancelRect.origin.x = (size.width - NSWidth(cancelRect) -
- NSWidth(tryAgainRect)) / 2;
- tryAgainRect.origin.x = cancelRect.origin.x + NSWidth(cancelRect);
- tryAgainRect.origin.y = y;
- [tryAgainButton_ setFrame:tryAgainRect];
- }
- cancelRect.origin.y = y;
-
- if (![cancelButton_ isHidden]) {
- [cancelButton_ setFrame:cancelRect];
- y += NSHeight(cancelRect) + kBubbleControlVerticalSpacing;
- }
-
- NSRect rect;
- if (![micSettingsButton_ isHidden]) {
- rect = [micSettingsButton_ bounds];
- rect.origin.x = (size.width - NSWidth(rect)) / 2;
- rect.origin.y = y;
- [micSettingsButton_ setFrame:rect];
- y += rect.size.height + kBubbleControlVerticalSpacing;
- }
-
- if (![instructionLabel_ isHidden]) {
- int spaceForIcon = 0;
- if (![iconImage_ isHidden]) {
- spaceForIcon = [[iconImage_ image] size].height +
- kBubbleControlVerticalSpacing;
- }
-
- rect = NSMakeRect(0, y, size.width, size.height - y - spaceForIcon -
- kBubbleControlVerticalSpacing * 2);
- [instructionLabel_ setFrame:rect];
- y = size.height - spaceForIcon - kBubbleControlVerticalSpacing;
- }
-
- if (![iconImage_ isHidden]) {
- rect.size = [[iconImage_ image] size];
- // In warm-up mode only the icon gets displayed so center it vertically.
- if (displayMode_ == SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP)
- y = (size.height - rect.size.height) / 2;
- rect.origin.x = (size.width - NSWidth(rect)) / 2;
- rect.origin.y = y;
- [iconImage_ setFrame:rect];
- }
-}
-
-- (void)updateLayout:(SpeechRecognitionBubbleBase::DisplayMode)mode
- messageText:(const base::string16&)messageText
- iconImage:(NSImage*)iconImage {
- // The very first time this method is called, the child views would still be
- // uninitialized and null. So we invoke [self window] first and that sets up
- // the child views properly so we can do the layout calculations below.
- NSWindow* window = [self window];
- displayMode_ = mode;
- BOOL is_message = (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_MESSAGE);
- BOOL is_recording =
- (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_RECORDING);
- BOOL is_warm_up = (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP);
- [iconImage_ setHidden:is_message];
- [tryAgainButton_ setHidden:!is_message];
- [micSettingsButton_ setHidden:!is_message];
- [instructionLabel_ setHidden:!is_message && !is_recording];
- [cancelButton_ setHidden:is_warm_up];
-
- // Get the right set of controls to be visible.
- if (is_message) {
- [instructionLabel_ setStringValue:base::SysUTF16ToNSString(messageText)];
- } else {
- [iconImage_ setImage:iconImage];
- [instructionLabel_ setStringValue:l10n_util::GetNSString(
- IDS_SPEECH_INPUT_BUBBLE_HEADING)];
- }
-
- NSSize newSize = [self calculateContentSize];
- [[self bubble] setFrameSize:newSize];
-
- NSSize windowDelta = [[window contentView] convertSize:newSize toView:nil];
- NSRect newFrame = [window frame];
- newFrame.origin.y -= windowDelta.height - newFrame.size.height;
- newFrame.size = windowDelta;
- [window setFrame:newFrame display:YES];
-
- [self layout:newSize]; // Layout all the child controls.
-}
-
-- (void)windowWillClose:(NSNotification*)notification {
- delegate_->InfoBubbleFocusChanged();
-}
-
-- (void)show {
- [self showWindow:nil];
-}
-
-- (void)hide {
- [[self window] orderOut:nil];
-}
-
-- (void)setImage:(NSImage*)image {
- [iconImage_ setImage:image];
-}
-
-@end // implementation SpeechRecognitionWindowController
diff --git a/chrome/browser/ui/views/speech_recognition_bubble_views.cc b/chrome/browser/ui/views/speech_recognition_bubble_views.cc
deleted file mode 100644
index 70ef972..0000000
--- a/chrome/browser/ui/views/speech_recognition_bubble_views.cc
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/speech/speech_recognition_bubble.h"
-
-#include <algorithm>
-
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/views/frame/browser_view.h"
-#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
-#include "content/public/browser/resource_context.h"
-#include "content/public/browser/speech_recognition_manager.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/views/bubble/bubble_delegate.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/image_view.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/controls/link.h"
-#include "ui/views/controls/link_listener.h"
-#include "ui/views/layout/layout_constants.h"
-#include "ui/views/widget/widget_observer.h"
-
-using content::WebContents;
-
-namespace {
-
-const int kBubbleHorizMargin = 6;
-const int kBubbleVertMargin = 4;
-const int kBubbleHeadingVertMargin = 6;
-
-// This is the SpeechRecognitionBubble content and views bubble delegate.
-class SpeechRecognitionBubbleView : public views::BubbleDelegateView,
- public views::ButtonListener,
- public views::LinkListener {
- public:
- SpeechRecognitionBubbleView(SpeechRecognitionBubbleDelegate* delegate,
- views::View* anchor_view,
- const gfx::Rect& element_rect,
- WebContents* web_contents);
-
- void UpdateLayout(SpeechRecognitionBubbleBase::DisplayMode mode,
- const base::string16& message_text,
- const gfx::ImageSkia& image);
- void SetImage(const gfx::ImageSkia& image);
-
- // views::BubbleDelegateView methods.
- virtual void OnWidgetActivationChanged(views::Widget* widget,
- bool active) OVERRIDE;
- virtual gfx::Rect GetAnchorRect() OVERRIDE;
- virtual void Init() OVERRIDE;
-
- // views::ButtonListener methods.
- virtual void ButtonPressed(views::Button* source,
- const ui::Event& event) OVERRIDE;
-
- // views::LinkListener methods.
- 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;
-
- void set_notify_delegate_on_activation_change(bool notify) {
- notify_delegate_on_activation_change_ = notify;
- }
-
- private:
- SpeechRecognitionBubbleDelegate* delegate_;
- gfx::Rect element_rect_;
- WebContents* web_contents_;
- bool notify_delegate_on_activation_change_;
- views::ImageView* icon_;
- views::Label* heading_;
- views::Label* message_;
- views::LabelButton* try_again_;
- views::LabelButton* cancel_;
- views::Link* mic_settings_;
- SpeechRecognitionBubbleBase::DisplayMode display_mode_;
- const int kIconLayoutMinWidth;
-
- DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionBubbleView);
-};
-
-SpeechRecognitionBubbleView::SpeechRecognitionBubbleView(
- SpeechRecognitionBubbleDelegate* delegate,
- views::View* anchor_view,
- const gfx::Rect& element_rect,
- WebContents* web_contents)
- : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT),
- delegate_(delegate),
- element_rect_(element_rect),
- web_contents_(web_contents),
- notify_delegate_on_activation_change_(true),
- icon_(NULL),
- heading_(NULL),
- message_(NULL),
- try_again_(NULL),
- cancel_(NULL),
- mic_settings_(NULL),
- display_mode_(SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP),
- kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_SPEECH_INPUT_MIC_EMPTY)->width()) {
- // The bubble lifetime is managed by its controller; explicitly closing
- // on deactivation will cause unexpected behavior.
- set_close_on_deactivate(false);
- // Prevent default behavior of bubble closure on escape key and handle
- // it in the AcceleratorPressed() to avoid an unexpected behavior.
- set_close_on_esc(false);
-
- // Update the bubble's bounds when the window's bounds changes.
- set_move_with_anchor(true);
-}
-
-void SpeechRecognitionBubbleView::OnWidgetActivationChanged(
- views::Widget* widget, bool active) {
- if (widget == GetWidget() && !active && notify_delegate_on_activation_change_)
- delegate_->InfoBubbleFocusChanged();
- BubbleDelegateView::OnWidgetActivationChanged(widget, active);
-}
-
-gfx::Rect SpeechRecognitionBubbleView::GetAnchorRect() {
- gfx::Rect container_rect;
- web_contents_->GetView()->GetContainerBounds(&container_rect);
- gfx::Rect anchor(element_rect_);
- anchor.Offset(container_rect.OffsetFromOrigin());
- if (!container_rect.Intersects(anchor))
- return BubbleDelegateView::GetAnchorRect();
- return anchor;
-}
-
-void SpeechRecognitionBubbleView::Init() {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- const gfx::FontList& font_list =
- rb.GetFontList(ui::ResourceBundle::MediumFont);
-
- heading_ = new views::Label(
- l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING), font_list);
- heading_->SetBorder(views::Border::CreateEmptyBorder(
- kBubbleHeadingVertMargin, 0, kBubbleHeadingVertMargin, 0));
- heading_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
- AddChildView(heading_);
-
- message_ = new views::Label(base::string16(), font_list);
- message_->SetMultiLine(true);
- AddChildView(message_);
-
- icon_ = new views::ImageView();
- icon_->SetHorizontalAlignment(views::ImageView::CENTER);
- AddChildView(icon_);
-
- cancel_ = new views::LabelButton(this, l10n_util::GetStringUTF16(IDS_CANCEL));
- cancel_->SetStyle(views::Button::STYLE_BUTTON);
- AddChildView(cancel_);
-
- try_again_ = new views::LabelButton(
- this, l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_TRY_AGAIN));
- try_again_->SetStyle(views::Button::STYLE_BUTTON);
- AddChildView(try_again_);
-
- mic_settings_ = new views::Link(
- l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_MIC_SETTINGS));
- mic_settings_->set_listener(this);
- AddChildView(mic_settings_);
-}
-
-void SpeechRecognitionBubbleView::UpdateLayout(
- SpeechRecognitionBubbleBase::DisplayMode mode,
- const base::string16& message_text,
- const gfx::ImageSkia& image) {
- display_mode_ = mode;
- bool is_message = (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_MESSAGE);
- icon_->SetVisible(!is_message);
- message_->SetVisible(is_message);
- mic_settings_->SetVisible(is_message);
- try_again_->SetVisible(is_message);
- cancel_->SetVisible(
- mode != SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP);
- heading_->SetVisible(
- mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_RECORDING);
-
- // Clickable elements should be enabled if and only if they are visible.
- mic_settings_->SetEnabled(mic_settings_->visible());
- try_again_->SetEnabled(try_again_->visible());
- cancel_->SetEnabled(cancel_->visible());
-
- if (is_message) {
- message_->SetText(message_text);
- } else {
- SetImage(image);
- }
-
- if (icon_->visible())
- icon_->ResetImageSize();
-
- // When moving from warming up to recording state, the size of the content
- // stays the same. So we wouldn't get a resize/layout call from the view
- // system and we do it ourselves.
- if (GetPreferredSize() == size()) // |size()| here is the current size.
- Layout();
-
- SizeToContents();
-}
-
-void SpeechRecognitionBubbleView::SetImage(const gfx::ImageSkia& image) {
- icon_->SetImage(image);
-}
-
-void SpeechRecognitionBubbleView::ButtonPressed(views::Button* source,
- const ui::Event& event) {
- if (source == cancel_) {
- delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_CANCEL);
- } else if (source == try_again_) {
- delegate_->InfoBubbleButtonClicked(
- SpeechRecognitionBubble::BUTTON_TRY_AGAIN);
- } else {
- NOTREACHED() << "Unknown button";
- }
-}
-
-void SpeechRecognitionBubbleView::LinkClicked(views::Link* source,
- int event_flags) {
- DCHECK_EQ(mic_settings_, 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();
- if (try_again_->visible()) {
- control_width += try_again_->GetPreferredSize().width() +
- views::kRelatedButtonHSpacing;
- }
- width = std::max(width, control_width);
- control_width = std::max(icon_->GetPreferredSize().width(),
- kIconLayoutMinWidth);
- width = std::max(width, control_width);
- if (mic_settings_->visible()) {
- control_width = mic_settings_->GetPreferredSize().width();
- width = std::max(width, control_width);
- }
-
- int height = cancel_->GetPreferredSize().height();
- if (message_->visible()) {
- height += message_->GetHeightForWidth(width) +
- views::kLabelToControlVerticalSpacing;
- }
- if (heading_->visible())
- height += heading_->GetPreferredSize().height();
- if (icon_->visible())
- height += icon_->GetImage().height();
- if (mic_settings_->visible())
- height += mic_settings_->GetPreferredSize().height();
- width += kBubbleHorizMargin * 2;
- height += kBubbleVertMargin * 2;
-
- return gfx::Size(width, height);
-}
-
-void SpeechRecognitionBubbleView::Layout() {
- int x = kBubbleHorizMargin;
- int y = kBubbleVertMargin;
- int available_width = width() - kBubbleHorizMargin * 2;
- int available_height = height() - kBubbleVertMargin * 2;
-
- if (message_->visible()) {
- DCHECK(try_again_->visible());
-
- int control_height = try_again_->GetPreferredSize().height();
- int try_again_width = try_again_->GetPreferredSize().width();
- int cancel_width = cancel_->GetPreferredSize().width();
- y += available_height - control_height;
- x += (available_width - cancel_width - try_again_width -
- views::kRelatedButtonHSpacing) / 2;
- try_again_->SetBounds(x, y, try_again_width, control_height);
- cancel_->SetBounds(x + try_again_width + views::kRelatedButtonHSpacing, y,
- cancel_width, control_height);
-
- control_height = message_->GetHeightForWidth(available_width);
- message_->SetBounds(kBubbleHorizMargin, kBubbleVertMargin,
- available_width, control_height);
- y = kBubbleVertMargin + control_height;
-
- control_height = mic_settings_->GetPreferredSize().height();
- mic_settings_->SetBounds(kBubbleHorizMargin, y, available_width,
- control_height);
- } else {
- DCHECK(icon_->visible());
-
- int control_height = icon_->GetImage().height();
- if (display_mode_ == SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP)
- y = (available_height - control_height) / 2;
- icon_->SetBounds(x, y, available_width, control_height);
- y += control_height;
-
- if (heading_->visible()) {
- control_height = heading_->GetPreferredSize().height();
- heading_->SetBounds(x, y, available_width, control_height);
- y += control_height;
- }
-
- if (cancel_->visible()) {
- control_height = cancel_->GetPreferredSize().height();
- int width = cancel_->GetPreferredSize().width();
- cancel_->SetBounds(x + (available_width - width) / 2, y, width,
- control_height);
- }
- }
-}
-
-// Implementation of SpeechRecognitionBubble.
-class SpeechRecognitionBubbleImpl
- : public SpeechRecognitionBubbleBase,
- public views::WidgetObserver {
- public:
- SpeechRecognitionBubbleImpl(int render_process_id, int render_view_id,
- Delegate* delegate,
- const gfx::Rect& element_rect);
- virtual ~SpeechRecognitionBubbleImpl();
-
- // SpeechRecognitionBubble methods.
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
-
- // SpeechRecognitionBubbleBase methods.
- virtual void UpdateLayout() OVERRIDE;
- virtual void UpdateImage() OVERRIDE;
-
- // views::WidgetObserver methods.
- virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
-
- private:
- Delegate* delegate_;
- SpeechRecognitionBubbleView* bubble_;
- gfx::Rect element_rect_;
-
- DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionBubbleImpl);
-};
-
-SpeechRecognitionBubbleImpl::SpeechRecognitionBubbleImpl(
- int render_process_id, int render_view_id, Delegate* delegate,
- const gfx::Rect& element_rect)
- : SpeechRecognitionBubbleBase(render_process_id, render_view_id),
- delegate_(delegate),
- bubble_(NULL),
- element_rect_(element_rect) {
-}
-
-SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() {
- if (bubble_) {
- bubble_->GetWidget()->RemoveObserver(this);
- bubble_->set_notify_delegate_on_activation_change(false);
- bubble_->GetWidget()->Close();
- }
-}
-
-void SpeechRecognitionBubbleImpl::OnWidgetDestroying(views::Widget* widget) {
- bubble_ = NULL;
-}
-
-void SpeechRecognitionBubbleImpl::Show() {
- WebContents* web_contents = GetWebContents();
- if (!web_contents)
- return;
-
- if (!bubble_) {
- views::View* icon = NULL;
-
- // Anchor to the location bar, in case |element_rect| is offscreen.
- Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
- if (browser) {
- BrowserView* browser_view =
- BrowserView::GetBrowserViewForBrowser(browser);
- icon = browser_view->GetLocationBarView() ?
- browser_view->GetLocationBarView()->GetLocationBarAnchor() : NULL;
- }
-
- bubble_ = new SpeechRecognitionBubbleView(delegate_, icon, element_rect_,
- web_contents);
-
- if (!icon) {
- // We dont't have an icon to attach to. Manually specify the web contents
- // window as the parent.
- bubble_->set_parent_window(
- web_contents->GetView()->GetTopLevelNativeWindow());
- }
-
- views::BubbleDelegateView::CreateBubble(bubble_);
- UpdateLayout();
- bubble_->GetWidget()->AddObserver(this);
- }
- bubble_->GetWidget()->Show();
-}
-
-void SpeechRecognitionBubbleImpl::Hide() {
- if (bubble_)
- bubble_->GetWidget()->Hide();
-}
-
-void SpeechRecognitionBubbleImpl::UpdateLayout() {
- if (bubble_ && GetWebContents())
- bubble_->UpdateLayout(display_mode(), message_text(), icon_image());
-}
-
-void SpeechRecognitionBubbleImpl::UpdateImage() {
- if (bubble_ && GetWebContents())
- bubble_->SetImage(icon_image());
-}
-
-} // namespace
-
-SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
- int render_process_id,
- int render_view_id,
- SpeechRecognitionBubble::Delegate* delegate,
- const gfx::Rect& element_rect) {
- return new SpeechRecognitionBubbleImpl(render_process_id, render_view_id,
- delegate, element_rect);
-}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index e10cca7..d99874b 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2084,14 +2084,8 @@
'browser/site_details.h',
'browser/speech/chrome_speech_recognition_manager_delegate.cc',
'browser/speech/chrome_speech_recognition_manager_delegate.h',
- 'browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.cc',
- 'browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui.h',
'browser/speech/extension_api/tts_extension_api_constants.cc',
'browser/speech/extension_api/tts_extension_api_constants.h',
- 'browser/speech/speech_recognition_bubble.cc',
- 'browser/speech/speech_recognition_bubble.h',
- 'browser/speech/speech_recognition_bubble_controller.cc',
- 'browser/speech/speech_recognition_bubble_controller.h',
'browser/speech/tts_android.cc',
'browser/speech/tts_android.h',
'browser/speech/tts_chromeos.cc',
@@ -3077,12 +3071,6 @@
'browser/net/nss_context.h',
],
}],
- ['input_speech==0', {
- 'sources/': [
- ['exclude', '^browser/speech/chrome_speech_recognition_manager_delegate_bubble_ui'],
- ['exclude', '^browser/speech/speech_recognition_bubble'],
- ],
- }],
['notifications==0', {
'sources/': [
['exclude', '^browser/notifications/'],
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 0f6251a..6ec0d1a 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -1000,9 +1000,6 @@
'browser/ui/cocoa/screen_capture_notification_ui_cocoa.h',
'browser/ui/cocoa/screen_capture_notification_ui_cocoa.mm',
'browser/ui/cocoa/simple_message_box_mac.mm',
- 'browser/ui/cocoa/speech_recognition_bubble_cocoa.mm',
- 'browser/ui/cocoa/speech_recognition_window_controller.h',
- 'browser/ui/cocoa/speech_recognition_window_controller.mm',
'browser/ui/cocoa/sprite_view.h',
'browser/ui/cocoa/sprite_view.mm',
'browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h',
@@ -1864,7 +1861,6 @@
'browser/ui/views/signed_certificate_timestamp_info_view.cc',
'browser/ui/views/signed_certificate_timestamp_info_view.h',
'browser/ui/views/simple_message_box_views.cc',
- 'browser/ui/views/speech_recognition_bubble_views.cc',
'browser/ui/views/ssl_client_certificate_selector.cc',
'browser/ui/views/ssl_client_certificate_selector.h',
'browser/ui/views/session_crashed_bubble_view.cc',
@@ -3036,7 +3032,6 @@
['exclude', '^browser/ui/views/frame/app_panel_browser_frame_view.h'],
['exclude', '^browser/ui/views/uninstall_view.cc'],
['exclude', '^browser/ui/views/uninstall_view.h'],
- ['include', '^browser/ui/views/speech_recognition_bubble_views.cc'],
['include', '^browser/ui/window_sizer/window_sizer.cc'],
['include', '^browser/ui/window_sizer/window_sizer.h'],
],
diff --git a/chrome/chrome_nibs.gyp b/chrome/chrome_nibs.gyp
index 84b0bf0..b2a661c 100644
--- a/chrome/chrome_nibs.gyp
+++ b/chrome/chrome_nibs.gyp
@@ -191,8 +191,6 @@
'browser/ui/cocoa/one_click_signin_view_controller.mm',
'browser/ui/cocoa/screen_capture_notification_ui_cocoa.h',
'browser/ui/cocoa/screen_capture_notification_ui_cocoa.mm',
- 'browser/ui/cocoa/speech_recognition_window_controller.h',
- 'browser/ui/cocoa/speech_recognition_window_controller.mm',
'browser/ui/cocoa/status_bubble_mac.h',
'browser/ui/cocoa/status_bubble_mac.mm',
'browser/ui/cocoa/styled_text_field.h',
diff --git a/chrome/chrome_nibs.gypi b/chrome/chrome_nibs.gypi
index 2cc0dea..3ad7f21 100644
--- a/chrome/chrome_nibs.gypi
+++ b/chrome/chrome_nibs.gypi
@@ -45,7 +45,6 @@
'app/nibs/OneClickSigninBubble.xib',
'app/nibs/OneClickSigninDialog.xib',
'app/nibs/SaveAccessoryView.xib',
- 'app/nibs/SpeechRecognitionBubble.xib',
'app/nibs/TaskManager.xib',
'app/nibs/Toolbar.xib',
'app/nibs/WrenchMenu.xib',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 8fd2444..4433ec4 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1284,7 +1284,6 @@
'browser/sessions/tab_restore_browsertest.cc',
'browser/signin/signin_browsertest.cc',
'browser/speech/extension_api/tts_extension_apitest.cc',
- 'browser/speech/speech_recognition_bubble_browsertest.cc',
'browser/spellchecker/spellcheck_service_browsertest.cc',
'browser/ssl/ssl_browser_tests.cc',
'browser/ssl/ssl_client_certificate_selector_test.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index ad9cba8..abfff82 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1285,7 +1285,6 @@
'browser/signin/signin_promo_unittest.cc',
'browser/signin/signin_tracker_unittest.cc',
'browser/speech/extension_api/extension_manifests_tts_unittest.cc',
- 'browser/speech/speech_recognition_bubble_controller_unittest.cc',
'browser/speech/tts_controller_unittest.cc',
'browser/spellchecker/feedback_sender_unittest.cc',
'browser/spellchecker/feedback_unittest.cc',
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 8c7dce3..8d3b820 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -493,9 +493,6 @@ const char kOutdatedPluginLearnMoreURL[] =
const char kBlockedPluginLearnMoreURL[] =
"https://support.google.com/chrome/?p=ib_blocked_plugin";
-const char kSpeechInputAboutURL[] =
- "https://support.google.com/chrome/?p=ui_speech_input";
-
const char kHotwordLearnMoreURL[] =
"https://support.google.com/chrome/?p=ui_hotword_search";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index a153dda..bd84788 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -424,9 +424,6 @@ extern const char kOutdatedPluginLearnMoreURL[];
// The URL for the "Learn more" page for the blocked plugin infobar.
extern const char kBlockedPluginLearnMoreURL[];
-// The URL for the "About Voice Recognition" menu item.
-extern const char kSpeechInputAboutURL[];
-
// The URL for the "Learn more" page for hotword search voice trigger.
extern const char kHotwordLearnMoreURL[];
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 04368dd..40699bc 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -99,7 +99,6 @@
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_dispatcher_host.h"
#include "content/browser/shared_worker/shared_worker_message_filter.h"
-#include "content/browser/speech/input_tag_speech_dispatcher_host.h"
#include "content/browser/speech/speech_recognition_dispatcher_host.h"
#include "content/browser/storage_partition_impl.h"
#include "content/browser/streams/stream_context.h"
@@ -724,10 +723,6 @@ void RenderProcessHostImpl::CreateMessageFilters() {
#if defined(ENABLE_PLUGINS)
AddFilter(new PepperRendererConnection(GetID()));
#endif
-#if defined(ENABLE_INPUT_SPEECH)
- AddFilter(new InputTagSpeechDispatcherHost(
- IsGuest(), GetID(), storage_partition_impl_->GetURLRequestContext()));
-#endif
AddFilter(new SpeechRecognitionDispatcherHost(
IsGuest(), GetID(), storage_partition_impl_->GetURLRequestContext()));
AddFilter(new FileAPIMessageFilter(
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index b2ccf39..5d17e88 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -1497,10 +1497,6 @@ void RenderViewHostImpl::SendOrientationChangeEvent(int orientation) {
Send(new ViewMsg_OrientationChangeEvent(GetRoutingID(), orientation));
}
-void RenderViewHostImpl::ToggleSpeechInput() {
- Send(new InputTagSpeechMsg_ToggleSpeechInput(GetRoutingID()));
-}
-
bool RenderViewHostImpl::IsWaitingForUnloadACK() const {
return rvh_state_ == STATE_WAITING_FOR_UNLOAD_ACK ||
rvh_state_ == STATE_WAITING_FOR_CLOSE ||
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 6460cd3e..f20b5c0 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -203,7 +203,6 @@ class CONTENT_EXPORT RenderViewHostImpl
const std::string& value) OVERRIDE;
virtual void Zoom(PageZoom zoom) OVERRIDE;
virtual void SyncRendererPrefs() OVERRIDE;
- virtual void ToggleSpeechInput() OVERRIDE;
virtual WebPreferences GetWebkitPreferences() OVERRIDE;
virtual void UpdateWebkitPreferences(
const WebPreferences& prefs) OVERRIDE;
diff --git a/content/browser/speech/input_tag_speech_browsertest.cc b/content/browser/speech/input_tag_speech_browsertest.cc
deleted file mode 100644
index cc3bc11..0000000
--- a/content/browser/speech/input_tag_speech_browsertest.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/utf_string_conversions.h"
-#include "content/browser/renderer_host/render_view_host_impl.h"
-#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/public/browser/notification_types.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/content_switches.h"
-#include "content/public/common/speech_recognition_error.h"
-#include "content/public/common/speech_recognition_result.h"
-#include "content/public/common/url_constants.h"
-#include "content/public/test/content_browser_test.h"
-#include "content/public/test/content_browser_test_utils.h"
-#include "content/public/test/fake_speech_recognition_manager.h"
-#include "content/public/test/test_utils.h"
-#include "content/shell/browser/shell.h"
-#include "third_party/WebKit/public/web/WebInputEvent.h"
-
-namespace content {
-
-class InputTagSpeechBrowserTest : public ContentBrowserTest {
- public:
- // ContentBrowserTest methods
- virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
- EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableSpeechInput));
- }
-
- protected:
- void LoadAndStartSpeechRecognitionTest(const char* filename) {
- // The test page calculates the speech button's coordinate in the page on
- // load & sets that coordinate in the URL fragment. We send mouse down & up
- // events at that coordinate to trigger speech recognition.
- GURL test_url = GetTestUrl("speech", filename);
- NavigateToURL(shell(), test_url);
-
- blink::WebMouseEvent mouse_event;
- mouse_event.type = blink::WebInputEvent::MouseDown;
- mouse_event.button = blink::WebMouseEvent::ButtonLeft;
- mouse_event.x = 0;
- mouse_event.y = 0;
- mouse_event.clickCount = 1;
- WebContents* web_contents = shell()->web_contents();
-
- WindowedNotificationObserver observer(
- NOTIFICATION_LOAD_STOP,
- Source<NavigationController>(&web_contents->GetController()));
- web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
- mouse_event.type = blink::WebInputEvent::MouseUp;
- web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
- fake_speech_recognition_manager_.WaitForRecognitionStarted();
-
- // We should wait for a navigation event, raised by the test page JS code
- // upon the onwebkitspeechchange event, in all cases except when the
- // speech response is inhibited.
- if (fake_speech_recognition_manager_.should_send_fake_response())
- observer.Wait();
- }
-
- void RunSpeechRecognitionTest(const char* filename) {
- // The fake speech input manager would receive the speech input
- // request and return the test string as recognition result. The test page
- // then sets the URL fragment as 'pass' if it received the expected string.
- LoadAndStartSpeechRecognitionTest(filename);
-
- EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
- }
-
- // ContentBrowserTest methods.
- virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
- fake_speech_recognition_manager_.set_should_send_fake_response(true);
- speech_recognition_manager_ = &fake_speech_recognition_manager_;
-
- // Inject the fake manager factory so that the test result is returned to
- // the web page.
- SpeechRecognitionManager::SetManagerForTesting(speech_recognition_manager_);
- }
-
- virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
- speech_recognition_manager_ = NULL;
- }
-
- FakeSpeechRecognitionManager fake_speech_recognition_manager_;
-
- // This is used by the static |fakeManager|, and it is a pointer rather than a
- // direct instance per the style guide.
- static SpeechRecognitionManager* speech_recognition_manager_;
-};
-
-SpeechRecognitionManager*
- InputTagSpeechBrowserTest::speech_recognition_manager_ = NULL;
-
-// TODO(satish): Once this flakiness has been fixed, add a second test here to
-// check for sending many clicks in succession to the speech button and verify
-// that it doesn't cause any crash but works as expected. This should act as the
-// test for http://crbug.com/59173
-//
-// TODO(satish): Similar to above, once this flakiness has been fixed add
-// another test here to check that when speech recognition is in progress and
-// a renderer crashes, we get a call to
-// SpeechRecognitionManager::CancelAllRequestsWithDelegate.
-// crbug/360448
-IN_PROC_BROWSER_TEST_F(InputTagSpeechBrowserTest,
- DISABLED_TestBasicRecognition) {
- RunSpeechRecognitionTest("basic_recognition.html");
- EXPECT_TRUE(fake_speech_recognition_manager_.grammar().empty());
-}
-
-// crbug/360448
-IN_PROC_BROWSER_TEST_F(InputTagSpeechBrowserTest, DISABLED_GrammarAttribute) {
- RunSpeechRecognitionTest("grammar_attribute.html");
- EXPECT_EQ("http://example.com/grammar.xml",
- fake_speech_recognition_manager_.grammar());
-}
-
-// Flaky on Linux, Windows and Mac http://crbug.com/140765.
-IN_PROC_BROWSER_TEST_F(InputTagSpeechBrowserTest, DISABLED_TestCancelAll) {
- // The test checks that the cancel-all callback gets issued when a session
- // is pending, so don't send a fake response.
- // We are not expecting a navigation event being raised from the JS of the
- // test page JavaScript in this case.
- fake_speech_recognition_manager_.set_should_send_fake_response(false);
-
- LoadAndStartSpeechRecognitionTest("basic_recognition.html");
-
- // Make the renderer crash. This should trigger
- // InputTagSpeechDispatcherHost to cancel all pending sessions.
- NavigateToURL(shell(), GURL(kChromeUICrashURL));
-
- EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all());
-}
-
-} // namespace content
diff --git a/content/browser/speech/input_tag_speech_dispatcher_host.cc b/content/browser/speech/input_tag_speech_dispatcher_host.cc
deleted file mode 100644
index dd6a4b26..0000000
--- a/content/browser/speech/input_tag_speech_dispatcher_host.cc
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/browser/speech/input_tag_speech_dispatcher_host.h"
-
-#include "base/bind.h"
-#include "base/lazy_instance.h"
-#include "content/browser/browser_plugin/browser_plugin_guest.h"
-#include "content/browser/child_process_security_policy_impl.h"
-#include "content/browser/renderer_host/render_view_host_impl.h"
-#include "content/browser/speech/speech_recognition_manager_impl.h"
-#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/speech_recognition_messages.h"
-#include "content/public/browser/speech_recognition_manager_delegate.h"
-#include "content/public/browser/speech_recognition_session_config.h"
-#include "content/public/browser/speech_recognition_session_context.h"
-
-namespace {
-const uint32 kMaxHypothesesForSpeechInputTag = 6;
-}
-
-namespace content {
-
-InputTagSpeechDispatcherHost::InputTagSpeechDispatcherHost(
- bool is_guest,
- int render_process_id,
- net::URLRequestContextGetter* url_request_context_getter)
- : BrowserMessageFilter(SpeechRecognitionMsgStart),
- is_guest_(is_guest),
- render_process_id_(render_process_id),
- url_request_context_getter_(url_request_context_getter),
- weak_factory_(this) {
- // Do not add any non-trivial initialization here, instead do it lazily when
- // required (e.g. see the method |SpeechRecognitionManager::GetInstance()|) or
- // add an Init() method.
-}
-
-InputTagSpeechDispatcherHost::~InputTagSpeechDispatcherHost() {
- SpeechRecognitionManager::GetInstance()->AbortAllSessionsForRenderProcess(
- render_process_id_);
-}
-
-base::WeakPtr<InputTagSpeechDispatcherHost>
-InputTagSpeechDispatcherHost::AsWeakPtr() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- return weak_factory_.GetWeakPtr();
-}
-
-bool InputTagSpeechDispatcherHost::OnMessageReceived(
- const IPC::Message& message, bool* message_was_ok) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP_EX(InputTagSpeechDispatcherHost, message,
- *message_was_ok)
- IPC_MESSAGE_HANDLER(InputTagSpeechHostMsg_StartRecognition,
- OnStartRecognition)
- IPC_MESSAGE_HANDLER(InputTagSpeechHostMsg_CancelRecognition,
- OnCancelRecognition)
- IPC_MESSAGE_HANDLER(InputTagSpeechHostMsg_StopRecording,
- OnStopRecording)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void InputTagSpeechDispatcherHost::OverrideThreadForMessage(
- const IPC::Message& message,
- BrowserThread::ID* thread) {
- if (message.type() == InputTagSpeechHostMsg_StartRecognition::ID)
- *thread = BrowserThread::UI;
-}
-
-void InputTagSpeechDispatcherHost::OnChannelClosing() {
- weak_factory_.InvalidateWeakPtrs();
-}
-
-void InputTagSpeechDispatcherHost::OnStartRecognition(
- const InputTagSpeechHostMsg_StartRecognition_Params& params) {
- InputTagSpeechHostMsg_StartRecognition_Params input_params(params);
- int render_process_id = render_process_id_;
-
- // Check that the origin specified by the renderer process is one
- // that it is allowed to access.
- if (params.origin_url != "null" &&
- !ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(
- render_process_id, GURL(params.origin_url))) {
- LOG(ERROR) << "ITSDH::OnStartRecognition, disallowed origin: "
- << params.origin_url;
- return;
- }
-
- // The chrome layer is mostly oblivious to BrowserPlugin guests and so it
- // cannot correctly place the speech bubble relative to a guest. Thus, we
- // set up the speech recognition context relative to the embedder.
- int guest_render_view_id = MSG_ROUTING_NONE;
- if (is_guest_) {
- RenderViewHostImpl* render_view_host =
- RenderViewHostImpl::FromID(render_process_id_, params.render_view_id);
- WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
- WebContents::FromRenderViewHost(render_view_host));
- BrowserPluginGuest* guest = web_contents->GetBrowserPluginGuest();
- input_params.element_rect.set_origin(
- guest->GetScreenCoordinates(input_params.element_rect.origin()));
- guest_render_view_id = params.render_view_id;
- render_process_id =
- guest->embedder_web_contents()->GetRenderProcessHost()->GetID();
- input_params.render_view_id =
- guest->embedder_web_contents()->GetRoutingID();
- }
- bool filter_profanities =
- SpeechRecognitionManagerImpl::GetInstance() &&
- SpeechRecognitionManagerImpl::GetInstance()->delegate() &&
- SpeechRecognitionManagerImpl::GetInstance()->delegate()->
- FilterProfanities(render_process_id_);
-
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(
- &InputTagSpeechDispatcherHost::StartRecognitionOnIO,
- this,
- render_process_id,
- guest_render_view_id,
- input_params,
- filter_profanities));
-}
-
-void InputTagSpeechDispatcherHost::StartRecognitionOnIO(
- int render_process_id,
- int guest_render_view_id,
- const InputTagSpeechHostMsg_StartRecognition_Params& params,
- bool filter_profanities) {
- SpeechRecognitionSessionContext context;
- context.render_process_id = render_process_id;
- context.render_view_id = params.render_view_id;
- context.guest_render_view_id = guest_render_view_id;
- // Keep context.embedder_render_process_id and context.embedder_render_view_id
- // unset.
- context.request_id = params.request_id;
- context.element_rect = params.element_rect;
-
- SpeechRecognitionSessionConfig config;
- config.language = params.language;
- if (!params.grammar.empty()) {
- config.grammars.push_back(SpeechRecognitionGrammar(params.grammar));
- }
- config.max_hypotheses = kMaxHypothesesForSpeechInputTag;
- config.origin_url = params.origin_url;
- config.initial_context = context;
- config.url_request_context_getter = url_request_context_getter_.get();
- config.filter_profanities = filter_profanities;
- config.event_listener = AsWeakPtr();
-
- int session_id = SpeechRecognitionManager::GetInstance()->CreateSession(
- config);
- DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid);
- SpeechRecognitionManager::GetInstance()->StartSession(session_id);
-}
-
-void InputTagSpeechDispatcherHost::OnCancelRecognition(int render_view_id,
- int request_id) {
- int session_id = SpeechRecognitionManager::GetInstance()->GetSession(
- render_process_id_, render_view_id, request_id);
-
- // The renderer might provide an invalid |request_id| if the session was not
- // started as expected, e.g., due to unsatisfied security requirements.
- if (session_id != SpeechRecognitionManager::kSessionIDInvalid)
- SpeechRecognitionManager::GetInstance()->AbortSession(session_id);
-}
-
-void InputTagSpeechDispatcherHost::OnStopRecording(int render_view_id,
- int request_id) {
- int session_id = SpeechRecognitionManager::GetInstance()->GetSession(
- render_process_id_, render_view_id, request_id);
-
- // The renderer might provide an invalid |request_id| if the session was not
- // started as expected, e.g., due to unsatisfied security requirements.
- if (session_id != SpeechRecognitionManager::kSessionIDInvalid) {
- SpeechRecognitionManager::GetInstance()->StopAudioCaptureForSession(
- session_id);
- }
-}
-
-// -------- SpeechRecognitionEventListener interface implementation -----------
-void InputTagSpeechDispatcherHost::OnRecognitionResults(
- int session_id,
- const SpeechRecognitionResults& results) {
- DVLOG(1) << "InputTagSpeechDispatcherHost::OnRecognitionResults enter";
-
- const SpeechRecognitionSessionContext& context =
- SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
-
- int render_view_id =
- context.guest_render_view_id == MSG_ROUTING_NONE ?
- context.render_view_id : context.guest_render_view_id;
- Send(new InputTagSpeechMsg_SetRecognitionResults(
- render_view_id,
- context.request_id,
- results));
- DVLOG(1) << "InputTagSpeechDispatcherHost::OnRecognitionResults exit";
-}
-
-void InputTagSpeechDispatcherHost::OnAudioEnd(int session_id) {
- DVLOG(1) << "InputTagSpeechDispatcherHost::OnAudioEnd enter";
-
- const SpeechRecognitionSessionContext& context =
- SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
- int render_view_id =
- context.guest_render_view_id == MSG_ROUTING_NONE ?
- context.render_view_id : context.guest_render_view_id;
- Send(new InputTagSpeechMsg_RecordingComplete(render_view_id,
- context.request_id));
- DVLOG(1) << "InputTagSpeechDispatcherHost::OnAudioEnd exit";
-}
-
-void InputTagSpeechDispatcherHost::OnRecognitionEnd(int session_id) {
- DVLOG(1) << "InputTagSpeechDispatcherHost::OnRecognitionEnd enter";
- const SpeechRecognitionSessionContext& context =
- SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
- int render_view_id =
- context.guest_render_view_id == MSG_ROUTING_NONE ?
- context.render_view_id : context.guest_render_view_id;
- Send(new InputTagSpeechMsg_RecognitionComplete(render_view_id,
- context.request_id));
- DVLOG(1) << "InputTagSpeechDispatcherHost::OnRecognitionEnd exit";
-}
-
-// The events below are currently not used by x-webkit-speech implementation.
-void InputTagSpeechDispatcherHost::OnRecognitionStart(int session_id) {}
-void InputTagSpeechDispatcherHost::OnAudioStart(int session_id) {}
-void InputTagSpeechDispatcherHost::OnSoundStart(int session_id) {}
-void InputTagSpeechDispatcherHost::OnSoundEnd(int session_id) {}
-void InputTagSpeechDispatcherHost::OnRecognitionError(
- int session_id,
- const SpeechRecognitionError& error) {}
-void InputTagSpeechDispatcherHost::OnAudioLevelsChange(
- int session_id, float volume, float noise_volume) {}
-void InputTagSpeechDispatcherHost::OnEnvironmentEstimationComplete(
- int session_id) {}
-
-} // namespace content
diff --git a/content/browser/speech/input_tag_speech_dispatcher_host.h b/content/browser/speech/input_tag_speech_dispatcher_host.h
deleted file mode 100644
index 4d5eb60..0000000
--- a/content/browser/speech/input_tag_speech_dispatcher_host.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_BROWSER_SPEECH_INPUT_TAG_SPEECH_DISPATCHER_HOST_H_
-#define CONTENT_BROWSER_SPEECH_INPUT_TAG_SPEECH_DISPATCHER_HOST_H_
-
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "content/common/content_export.h"
-#include "content/public/browser/browser_message_filter.h"
-#include "content/public/browser/speech_recognition_event_listener.h"
-#include "content/public/common/speech_recognition_result.h"
-#include "net/url_request/url_request_context_getter.h"
-
-struct InputTagSpeechHostMsg_StartRecognition_Params;
-
-namespace content {
-
-class SpeechRecognitionManager;
-
-// InputTagSpeechDispatcherHost is a delegate for Speech API messages used by
-// RenderMessageFilter. Basically it acts as a proxy, relaying the events coming
-// from the SpeechRecognitionManager to IPC messages (and vice versa).
-// It's the complement of SpeechRecognitionDispatcher (owned by RenderView).
-class CONTENT_EXPORT InputTagSpeechDispatcherHost
- : public BrowserMessageFilter,
- public SpeechRecognitionEventListener {
- public:
- InputTagSpeechDispatcherHost(
- bool guest,
- int render_process_id,
- net::URLRequestContextGetter* url_request_context_getter);
-
- base::WeakPtr<InputTagSpeechDispatcherHost> AsWeakPtr();
-
- // SpeechRecognitionEventListener methods.
- virtual void OnRecognitionStart(int session_id) OVERRIDE;
- virtual void OnAudioStart(int session_id) OVERRIDE;
- virtual void OnEnvironmentEstimationComplete(int session_id) OVERRIDE;
- virtual void OnSoundStart(int session_id) OVERRIDE;
- virtual void OnSoundEnd(int session_id) OVERRIDE;
- virtual void OnAudioEnd(int session_id) OVERRIDE;
- virtual void OnRecognitionEnd(int session_id) OVERRIDE;
- virtual void OnRecognitionResults(
- int session_id,
- const SpeechRecognitionResults& results) OVERRIDE;
- virtual void OnRecognitionError(
- int session_id,
- const SpeechRecognitionError& error) OVERRIDE;
- virtual void OnAudioLevelsChange(int session_id,
- float volume,
- float noise_volume) OVERRIDE;
-
- // BrowserMessageFilter implementation.
- virtual bool OnMessageReceived(const IPC::Message& message,
- bool* message_was_ok) OVERRIDE;
- virtual void OverrideThreadForMessage(
- const IPC::Message& message,
- BrowserThread::ID* thread) OVERRIDE;
-
- virtual void OnChannelClosing() OVERRIDE;
-
- private:
- virtual ~InputTagSpeechDispatcherHost();
-
- void OnStartRecognition(
- const InputTagSpeechHostMsg_StartRecognition_Params& params);
- void OnCancelRecognition(int render_view_id, int request_id);
- void OnStopRecording(int render_view_id, int request_id);
-
- void StartRecognitionOnIO(
- int embedder_render_process_id,
- int embedder_render_view_id,
- const InputTagSpeechHostMsg_StartRecognition_Params& params,
- bool filter_profanities);
-
- bool is_guest_;
- int render_process_id_;
- scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
-
- // Used for posting asynchronous tasks (on the IO thread) without worrying
- // about this class being destroyed in the meanwhile (due to browser shutdown)
- // since tasks pending on a destroyed WeakPtr are automatically discarded.
- base::WeakPtrFactory<InputTagSpeechDispatcherHost> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(InputTagSpeechDispatcherHost);
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_SPEECH_INPUT_TAG_SPEECH_DISPATCHER_HOST_H_
diff --git a/content/browser/speech/speech_recognition_dispatcher_host.cc b/content/browser/speech/speech_recognition_dispatcher_host.cc
index 57b3bc6c..1c97a4f 100644
--- a/content/browser/speech/speech_recognition_dispatcher_host.cc
+++ b/content/browser/speech/speech_recognition_dispatcher_host.cc
@@ -105,8 +105,7 @@ void SpeechRecognitionDispatcherHost::OnStartRequest(
}
// TODO(lazyboy): Check if filter_profanities should use |render_process_id|
- // instead of |render_process_id_|. We are also using the same value in
- // input_tag_dispatcher_host.cc
+ // instead of |render_process_id_|.
bool filter_profanities =
SpeechRecognitionManagerImpl::GetInstance() &&
SpeechRecognitionManagerImpl::GetInstance()->delegate() &&
@@ -138,7 +137,6 @@ void SpeechRecognitionDispatcherHost::OnStartRequestOnIO(
if (embedder_render_process_id)
context.guest_render_view_id = params.render_view_id;
context.request_id = params.request_id;
- context.requested_by_page_element = false;
SpeechRecognitionSessionConfig config;
config.is_legacy_api = false;
diff --git a/content/browser/speech/speech_recognition_manager_impl.cc b/content/browser/speech/speech_recognition_manager_impl.cc
index a9d3de5..4b0827a 100644
--- a/content/browser/speech/speech_recognition_manager_impl.cc
+++ b/content/browser/speech/speech_recognition_manager_impl.cc
@@ -290,8 +290,8 @@ void SpeechRecognitionManagerImpl::StopAudioCaptureForSession(int session_id) {
// Here begins the SpeechRecognitionEventListener interface implementation,
// which will simply relay the events to the proper listener registered for the
-// particular session (most likely InputTagSpeechDispatcherHost) and to the
-// catch-all listener provided by the delegate (if any).
+// particular session and to the catch-all listener provided by the delegate
+// (if any).
void SpeechRecognitionManagerImpl::OnRecognitionStart(int session_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index 18f751a..0fc3268 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -56,7 +56,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::ContextMenuParams)
IPC_STRUCT_TRAITS_MEMBER(misspelled_word)
IPC_STRUCT_TRAITS_MEMBER(misspelling_hash)
IPC_STRUCT_TRAITS_MEMBER(dictionary_suggestions)
- IPC_STRUCT_TRAITS_MEMBER(speech_input_enabled)
IPC_STRUCT_TRAITS_MEMBER(spellcheck_enabled)
IPC_STRUCT_TRAITS_MEMBER(is_editable)
IPC_STRUCT_TRAITS_MEMBER(writing_direction_default)
diff --git a/content/common/speech_recognition_messages.h b/content/common/speech_recognition_messages.h
index 0af0d39..4840abd 100644
--- a/content/common/speech_recognition_messages.h
+++ b/content/common/speech_recognition_messages.h
@@ -40,67 +40,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionGrammar)
IPC_STRUCT_TRAITS_MEMBER(weight)
IPC_STRUCT_TRAITS_END()
-// Used to start a speech recognition session.
-IPC_STRUCT_BEGIN(InputTagSpeechHostMsg_StartRecognition_Params)
- // The render view requesting speech recognition.
- IPC_STRUCT_MEMBER(int, render_view_id)
- // Request ID used within the render view.
- IPC_STRUCT_MEMBER(int, request_id)
- // Position of the UI element in page coordinates.
- IPC_STRUCT_MEMBER(gfx::Rect, element_rect)
- // Language to use for speech recognition.
- IPC_STRUCT_MEMBER(std::string, language)
- // Speech grammar given by the speech recognition element.
- IPC_STRUCT_MEMBER(std::string, grammar)
- // URL of the page (or iframe if applicable).
- IPC_STRUCT_MEMBER(std::string, origin_url)
-IPC_STRUCT_END()
-
-// Renderer -> Browser messages.
-
-// Requests the speech recognition service to start speech recognition on behalf
-// of the given |render_view_id|.
-IPC_MESSAGE_CONTROL1(InputTagSpeechHostMsg_StartRecognition,
- InputTagSpeechHostMsg_StartRecognition_Params)
-
-// Requests the speech recognition service to cancel speech recognition on
-// behalf of the given |render_view_id|. If speech recognition is not happening
-// or is happening on behalf of some other render view, this call does nothing.
-IPC_MESSAGE_CONTROL2(InputTagSpeechHostMsg_CancelRecognition,
- int /* render_view_id */,
- int /* request_id */)
-
-// Requests the speech recognition service to stop audio recording on behalf of
-// the given |render_view_id|. Any audio recorded so far will be fed to the
-// speech recognizer. If speech recognition is not happening nor or is
-// happening on behalf of some other render view, this call does nothing.
-IPC_MESSAGE_CONTROL2(InputTagSpeechHostMsg_StopRecording,
- int /* render_view_id */,
- int /* request_id */)
-
-// Browser -> Renderer messages.
-
-// Relays a speech recognition result, either partial or final.
-IPC_MESSAGE_ROUTED2(InputTagSpeechMsg_SetRecognitionResults,
- int /* request_id */,
- content::SpeechRecognitionResults /* results */)
-
-// Indicates that speech recognizer has stopped recording and started
-// recognition.
-IPC_MESSAGE_ROUTED1(InputTagSpeechMsg_RecordingComplete,
- int /* request_id */)
-
-// Indicates that speech recognizer has completed recognition. This will be the
-// last message sent in response to a InputTagSpeechHostMsg_StartRecognition.
-IPC_MESSAGE_ROUTED1(InputTagSpeechMsg_RecognitionComplete,
- int /* request_id */)
-
-// Toggles speech recognition on or off on the speech input control for the
-// current focused element. Has no effect if the current element doesn't
-// support speech recognition.
-IPC_MESSAGE_ROUTED0(InputTagSpeechMsg_ToggleSpeechInput)
-
-
// ------- Messages for Speech JS APIs (SpeechRecognitionDispatcher) ----------
// Renderer -> Browser messages.
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 58e8d48..99fc3f0 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -1221,8 +1221,6 @@
'browser/speech/google_one_shot_remote_engine.h',
'browser/speech/google_streaming_remote_engine.cc',
'browser/speech/google_streaming_remote_engine.h',
- 'browser/speech/input_tag_speech_dispatcher_host.cc',
- 'browser/speech/input_tag_speech_dispatcher_host.h',
'browser/speech/speech_recognition_dispatcher_host.cc',
'browser/speech/speech_recognition_dispatcher_host.h',
'browser/speech/speech_recognition_engine.cc',
@@ -1711,11 +1709,7 @@
['exclude', '^browser/renderer_host/pepper/'],
],
}],
- ['input_speech==0', {
- 'sources/': [
- ['exclude', '^browser/speech/input_tag_speech_dispatcher_host\\.(cc|h)$'],
- ],
- }, { # input_speech==1
+ ['input_speech==1', {
'dependencies': [
'../third_party/flac/flac.gyp:libflac',
'../third_party/speex/speex.gyp:libspeex',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 31b8f5b..66f73de 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -184,8 +184,6 @@
'renderer/input/input_handler_proxy.h',
'renderer/input/input_handler_wrapper.cc',
'renderer/input/input_handler_wrapper.h',
- 'renderer/input_tag_speech_dispatcher.cc',
- 'renderer/input_tag_speech_dispatcher.h',
'renderer/internal_document_state_data.cc',
'renderer/internal_document_state_data.h',
'renderer/java/java_bridge_channel.cc',
@@ -556,12 +554,6 @@
'renderer/active_notification_tracker.cc',
],
}],
- ['input_speech==0', {
- 'sources!': [
- 'renderer/input_tag_speech_dispatcher.cc',
- 'renderer/input_tag_speech_dispatcher.h',
- ]
- }],
['OS=="mac"', {
'sources!': [
'common/process_watcher_posix.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 46993d6..5d6fdd3 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -1105,7 +1105,6 @@
'browser/service_worker/service_worker_browsertest.cc',
'browser/session_history_browsertest.cc',
'browser/site_per_process_browsertest.cc',
- 'browser/speech/input_tag_speech_browsertest.cc',
'browser/speech/speech_recognition_browsertest.cc',
'browser/tracing/tracing_controller_browsertest.cc',
'browser/web_contents/opened_by_dom_browsertest.cc',
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h
index 6a6b349..2620d6f 100644
--- a/content/public/browser/render_view_host.h
+++ b/content/public/browser/render_view_host.h
@@ -187,8 +187,6 @@ class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost {
// RenderViewHostDelegate.
virtual void SyncRendererPrefs() = 0;
- virtual void ToggleSpeechInput() = 0;
-
// Returns the current WebKit preferences.
virtual WebPreferences GetWebkitPreferences() = 0;
diff --git a/content/public/browser/speech_recognition_session_config.h b/content/public/browser/speech_recognition_session_config.h
index 813fbd1..1cde643 100644
--- a/content/public/browser/speech_recognition_session_config.h
+++ b/content/public/browser/speech_recognition_session_config.h
@@ -22,7 +22,9 @@ struct CONTENT_EXPORT SpeechRecognitionSessionConfig {
SpeechRecognitionSessionConfig();
~SpeechRecognitionSessionConfig();
+ // TODO(hans): The legacy API is dead; remove this flag (crbug.com/223198).
bool is_legacy_api;
+
std::string language;
SpeechRecognitionGrammarArray grammars;
std::string origin_url;
diff --git a/content/public/browser/speech_recognition_session_context.cc b/content/public/browser/speech_recognition_session_context.cc
index f362ef3..9b6575b 100644
--- a/content/public/browser/speech_recognition_session_context.cc
+++ b/content/public/browser/speech_recognition_session_context.cc
@@ -14,8 +14,7 @@ SpeechRecognitionSessionContext::SpeechRecognitionSessionContext()
guest_render_view_id(MSG_ROUTING_NONE),
embedder_render_process_id(0),
embedder_render_view_id(MSG_ROUTING_NONE),
- request_id(0),
- requested_by_page_element(true) {
+ request_id(0) {
}
SpeechRecognitionSessionContext::~SpeechRecognitionSessionContext() {
diff --git a/content/public/browser/speech_recognition_session_context.h b/content/public/browser/speech_recognition_session_context.h
index 5606b78..d092a5d 100644
--- a/content/public/browser/speech_recognition_session_context.h
+++ b/content/public/browser/speech_recognition_session_context.h
@@ -46,14 +46,6 @@ struct CONTENT_EXPORT SpeechRecognitionSessionContext {
int request_id;
- // Determines whether recognition was requested by a page element (in which
- // case its coordinates are passed in |element_rect|).
- bool requested_by_page_element;
-
- // The coordinates of the page element for placing the bubble (valid only when
- // |requested_by_page_element| = true).
- gfx::Rect element_rect;
-
// A texual description of the context (website, extension name) that is
// requesting recognition, for prompting security notifications to the user.
std::string context_name;
diff --git a/content/public/common/context_menu_params.cc b/content/public/common/context_menu_params.cc
index 8289be0..54b48c2 100644
--- a/content/public/common/context_menu_params.cc
+++ b/content/public/common/context_menu_params.cc
@@ -21,7 +21,6 @@ ContextMenuParams::ContextMenuParams()
has_image_contents(true),
media_flags(0),
misspelling_hash(0),
- speech_input_enabled(false),
spellcheck_enabled(false),
is_editable(false),
writing_direction_default(
diff --git a/content/public/common/context_menu_params.h b/content/public/common/context_menu_params.h
index ccdb473..ccef48e 100644
--- a/content/public/common/context_menu_params.h
+++ b/content/public/common/context_menu_params.h
@@ -112,9 +112,6 @@ struct CONTENT_EXPORT ContextMenuParams {
// and the misspelled_word is not empty.
std::vector<base::string16> dictionary_suggestions;
- // If editable, flag for whether node is speech-input enabled.
- bool speech_input_enabled;
-
// If editable, flag for whether spell check is enabled or not.
bool spellcheck_enabled;
diff --git a/content/renderer/context_menu_params_builder.cc b/content/renderer/context_menu_params_builder.cc
index d56c6ea..48355e8 100644
--- a/content/renderer/context_menu_params_builder.cc
+++ b/content/renderer/context_menu_params_builder.cc
@@ -32,7 +32,6 @@ ContextMenuParams ContextMenuParamsBuilder::Build(
params.selection_text = data.selectedText;
params.misspelled_word = data.misspelledWord;
params.misspelling_hash = data.misspellingHash;
- params.speech_input_enabled = data.isSpeechInputEnabled;
params.spellcheck_enabled = data.isSpellCheckingEnabled;
params.is_editable = data.isEditable;
params.writing_direction_default = data.writingDirectionDefault;
diff --git a/content/renderer/input_tag_speech_dispatcher.cc b/content/renderer/input_tag_speech_dispatcher.cc
deleted file mode 100644
index 092eb2e..0000000
--- a/content/renderer/input_tag_speech_dispatcher.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/input_tag_speech_dispatcher.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "content/common/speech_recognition_messages.h"
-#include "content/renderer/render_view_impl.h"
-#include "third_party/WebKit/public/platform/WebSize.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/web/WebDocument.h"
-#include "third_party/WebKit/public/web/WebElement.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
-#include "third_party/WebKit/public/web/WebInputElement.h"
-#include "third_party/WebKit/public/web/WebNode.h"
-#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/web/WebSpeechInputListener.h"
-#include "third_party/WebKit/public/web/WebView.h"
-
-using blink::WebDocument;
-using blink::WebElement;
-using blink::WebFrame;
-using blink::WebInputElement;
-using blink::WebNode;
-using blink::WebView;
-
-namespace content {
-
-InputTagSpeechDispatcher::InputTagSpeechDispatcher(
- RenderViewImpl* render_view,
- blink::WebSpeechInputListener* listener)
- : RenderViewObserver(render_view),
- listener_(listener) {
-}
-
-bool InputTagSpeechDispatcher::OnMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(InputTagSpeechDispatcher, message)
- IPC_MESSAGE_HANDLER(InputTagSpeechMsg_SetRecognitionResults,
- OnSpeechRecognitionResults)
- IPC_MESSAGE_HANDLER(InputTagSpeechMsg_RecordingComplete,
- OnSpeechRecordingComplete)
- IPC_MESSAGE_HANDLER(InputTagSpeechMsg_RecognitionComplete,
- OnSpeechRecognitionComplete)
- IPC_MESSAGE_HANDLER(InputTagSpeechMsg_ToggleSpeechInput,
- OnSpeechRecognitionToggleSpeechInput)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-bool InputTagSpeechDispatcher::startRecognition(
- int request_id,
- const blink::WebRect& element_rect,
- const blink::WebString& language,
- const blink::WebString& grammar,
- const blink::WebSecurityOrigin& origin) {
- DVLOG(1) << "InputTagSpeechDispatcher::startRecognition enter";
-
- InputTagSpeechHostMsg_StartRecognition_Params params;
- params.grammar = base::UTF16ToUTF8(grammar);
- params.language = base::UTF16ToUTF8(language);
- params.origin_url = base::UTF16ToUTF8(origin.toString());
- params.render_view_id = routing_id();
- params.request_id = request_id;
- params.element_rect = element_rect;
-
- Send(new InputTagSpeechHostMsg_StartRecognition(params));
- DVLOG(1) << "InputTagSpeechDispatcher::startRecognition exit";
- return true;
-}
-
-void InputTagSpeechDispatcher::cancelRecognition(int request_id) {
- DVLOG(1) << "InputTagSpeechDispatcher::cancelRecognition enter";
- Send(new InputTagSpeechHostMsg_CancelRecognition(routing_id(), request_id));
- DVLOG(1) << "InputTagSpeechDispatcher::cancelRecognition exit";
-}
-
-void InputTagSpeechDispatcher::stopRecording(int request_id) {
- DVLOG(1) << "InputTagSpeechDispatcher::stopRecording enter";
- Send(new InputTagSpeechHostMsg_StopRecording(routing_id(),
- request_id));
- DVLOG(1) << "InputTagSpeechDispatcher::stopRecording exit";
-}
-
-void InputTagSpeechDispatcher::OnSpeechRecognitionResults(
- int request_id,
- const SpeechRecognitionResults& results) {
- DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionResults enter";
- DCHECK_EQ(results.size(), 1U);
-
- const SpeechRecognitionResult& result = results[0];
- blink::WebSpeechInputResultArray webkit_result(result.hypotheses.size());
- for (size_t i = 0; i < result.hypotheses.size(); ++i) {
- webkit_result[i].assign(result.hypotheses[i].utterance,
- result.hypotheses[i].confidence);
- }
- listener_->setRecognitionResult(request_id, webkit_result);
-
- DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionResults exit";
-}
-
-void InputTagSpeechDispatcher::OnSpeechRecordingComplete(int request_id) {
- DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecordingComplete enter";
- listener_->didCompleteRecording(request_id);
- DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecordingComplete exit";
-}
-
-void InputTagSpeechDispatcher::OnSpeechRecognitionComplete(int request_id) {
- DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionComplete enter";
- listener_->didCompleteRecognition(request_id);
- DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionComplete exit";
-}
-
-void InputTagSpeechDispatcher::OnSpeechRecognitionToggleSpeechInput() {
- DVLOG(1) <<"InputTagSpeechDispatcher::OnSpeechRecognitionToggleSpeechInput";
-
- WebView* web_view = render_view()->GetWebView();
-
- WebFrame* frame = web_view->mainFrame();
- if (!frame)
- return;
-
- WebDocument document = frame->document();
- if (document.isNull())
- return;
-
- blink::WebElement element = document.focusedElement();
- if (element.isNull())
- return;
-
- blink::WebInputElement* input_element = blink::toWebInputElement(&element);
- if (!input_element)
- return;
- if (!input_element->isSpeechInputEnabled())
- return;
-
- if (input_element->getSpeechInputState() == WebInputElement::Idle) {
- input_element->startSpeechInput();
- } else {
- input_element->stopSpeechInput();
- }
-}
-
-} // namespace content
diff --git a/content/renderer/input_tag_speech_dispatcher.h b/content/renderer/input_tag_speech_dispatcher.h
deleted file mode 100644
index ee9dda9..0000000
--- a/content/renderer/input_tag_speech_dispatcher.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_RENDERER_INPUT_TAG_SPEECH_DISPATCHER_H_
-#define CONTENT_RENDERER_INPUT_TAG_SPEECH_DISPATCHER_H_
-
-#include "base/basictypes.h"
-#include "content/public/common/speech_recognition_result.h"
-#include "content/public/renderer/render_view_observer.h"
-#include "third_party/WebKit/public/web/WebSpeechInputController.h"
-
-namespace blink {
-class WebSpeechInputListener;
-}
-
-namespace content {
-class RenderViewImpl;
-struct SpeechRecognitionResult;
-
-// InputTagSpeechDispatcher is a delegate for messages used by WebKit. It's
-// the complement of InputTagSpeechDispatcherHost (owned by RenderViewHost).
-class InputTagSpeechDispatcher : public RenderViewObserver,
- public blink::WebSpeechInputController {
- public:
- InputTagSpeechDispatcher(RenderViewImpl* render_view,
- blink::WebSpeechInputListener* listener);
-
- private:
- // RenderView::Observer implementation.
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
-
- // blink::WebSpeechInputController.
- virtual bool startRecognition(int request_id,
- const blink::WebRect& element_rect,
- const blink::WebString& language,
- const blink::WebString& grammar,
- const blink::WebSecurityOrigin& origin);
-
- virtual void cancelRecognition(int request_id);
- virtual void stopRecording(int request_id);
-
- void OnSpeechRecognitionResults(
- int request_id, const SpeechRecognitionResults& results);
- void OnSpeechRecordingComplete(int request_id);
- void OnSpeechRecognitionComplete(int request_id);
- void OnSpeechRecognitionToggleSpeechInput();
-
- blink::WebSpeechInputListener* listener_;
-
- DISALLOW_COPY_AND_ASSIGN(InputTagSpeechDispatcher);
-};
-
-} // namespace content
-
-#endif // CONTENT_RENDERER_INPUT_TAG_SPEECH_DISPATCHER_H_
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 7290a4b..3305a7c 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -85,7 +85,6 @@
#include "content/renderer/idle_user_detector.h"
#include "content/renderer/ime_event_guard.h"
#include "content/renderer/input/input_handler_manager.h"
-#include "content/renderer/input_tag_speech_dispatcher.h"
#include "content/renderer/internal_document_state_data.h"
#include "content/renderer/load_progress_tracker.h"
#include "content/renderer/media/audio_device_factory.h"
@@ -671,7 +670,6 @@ RenderViewImpl::RenderViewImpl(RenderViewImplParams* params)
has_scrolled_focused_editable_node_into_rect_(false),
push_messaging_dispatcher_(NULL),
geolocation_dispatcher_(NULL),
- input_tag_speech_dispatcher_(NULL),
speech_recognition_dispatcher_(NULL),
media_stream_dispatcher_(NULL),
browser_plugin_manager_(NULL),
@@ -3862,16 +3860,6 @@ blink::WebGeolocationClient* RenderViewImpl::geolocationClient() {
return geolocation_dispatcher_;
}
-blink::WebSpeechInputController* RenderViewImpl::speechInputController(
- blink::WebSpeechInputListener* listener) {
-#if defined(ENABLE_INPUT_SPEECH)
- if (!input_tag_speech_dispatcher_)
- input_tag_speech_dispatcher_ =
- new InputTagSpeechDispatcher(this, listener);
-#endif
- return input_tag_speech_dispatcher_;
-}
-
blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() {
if (!speech_recognition_dispatcher_)
speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this);
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 2349389..374dc34 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -106,8 +106,6 @@ class WebMouseEvent;
class WebPeerConnectionHandler;
class WebPeerConnectionHandlerClient;
class WebSocketStreamHandle;
-class WebSpeechInputController;
-class WebSpeechInputListener;
class WebSpeechRecognizer;
class WebStorageNamespace;
class WebTouchEvent;
@@ -142,7 +140,6 @@ class GeolocationDispatcher;
class HistoryController;
class HistoryEntry;
class ImageResourceFetcher;
-class InputTagSpeechDispatcher;
class LoadProgressTracker;
class MidiDispatcher;
class MediaStreamClient;
@@ -467,8 +464,6 @@ class CONTENT_EXPORT RenderViewImpl
virtual void didUpdateInspectorSetting(const blink::WebString& key,
const blink::WebString& value);
virtual blink::WebGeolocationClient* geolocationClient();
- virtual blink::WebSpeechInputController* speechInputController(
- blink::WebSpeechInputListener* listener);
virtual blink::WebSpeechRecognizer* speechRecognizer();
virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
virtual void zoomLevelChanged();
@@ -1138,9 +1133,6 @@ class CONTENT_EXPORT RenderViewImpl
// The geolocation dispatcher attached to this view, lazily initialized.
GeolocationDispatcher* geolocation_dispatcher_;
- // The speech dispatcher attached to this view, lazily initialized.
- InputTagSpeechDispatcher* input_tag_speech_dispatcher_;
-
// The speech recognition dispatcher attached to this view, lazily
// initialized.
SpeechRecognitionDispatcher* speech_recognition_dispatcher_;
diff --git a/content/shell/renderer/test_runner/MockWebSpeechInputController.h b/content/shell/renderer/test_runner/MockWebSpeechInputController.h
index eb62d12..f213eb2 100644
--- a/content/shell/renderer/test_runner/MockWebSpeechInputController.h
+++ b/content/shell/renderer/test_runner/MockWebSpeechInputController.h
@@ -26,6 +26,8 @@ namespace WebTestRunner {
class WebTestDelegate;
+// TODO(hans): Remove this once we've stopped running Blink tests that depend
+// on it (crbug.com/223198).
class MockWebSpeechInputController : public blink::WebSpeechInputController {
public:
explicit MockWebSpeechInputController(blink::WebSpeechInputListener*);
diff --git a/content/test/data/speech/basic_recognition.html b/content/test/data/speech/basic_recognition.html
deleted file mode 100644
index 3ef7f742..0000000
--- a/content/test/data/speech/basic_recognition.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
- <head>
- <title>Speech input test</title>
- <script type="text/javascript">
- function onspeechresult(value) {
- if (value == "Pictures of the moon") {
- document.getElementById('status').innerHTML = 'PASS';
- document.location = '#pass';
- } else {
- document.location = '#fail';
- }
- }
- </script>
- </head>
- <body style="padding:0; margin:0;">
- <input id='inputField' x-webkit-speech
- onwebkitspeechchange="onspeechresult(this.value);"
- onchange="onspeechresult(this.value);"
- style="position:absolute; margin:0; padding:0; border:0; width:10px;">
- <br>
- <div id="status">FAIL</div>
- <script>document.getElementById('inputField').focus();</script>
- </body>
-</html>
diff --git a/content/test/data/speech/grammar_attribute.html b/content/test/data/speech/grammar_attribute.html
deleted file mode 100644
index 393d68a..0000000
--- a/content/test/data/speech/grammar_attribute.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<html>
- <head>
- <title>Speech input with grammar attribute test</title>
- <script type="text/javascript">
- function onspeechresult(value) {
- if (value == "Pictures of the moon") {
- document.getElementById('status').innerHTML = 'PASS';
- document.location = '#pass';
- } else {
- document.location = '#fail';
- }
- }
- </script>
- </head>
- <body style="padding:0; margin:0;">
- <input id='inputField' x-webkit-speech
- x-webkit-grammar="http://example.com/grammar.xml"
- onwebkitspeechchange="onspeechresult(this.value);"
- onchange="onspeechresult(this.value);"
- style="position:absolute; margin:0; padding:0; border:0; width:10px;">
- <br>
- <div id="status">FAIL</div>
- <script>document.getElementById('inputField').focus();</script>
- </body>
-</html>