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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10820062: [Mac]: Enable speech sub-menu under the edit menu and pipe it through to the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) 859 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy)
860 #if defined(OS_MACOSX) 860 #if defined(OS_MACOSX)
861 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) 861 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard)
862 #endif 862 #endif
863 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) 863 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste)
864 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) 864 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle)
865 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) 865 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
866 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) 866 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete)
867 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) 867 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll)
868 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) 868 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange)
869 #if defined(OS_MACOSX)
870 IPC_MESSAGE_HANDLER(ViewMsg_SpeakSelection, OnSpeakSelection)
871 #endif
869 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 872 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
870 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) 873 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand)
871 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 874 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
872 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 875 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
873 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) 876 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck)
874 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 877 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
875 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) 878 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel)
876 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) 879 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor)
877 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 880 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
878 OnSetZoomLevelForLoadingURL) 881 OnSetZoomLevelForLoadingURL)
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2903 webview()->settings()->setViewportEnabled(true); 2906 webview()->settings()->setViewportEnabled(true);
2904 } else if (enable_fixed_layout) { 2907 } else if (enable_fixed_layout) {
2905 std::string str = 2908 std::string str =
2906 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); 2909 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout);
2907 std::vector<std::string> tokens; 2910 std::vector<std::string> tokens;
2908 base::SplitString(str, ',', &tokens); 2911 base::SplitString(str, ',', &tokens);
2909 if (tokens.size() == 2) { 2912 if (tokens.size() == 2) {
2910 int width, height; 2913 int width, height;
2911 if (base::StringToInt(tokens[0], &width) && 2914 if (base::StringToInt(tokens[0], &width) &&
2912 base::StringToInt(tokens[1], &height)) 2915 base::StringToInt(tokens[1], &height))
2913 webview()->setFixedLayoutSize(WebSize(width,height)); 2916 webview()->setFixedLayoutSize(WebSize(width, height));
2914 } 2917 }
2915 } 2918 }
2916 } 2919 }
2917 2920
2918 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { 2921 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) {
2919 WebDataSource* ds = frame->provisionalDataSource(); 2922 WebDataSource* ds = frame->provisionalDataSource();
2920 DocumentState* document_state = DocumentState::FromDataSource(ds); 2923 DocumentState* document_state = DocumentState::FromDataSource(ds);
2921 2924
2922 // Update the request time if WebKit has better knowledge of it. 2925 // Update the request time if WebKit has better knowledge of it.
2923 if (document_state->request_time().is_null()) { 2926 if (document_state->request_time().is_null()) {
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
4489 void RenderViewImpl::OnScriptEvalRequest(const string16& frame_xpath, 4492 void RenderViewImpl::OnScriptEvalRequest(const string16& frame_xpath,
4490 const string16& jscript, 4493 const string16& jscript,
4491 int id, 4494 int id,
4492 bool notify_result) { 4495 bool notify_result) {
4493 EvaluateScript(frame_xpath, jscript, id, notify_result); 4496 EvaluateScript(frame_xpath, jscript, id, notify_result);
4494 } 4497 }
4495 4498
4496 void RenderViewImpl::OnPostMessageEvent( 4499 void RenderViewImpl::OnPostMessageEvent(
4497 const ViewMsg_PostMessage_Params& params) { 4500 const ViewMsg_PostMessage_Params& params) {
4498 // TODO(creis): Support sending to subframes. 4501 // TODO(creis): Support sending to subframes.
4499 WebFrame *frame = webview()->mainFrame(); 4502 WebFrame* frame = webview()->mainFrame();
4500 4503
4501 // Find the source frame if it exists. 4504 // Find the source frame if it exists.
4502 // TODO(creis): Support source subframes. 4505 // TODO(creis): Support source subframes.
4503 WebFrame* source_frame = NULL; 4506 WebFrame* source_frame = NULL;
4504 if (params.source_routing_id != MSG_ROUTING_NONE) { 4507 if (params.source_routing_id != MSG_ROUTING_NONE) {
4505 RenderViewImpl* source_view = FromRoutingID(params.source_routing_id); 4508 RenderViewImpl* source_view = FromRoutingID(params.source_routing_id);
4506 if (source_view) 4509 if (source_view)
4507 source_frame = source_view->webview()->mainFrame(); 4510 source_frame = source_view->webview()->mainFrame();
4508 } 4511 }
4509 4512
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
4822 4825
4823 void RenderViewImpl::OnShouldClose() { 4826 void RenderViewImpl::OnShouldClose() {
4824 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); 4827 base::TimeTicks before_unload_start_time = base::TimeTicks::Now();
4825 bool should_close = webview()->dispatchBeforeUnloadEvent(); 4828 bool should_close = webview()->dispatchBeforeUnloadEvent();
4826 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); 4829 base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
4827 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close, 4830 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close,
4828 before_unload_start_time, 4831 before_unload_start_time,
4829 before_unload_end_time)); 4832 before_unload_end_time));
4830 } 4833 }
4831 4834
4835 #if defined(OS_MACOSX)
4836 void RenderViewImpl::OnSpeakSelection() {
4837 if (!webview())
4838 return;
4839
4840 WebFrame* frame = webview()->focusedFrame();
4841 if (frame->hasSelection())
4842 Send(new ViewHostMsg_SpeakText(routing_id(), frame->selectionAsText()));
4843 }
4844 #endif
4845
4832 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { 4846 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) {
4833 // Ensure that no other in-progress navigation continues. 4847 // Ensure that no other in-progress navigation continues.
4834 OnStop(); 4848 OnStop();
4835 4849
4836 // Only run unload if we're not swapped out yet, but send the ack either way. 4850 // Only run unload if we're not swapped out yet, but send the ack either way.
4837 if (!is_swapped_out_) { 4851 if (!is_swapped_out_) {
4838 // Swap this RenderView out so the tab can navigate to a page rendered by a 4852 // Swap this RenderView out so the tab can navigate to a page rendered by a
4839 // different process. This involves running the unload handler and clearing 4853 // different process. This involves running the unload handler and clearing
4840 // the page. Once WasSwappedOut is called, we also allow this process to 4854 // the page. Once WasSwappedOut is called, we also allow this process to
4841 // exit if there are no other active RenderViews in it. 4855 // exit if there are no other active RenderViews in it.
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
5245 for (plugin_it = plugin_delegates_.begin(); 5259 for (plugin_it = plugin_delegates_.begin();
5246 plugin_it != plugin_delegates_.end(); ++plugin_it) { 5260 plugin_it != plugin_delegates_.end(); ++plugin_it) {
5247 #if defined(OS_MACOSX) 5261 #if defined(OS_MACOSX)
5248 // RenderWidget's call to setFocus can cause the underlying webview's 5262 // RenderWidget's call to setFocus can cause the underlying webview's
5249 // activation state to change just like a call to setIsActive. 5263 // activation state to change just like a call to setIsActive.
5250 if (enable) 5264 if (enable)
5251 (*plugin_it)->SetWindowFocus(true); 5265 (*plugin_it)->SetWindowFocus(true);
5252 #endif 5266 #endif
5253 (*plugin_it)->SetContentAreaFocus(enable); 5267 (*plugin_it)->SetContentAreaFocus(enable);
5254 } 5268 }
5255
5256 } 5269 }
5257 // Notify all Pepper plugins. 5270 // Notify all Pepper plugins.
5258 pepper_delegate_.OnSetFocus(enable); 5271 pepper_delegate_.OnSetFocus(enable);
5259 } 5272 }
5260 5273
5261 void RenderViewImpl::PpapiPluginFocusChanged() { 5274 void RenderViewImpl::PpapiPluginFocusChanged() {
5262 UpdateTextInputState(); 5275 UpdateTextInputState();
5263 UpdateSelectionBounds(); 5276 UpdateSelectionBounds();
5264 } 5277 }
5265 5278
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
5713 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5726 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5714 return !!RenderThreadImpl::current()->compositor_thread(); 5727 return !!RenderThreadImpl::current()->compositor_thread();
5715 } 5728 }
5716 5729
5717 void RenderViewImpl::OnJavaBridgeInit() { 5730 void RenderViewImpl::OnJavaBridgeInit() {
5718 DCHECK(!java_bridge_dispatcher_); 5731 DCHECK(!java_bridge_dispatcher_);
5719 #if defined(ENABLE_JAVA_BRIDGE) 5732 #if defined(ENABLE_JAVA_BRIDGE)
5720 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); 5733 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this);
5721 #endif 5734 #endif
5722 } 5735 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698