Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_mac.mm |
| diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm |
| index 2e7c96a271b31787425f3e20b74f2fb7bd7c047c..6439e27b896c808a2ed0eeffc676e176a735146b 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_mac.mm |
| +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm |
| @@ -73,6 +73,7 @@ |
| #import "ui/base/cocoa/appkit_utils.h" |
| #include "ui/base/cocoa/cocoa_base_utils.h" |
| #import "ui/base/cocoa/fullscreen_window_manager.h" |
| +#include "ui/base/cocoa/text_context_menu.h" |
| #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
| #include "ui/base/layout.h" |
| #include "ui/compositor/compositor.h" |
| @@ -873,10 +874,6 @@ void RenderWidgetHostViewMac::SendVSyncParametersToRenderer() { |
| } |
| } |
| -void RenderWidgetHostViewMac::SpeakText(const std::string& text) { |
| - [NSApp speakString:base::SysUTF8ToNSString(text)]; |
| -} |
| - |
| void RenderWidgetHostViewMac::UpdateBackingStoreProperties() { |
| if (!render_widget_host_) |
| return; |
| @@ -1166,11 +1163,6 @@ void RenderWidgetHostViewMac::SetTooltipText( |
| } |
| } |
| -bool RenderWidgetHostViewMac::SupportsSpeech() const { |
| - return [NSApp respondsToSelector:@selector(speakString:)] && |
| - [NSApp respondsToSelector:@selector(stopSpeaking:)]; |
| -} |
| - |
| void RenderWidgetHostViewMac::SpeakSelection() { |
| if (![NSApp respondsToSelector:@selector(speakString:)]) |
| return; |
| @@ -1184,17 +1176,7 @@ void RenderWidgetHostViewMac::SpeakSelection() { |
| return; |
| } |
| - SpeakText(selected_text_); |
| -} |
| - |
| -bool RenderWidgetHostViewMac::IsSpeaking() const { |
| - return [NSApp respondsToSelector:@selector(isSpeaking)] && |
| - [NSApp isSpeaking]; |
| -} |
| - |
| -void RenderWidgetHostViewMac::StopSpeaking() { |
| - if ([NSApp respondsToSelector:@selector(stopSpeaking:)]) |
| - [NSApp stopSpeaking:cocoa_view_]; |
| + TextContextMenu::SpeakText(base::ASCIIToUTF16(selected_text_)); |
|
tapted
2016/07/22 03:06:42
ASCII -> UTF8
(but also ... the selected_text_ me
spqchan
2016/12/12 19:32:27
Done.
|
| } |
| // |
| @@ -1774,7 +1756,7 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { |
| void RenderWidgetHostViewMac::OnGetRenderedTextCompleted( |
| const std::string& text) { |
| - SpeakText(text); |
| + TextContextMenu::SpeakText(base::ASCIIToUTF16(text)); |
|
tapted
2016/07/22 03:06:42
ASCII -> UTF8
spqchan
2016/12/12 19:32:27
Done.
|
| } |
| void RenderWidgetHostViewMac::PauseForPendingResizeOrRepaintsAndDraw() { |
| @@ -2794,10 +2776,10 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
| nullptr; |
| if (action == @selector(stopSpeaking:)) |
| - return is_render_view && renderWidgetHostView_->IsSpeaking(); |
| + return is_render_view && TextContextMenu::IsSpeaking(); |
| if (action == @selector(startSpeaking:)) |
| - return is_render_view && renderWidgetHostView_->SupportsSpeech(); |
| + return is_render_view && TextContextMenu::SupportsSpeech(); |
| // For now, these actions are always enabled for render view, |
| // this is sub-optimal. |
| @@ -3339,7 +3321,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName; |
| } |
| - (void)stopSpeaking:(id)sender { |
| - GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->StopSpeaking(); |
| + TextContextMenu::StopSpeaking(); |
| } |
| - (void)cancelComposition { |