OLD | NEW |
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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 webview()->setDeviceScaleFactor(device_scale_factor_); | 753 webview()->setDeviceScaleFactor(device_scale_factor_); |
754 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 754 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
755 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 755 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
756 | 756 |
757 webkit_preferences_.Apply(webview()); | 757 webkit_preferences_.Apply(webview()); |
758 webview()->initializeMainFrame(this); | 758 webview()->initializeMainFrame(this); |
759 | 759 |
760 if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) | 760 if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) |
761 webview()->settings()->setTouchDragDropEnabled(true); | 761 webview()->settings()->setTouchDragDropEnabled(true); |
762 | 762 |
| 763 if (command_line.HasSwitch(switches::kEnableTouchEditing)) |
| 764 webview()->settings()->setTouchEditingEnabled(true); |
| 765 |
763 if (!params->frame_name.empty()) | 766 if (!params->frame_name.empty()) |
764 webview()->mainFrame()->setName(params->frame_name); | 767 webview()->mainFrame()->setName(params->frame_name); |
765 webview()->settings()->setMinimumTimerInterval( | 768 webview()->settings()->setMinimumTimerInterval( |
766 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 769 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
767 webkit_glue::kForegroundTabTimerInterval); | 770 webkit_glue::kForegroundTabTimerInterval); |
768 | 771 |
769 OnSetRendererPrefs(params->renderer_prefs); | 772 OnSetRendererPrefs(params->renderer_prefs); |
770 | 773 |
771 #if defined(ENABLE_WEBRTC) | 774 #if defined(ENABLE_WEBRTC) |
772 if (!media_stream_dispatcher_) | 775 if (!media_stream_dispatcher_) |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, | 1098 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, |
1096 OnPpapiBrokerChannelCreated) | 1099 OnPpapiBrokerChannelCreated) |
1097 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, | 1100 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, |
1098 OnPpapiBrokerPermissionResult) | 1101 OnPpapiBrokerPermissionResult) |
1099 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 1102 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
1100 OnGetAllSavableResourceLinksForCurrentPage) | 1103 OnGetAllSavableResourceLinksForCurrentPage) |
1101 IPC_MESSAGE_HANDLER( | 1104 IPC_MESSAGE_HANDLER( |
1102 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1105 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1103 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1106 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1104 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 1107 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 1108 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) |
1105 // TODO(viettrungluu): Move to a separate message filter. | 1109 // TODO(viettrungluu): Move to a separate message filter. |
1106 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 1110 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
1107 OnSetHistoryLengthAndPrune) | 1111 OnSetHistoryLengthAndPrune) |
1108 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1112 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1109 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 1113 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
1110 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) | 1114 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) |
1111 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) | 1115 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) |
1112 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) | 1116 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) |
1113 #if defined(OS_ANDROID) | 1117 #if defined(OS_ANDROID) |
1114 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, | 1118 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, |
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4734 // the selection hasn't actually changed. We don't want to report these | 4738 // the selection hasn't actually changed. We don't want to report these |
4735 // because it will cause us to continually claim the X clipboard. | 4739 // because it will cause us to continually claim the X clipboard. |
4736 if (selection_text_offset_ != offset || | 4740 if (selection_text_offset_ != offset || |
4737 selection_range_ != range || | 4741 selection_range_ != range || |
4738 selection_text_ != text) { | 4742 selection_text_ != text) { |
4739 selection_text_ = text; | 4743 selection_text_ = text; |
4740 selection_text_offset_ = offset; | 4744 selection_text_offset_ = offset; |
4741 selection_range_ = range; | 4745 selection_range_ = range; |
4742 Send(new ViewHostMsg_SelectionChanged(routing_id_, text, offset, range)); | 4746 Send(new ViewHostMsg_SelectionChanged(routing_id_, text, offset, range)); |
4743 } | 4747 } |
| 4748 UpdateSelectionBounds(); |
4744 } | 4749 } |
4745 | 4750 |
4746 GURL RenderViewImpl::GetAlternateErrorPageURL(const GURL& failed_url, | 4751 GURL RenderViewImpl::GetAlternateErrorPageURL(const GURL& failed_url, |
4747 ErrorPageType error_type) { | 4752 ErrorPageType error_type) { |
4748 if (failed_url.SchemeIsSecure()) { | 4753 if (failed_url.SchemeIsSecure()) { |
4749 // If the URL that failed was secure, then the embedding web page was not | 4754 // If the URL that failed was secure, then the embedding web page was not |
4750 // expecting a network attacker to be able to manipulate its contents. As | 4755 // expecting a network attacker to be able to manipulate its contents. As |
4751 // we fetch alternate error pages over HTTP, we would be allowing a network | 4756 // we fetch alternate error pages over HTTP, we would be allowing a network |
4752 // attacker to manipulate the contents of the response if we tried to use | 4757 // attacker to manipulate the contents of the response if we tried to use |
4753 // the link doctor here. | 4758 // the link doctor here. |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 if (client) { | 6449 if (client) { |
6445 client->OnMenuClosed(custom_context.request_id); | 6450 client->OnMenuClosed(custom_context.request_id); |
6446 pending_context_menus_.Remove(custom_context.request_id); | 6451 pending_context_menus_.Remove(custom_context.request_id); |
6447 } | 6452 } |
6448 } else { | 6453 } else { |
6449 // Internal request, forward to WebKit. | 6454 // Internal request, forward to WebKit. |
6450 context_menu_node_.reset(); | 6455 context_menu_node_.reset(); |
6451 } | 6456 } |
6452 } | 6457 } |
6453 | 6458 |
| 6459 void RenderViewImpl::OnShowContextMenu() { |
| 6460 if (webview()) |
| 6461 webview()->showContextMenu(); |
| 6462 } |
| 6463 |
6454 void RenderViewImpl::OnEnableViewSourceMode() { | 6464 void RenderViewImpl::OnEnableViewSourceMode() { |
6455 if (!webview()) | 6465 if (!webview()) |
6456 return; | 6466 return; |
6457 WebFrame* main_frame = webview()->mainFrame(); | 6467 WebFrame* main_frame = webview()->mainFrame(); |
6458 if (!main_frame) | 6468 if (!main_frame) |
6459 return; | 6469 return; |
6460 main_frame->enableViewSourceMode(true); | 6470 main_frame->enableViewSourceMode(true); |
6461 } | 6471 } |
6462 | 6472 |
6463 void RenderViewImpl::OnJavaBridgeInit() { | 6473 void RenderViewImpl::OnJavaBridgeInit() { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6610 WebURL url = icon_urls[i].iconURL(); | 6620 WebURL url = icon_urls[i].iconURL(); |
6611 if (!url.isEmpty()) | 6621 if (!url.isEmpty()) |
6612 urls.push_back(FaviconURL(url, | 6622 urls.push_back(FaviconURL(url, |
6613 ToFaviconType(icon_urls[i].iconType()))); | 6623 ToFaviconType(icon_urls[i].iconType()))); |
6614 } | 6624 } |
6615 SendUpdateFaviconURL(urls); | 6625 SendUpdateFaviconURL(urls); |
6616 } | 6626 } |
6617 | 6627 |
6618 | 6628 |
6619 } // namespace content | 6629 } // namespace content |
OLD | NEW |