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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 webview()->setDeviceScaleFactor(device_scale_factor_); | 754 webview()->setDeviceScaleFactor(device_scale_factor_); |
755 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 755 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
756 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 756 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
757 | 757 |
758 webkit_preferences_.Apply(webview()); | 758 webkit_preferences_.Apply(webview()); |
759 webview()->initializeMainFrame(this); | 759 webview()->initializeMainFrame(this); |
760 | 760 |
761 if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) | 761 if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) |
762 webview()->settings()->setTouchDragDropEnabled(true); | 762 webview()->settings()->setTouchDragDropEnabled(true); |
763 | 763 |
| 764 if (command_line.HasSwitch(switches::kEnableTouchEditing)) |
| 765 webview()->settings()->setTouchEditingEnabled(true); |
| 766 |
764 if (!params->frame_name.empty()) | 767 if (!params->frame_name.empty()) |
765 webview()->mainFrame()->setName(params->frame_name); | 768 webview()->mainFrame()->setName(params->frame_name); |
766 webview()->settings()->setMinimumTimerInterval( | 769 webview()->settings()->setMinimumTimerInterval( |
767 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 770 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
768 webkit_glue::kForegroundTabTimerInterval); | 771 webkit_glue::kForegroundTabTimerInterval); |
769 | 772 |
770 OnSetRendererPrefs(params->renderer_prefs); | 773 OnSetRendererPrefs(params->renderer_prefs); |
771 | 774 |
772 #if defined(ENABLE_WEBRTC) | 775 #if defined(ENABLE_WEBRTC) |
773 if (!media_stream_dispatcher_) | 776 if (!media_stream_dispatcher_) |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, | 1097 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, |
1095 OnPpapiBrokerChannelCreated) | 1098 OnPpapiBrokerChannelCreated) |
1096 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, | 1099 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, |
1097 OnPpapiBrokerPermissionResult) | 1100 OnPpapiBrokerPermissionResult) |
1098 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 1101 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
1099 OnGetAllSavableResourceLinksForCurrentPage) | 1102 OnGetAllSavableResourceLinksForCurrentPage) |
1100 IPC_MESSAGE_HANDLER( | 1103 IPC_MESSAGE_HANDLER( |
1101 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1104 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1102 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1105 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1103 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 1106 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 1107 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) |
1104 // TODO(viettrungluu): Move to a separate message filter. | 1108 // TODO(viettrungluu): Move to a separate message filter. |
1105 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 1109 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
1106 OnSetHistoryLengthAndPrune) | 1110 OnSetHistoryLengthAndPrune) |
1107 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1111 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1108 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 1112 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
1109 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) | 1113 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) |
1110 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) | 1114 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) |
1111 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) | 1115 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) |
1112 #if defined(OS_ANDROID) | 1116 #if defined(OS_ANDROID) |
1113 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, | 1117 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, |
(...skipping 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4756 // the selection hasn't actually changed. We don't want to report these | 4760 // the selection hasn't actually changed. We don't want to report these |
4757 // because it will cause us to continually claim the X clipboard. | 4761 // because it will cause us to continually claim the X clipboard. |
4758 if (selection_text_offset_ != offset || | 4762 if (selection_text_offset_ != offset || |
4759 selection_range_ != range || | 4763 selection_range_ != range || |
4760 selection_text_ != text) { | 4764 selection_text_ != text) { |
4761 selection_text_ = text; | 4765 selection_text_ = text; |
4762 selection_text_offset_ = offset; | 4766 selection_text_offset_ = offset; |
4763 selection_range_ = range; | 4767 selection_range_ = range; |
4764 Send(new ViewHostMsg_SelectionChanged(routing_id_, text, offset, range)); | 4768 Send(new ViewHostMsg_SelectionChanged(routing_id_, text, offset, range)); |
4765 } | 4769 } |
| 4770 UpdateSelectionBounds(); |
4766 } | 4771 } |
4767 | 4772 |
4768 GURL RenderViewImpl::GetAlternateErrorPageURL(const GURL& failed_url, | 4773 GURL RenderViewImpl::GetAlternateErrorPageURL(const GURL& failed_url, |
4769 ErrorPageType error_type) { | 4774 ErrorPageType error_type) { |
4770 if (failed_url.SchemeIsSecure()) { | 4775 if (failed_url.SchemeIsSecure()) { |
4771 // If the URL that failed was secure, then the embedding web page was not | 4776 // If the URL that failed was secure, then the embedding web page was not |
4772 // expecting a network attacker to be able to manipulate its contents. As | 4777 // expecting a network attacker to be able to manipulate its contents. As |
4773 // we fetch alternate error pages over HTTP, we would be allowing a network | 4778 // we fetch alternate error pages over HTTP, we would be allowing a network |
4774 // attacker to manipulate the contents of the response if we tried to use | 4779 // attacker to manipulate the contents of the response if we tried to use |
4775 // the link doctor here. | 4780 // the link doctor here. |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6456 if (client) { | 6461 if (client) { |
6457 client->OnMenuClosed(custom_context.request_id); | 6462 client->OnMenuClosed(custom_context.request_id); |
6458 pending_context_menus_.Remove(custom_context.request_id); | 6463 pending_context_menus_.Remove(custom_context.request_id); |
6459 } | 6464 } |
6460 } else { | 6465 } else { |
6461 // Internal request, forward to WebKit. | 6466 // Internal request, forward to WebKit. |
6462 context_menu_node_.reset(); | 6467 context_menu_node_.reset(); |
6463 } | 6468 } |
6464 } | 6469 } |
6465 | 6470 |
| 6471 void RenderViewImpl::OnShowContextMenu() { |
| 6472 if (webview()) |
| 6473 webview()->showContextMenu(); |
| 6474 } |
| 6475 |
6466 void RenderViewImpl::OnEnableViewSourceMode() { | 6476 void RenderViewImpl::OnEnableViewSourceMode() { |
6467 if (!webview()) | 6477 if (!webview()) |
6468 return; | 6478 return; |
6469 WebFrame* main_frame = webview()->mainFrame(); | 6479 WebFrame* main_frame = webview()->mainFrame(); |
6470 if (!main_frame) | 6480 if (!main_frame) |
6471 return; | 6481 return; |
6472 main_frame->enableViewSourceMode(true); | 6482 main_frame->enableViewSourceMode(true); |
6473 } | 6483 } |
6474 | 6484 |
6475 void RenderViewImpl::OnJavaBridgeInit() { | 6485 void RenderViewImpl::OnJavaBridgeInit() { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6622 WebURL url = icon_urls[i].iconURL(); | 6632 WebURL url = icon_urls[i].iconURL(); |
6623 if (!url.isEmpty()) | 6633 if (!url.isEmpty()) |
6624 urls.push_back(FaviconURL(url, | 6634 urls.push_back(FaviconURL(url, |
6625 ToFaviconType(icon_urls[i].iconType()))); | 6635 ToFaviconType(icon_urls[i].iconType()))); |
6626 } | 6636 } |
6627 SendUpdateFaviconURL(urls); | 6637 SendUpdateFaviconURL(urls); |
6628 } | 6638 } |
6629 | 6639 |
6630 | 6640 |
6631 } // namespace content | 6641 } // namespace content |
OLD | NEW |