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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 755 |
756 webview()->setDeviceScaleFactor(device_scale_factor_); | 756 webview()->setDeviceScaleFactor(device_scale_factor_); |
757 webview()->setDisplayMode(display_mode_); | 757 webview()->setDisplayMode(display_mode_); |
758 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 758 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
759 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 759 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
760 webview()->settings()->setThreadedScrollingEnabled( | 760 webview()->settings()->setThreadedScrollingEnabled( |
761 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | 761 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); |
762 webview()->settings()->setRootLayerScrolls( | 762 webview()->settings()->setRootLayerScrolls( |
763 command_line.HasSwitch(switches::kRootLayerScrolls)); | 763 command_line.HasSwitch(switches::kRootLayerScrolls)); |
764 | 764 |
765 ApplyWebPreferences(webkit_preferences_, webview()); | 765 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
766 | 766 |
767 if (switches::IsTouchDragDropEnabled()) | 767 if (switches::IsTouchDragDropEnabled()) |
768 webview()->settings()->setTouchDragDropEnabled(true); | 768 webview()->settings()->setTouchDragDropEnabled(true); |
769 | 769 |
770 if (switches::IsTouchEditingEnabled()) | 770 if (switches::IsTouchEditingEnabled()) |
771 webview()->settings()->setTouchEditingEnabled(true); | 771 webview()->settings()->setTouchEditingEnabled(true); |
772 | 772 |
773 WebSettings::SelectionStrategyType selection_strategy = | 773 WebSettings::SelectionStrategyType selection_strategy = |
774 WebSettings::SelectionStrategyType::Character; | 774 WebSettings::SelectionStrategyType::Character; |
775 const std::string selection_strategy_str = | 775 const std::string selection_strategy_str = |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 return; | 1500 return; |
1501 | 1501 |
1502 // Don't send state updates for kSwappedOutURL. | 1502 // Don't send state updates for kSwappedOutURL. |
1503 if (entry->root().urlString() == WebString::fromUTF8(kSwappedOutURL)) | 1503 if (entry->root().urlString() == WebString::fromUTF8(kSwappedOutURL)) |
1504 return; | 1504 return; |
1505 | 1505 |
1506 Send(new ViewHostMsg_UpdateState( | 1506 Send(new ViewHostMsg_UpdateState( |
1507 routing_id_, page_id_, HistoryEntryToPageState(entry))); | 1507 routing_id_, page_id_, HistoryEntryToPageState(entry))); |
1508 } | 1508 } |
1509 | 1509 |
| 1510 void RenderViewImpl::ApplyWebPreferencesInternal( |
| 1511 const WebPreferences& prefs, |
| 1512 blink::WebView* web_view, |
| 1513 CompositorDependencies* compositor_deps) { |
| 1514 ApplyWebPreferences(prefs, web_view); |
| 1515 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 1516 DCHECK(compositor_deps); |
| 1517 bool is_elastic_overscroll_enabled = |
| 1518 compositor_deps->IsElasticOverscrollEnabled(); |
| 1519 web_view->settings()->setReportWheelOverscroll(is_elastic_overscroll_enabled); |
| 1520 #endif |
| 1521 } |
| 1522 |
1510 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | 1523 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
1511 // Before WebKit asks us to show an alert (etc.), it takes care of doing the | 1524 // Before WebKit asks us to show an alert (etc.), it takes care of doing the |
1512 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1525 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
1513 // it is particularly important that we do not call willEnterModalLoop as | 1526 // it is particularly important that we do not call willEnterModalLoop as |
1514 // that would defer resource loads for the dialog itself. | 1527 // that would defer resource loads for the dialog itself. |
1515 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1528 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
1516 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | 1529 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); |
1517 | 1530 |
1518 message->EnableMessagePumping(); // Runs a nested message loop. | 1531 message->EnableMessagePumping(); // Runs a nested message loop. |
1519 return Send(message); | 1532 return Send(message); |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 WebDragOperation op) { | 2656 WebDragOperation op) { |
2644 webview()->dragSourceEndedAt(client_point, screen_point, op); | 2657 webview()->dragSourceEndedAt(client_point, screen_point, op); |
2645 } | 2658 } |
2646 | 2659 |
2647 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2660 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
2648 webview()->dragSourceSystemDragEnded(); | 2661 webview()->dragSourceSystemDragEnded(); |
2649 } | 2662 } |
2650 | 2663 |
2651 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 2664 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
2652 webkit_preferences_ = prefs; | 2665 webkit_preferences_ = prefs; |
2653 ApplyWebPreferences(webkit_preferences_, webview()); | 2666 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
2654 } | 2667 } |
2655 | 2668 |
2656 void RenderViewImpl::OnEnumerateDirectoryResponse( | 2669 void RenderViewImpl::OnEnumerateDirectoryResponse( |
2657 int id, | 2670 int id, |
2658 const std::vector<base::FilePath>& paths) { | 2671 const std::vector<base::FilePath>& paths) { |
2659 if (!enumeration_completions_[id]) | 2672 if (!enumeration_completions_[id]) |
2660 return; | 2673 return; |
2661 | 2674 |
2662 WebVector<WebString> ws_file_names(paths.size()); | 2675 WebVector<WebString> ws_file_names(paths.size()); |
2663 for (size_t i = 0; i < paths.size(); ++i) | 2676 for (size_t i = 0; i < paths.size(); ++i) |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 std::vector<gfx::Size> sizes; | 3813 std::vector<gfx::Size> sizes; |
3801 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3814 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3802 if (!url.isEmpty()) | 3815 if (!url.isEmpty()) |
3803 urls.push_back( | 3816 urls.push_back( |
3804 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3817 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3805 } | 3818 } |
3806 SendUpdateFaviconURL(urls); | 3819 SendUpdateFaviconURL(urls); |
3807 } | 3820 } |
3808 | 3821 |
3809 } // namespace content | 3822 } // namespace content |
OLD | NEW |