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