| 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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 return; | 1496 return; |
| 1497 | 1497 |
| 1498 // Don't send state updates for kSwappedOutURL. | 1498 // Don't send state updates for kSwappedOutURL. |
| 1499 if (entry->root().urlString() == WebString::fromUTF8(kSwappedOutURL)) | 1499 if (entry->root().urlString() == WebString::fromUTF8(kSwappedOutURL)) |
| 1500 return; | 1500 return; |
| 1501 | 1501 |
| 1502 Send(new ViewHostMsg_UpdateState( | 1502 Send(new ViewHostMsg_UpdateState( |
| 1503 routing_id_, page_id_, HistoryEntryToPageState(entry))); | 1503 routing_id_, page_id_, HistoryEntryToPageState(entry))); |
| 1504 } | 1504 } |
| 1505 | 1505 |
| 1506 void RenderViewImpl::ApplyWebPreferencesInternal( |
| 1507 const WebPreferences& prefs, |
| 1508 blink::WebView* web_view, |
| 1509 CompositorDependencies* compositor_deps) { |
| 1510 ApplyWebPreferences(prefs, web_view); |
| 1511 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 1512 DCHECK(compositor_deps); |
| 1513 bool is_elastic_overscroll_enabled = |
| 1514 compositor_deps->IsElasticOverscrollEnabled(); |
| 1515 web_view->settings()->setReportWheelOverscroll(is_elastic_overscroll_enabled); |
| 1516 #endif |
| 1517 } |
| 1518 |
| 1506 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | 1519 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
| 1507 // Before WebKit asks us to show an alert (etc.), it takes care of doing the | 1520 // Before WebKit asks us to show an alert (etc.), it takes care of doing the |
| 1508 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1521 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
| 1509 // it is particularly important that we do not call willEnterModalLoop as | 1522 // it is particularly important that we do not call willEnterModalLoop as |
| 1510 // that would defer resource loads for the dialog itself. | 1523 // that would defer resource loads for the dialog itself. |
| 1511 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1524 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
| 1512 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | 1525 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); |
| 1513 | 1526 |
| 1514 message->EnableMessagePumping(); // Runs a nested message loop. | 1527 message->EnableMessagePumping(); // Runs a nested message loop. |
| 1515 return Send(message); | 1528 return Send(message); |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2639 WebDragOperation op) { | 2652 WebDragOperation op) { |
| 2640 webview()->dragSourceEndedAt(client_point, screen_point, op); | 2653 webview()->dragSourceEndedAt(client_point, screen_point, op); |
| 2641 } | 2654 } |
| 2642 | 2655 |
| 2643 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2656 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
| 2644 webview()->dragSourceSystemDragEnded(); | 2657 webview()->dragSourceSystemDragEnded(); |
| 2645 } | 2658 } |
| 2646 | 2659 |
| 2647 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 2660 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
| 2648 webkit_preferences_ = prefs; | 2661 webkit_preferences_ = prefs; |
| 2649 ApplyWebPreferences(webkit_preferences_, webview()); | 2662 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
| 2650 } | 2663 } |
| 2651 | 2664 |
| 2652 void RenderViewImpl::OnEnumerateDirectoryResponse( | 2665 void RenderViewImpl::OnEnumerateDirectoryResponse( |
| 2653 int id, | 2666 int id, |
| 2654 const std::vector<base::FilePath>& paths) { | 2667 const std::vector<base::FilePath>& paths) { |
| 2655 if (!enumeration_completions_[id]) | 2668 if (!enumeration_completions_[id]) |
| 2656 return; | 2669 return; |
| 2657 | 2670 |
| 2658 WebVector<WebString> ws_file_names(paths.size()); | 2671 WebVector<WebString> ws_file_names(paths.size()); |
| 2659 for (size_t i = 0; i < paths.size(); ++i) | 2672 for (size_t i = 0; i < paths.size(); ++i) |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3796 std::vector<gfx::Size> sizes; | 3809 std::vector<gfx::Size> sizes; |
| 3797 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3810 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3798 if (!url.isEmpty()) | 3811 if (!url.isEmpty()) |
| 3799 urls.push_back( | 3812 urls.push_back( |
| 3800 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3813 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3801 } | 3814 } |
| 3802 SendUpdateFaviconURL(urls); | 3815 SendUpdateFaviconURL(urls); |
| 3803 } | 3816 } |
| 3804 | 3817 |
| 3805 } // namespace content | 3818 } // namespace content |
| OLD | NEW |