| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 133 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
| 134 #include "third_party/WebKit/public/web/WebDataSource.h" | 134 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 135 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" | 135 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" |
| 136 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" | 136 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" |
| 137 #include "third_party/WebKit/public/web/WebDocument.h" | 137 #include "third_party/WebKit/public/web/WebDocument.h" |
| 138 #include "third_party/WebKit/public/web/WebElement.h" | 138 #include "third_party/WebKit/public/web/WebElement.h" |
| 139 #include "third_party/WebKit/public/web/WebFileChooserParams.h" | 139 #include "third_party/WebKit/public/web/WebFileChooserParams.h" |
| 140 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 140 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
| 141 #include "third_party/WebKit/public/web/WebFormElement.h" | 141 #include "third_party/WebKit/public/web/WebFormElement.h" |
| 142 #include "third_party/WebKit/public/web/WebFrame.h" | 142 #include "third_party/WebKit/public/web/WebFrame.h" |
| 143 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 143 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 144 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 144 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 145 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
| 145 #include "third_party/WebKit/public/web/WebInputElement.h" | 146 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 146 #include "third_party/WebKit/public/web/WebInputEvent.h" | 147 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 147 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 148 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 148 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" | 149 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" |
| 149 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 150 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| 150 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" | 151 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" |
| 151 #include "third_party/WebKit/public/web/WebPlugin.h" | 152 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 152 #include "third_party/WebKit/public/web/WebPluginAction.h" | 153 #include "third_party/WebKit/public/web/WebPluginAction.h" |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 // calls DidStopLoading() without a matching DidStartLoading(). | 1741 // calls DidStopLoading() without a matching DidStartLoading(). |
| 1741 if (frames_in_progress_ == 0) | 1742 if (frames_in_progress_ == 0) |
| 1742 return; | 1743 return; |
| 1743 frames_in_progress_--; | 1744 frames_in_progress_--; |
| 1744 if (frames_in_progress_ == 0) { | 1745 if (frames_in_progress_ == 0) { |
| 1745 DidStopLoadingIcons(); | 1746 DidStopLoadingIcons(); |
| 1746 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1747 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
| 1747 } | 1748 } |
| 1748 } | 1749 } |
| 1749 | 1750 |
| 1750 void RenderViewImpl::AttachWebFrameWidget(blink::WebWidget* frame_widget) { | 1751 void RenderViewImpl::AttachWebFrameWidget(blink::WebFrameWidget* frame_widget) { |
| 1751 // The previous WebFrameWidget must already be detached by CloseForFrame(). | 1752 // The previous WebFrameWidget must already be detached by CloseForFrame(). |
| 1752 DCHECK(!frame_widget_); | 1753 DCHECK(!frame_widget_); |
| 1753 frame_widget_ = frame_widget; | 1754 frame_widget_ = frame_widget; |
| 1754 } | 1755 } |
| 1755 | 1756 |
| 1756 void RenderViewImpl::SetZoomLevel(double zoom_level) { | 1757 void RenderViewImpl::SetZoomLevel(double zoom_level) { |
| 1757 webview()->setZoomLevel(zoom_level); | 1758 webview()->setZoomLevel(zoom_level); |
| 1758 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); | 1759 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); |
| 1759 } | 1760 } |
| 1760 | 1761 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2258 } | 2259 } |
| 2259 | 2260 |
| 2260 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { | 2261 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { |
| 2261 OnUpdateWebPreferences(preferences); | 2262 OnUpdateWebPreferences(preferences); |
| 2262 } | 2263 } |
| 2263 | 2264 |
| 2264 blink::WebView* RenderViewImpl::GetWebView() { | 2265 blink::WebView* RenderViewImpl::GetWebView() { |
| 2265 return webview(); | 2266 return webview(); |
| 2266 } | 2267 } |
| 2267 | 2268 |
| 2269 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { |
| 2270 return frame_widget_; |
| 2271 } |
| 2272 |
| 2268 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { | 2273 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { |
| 2269 return (!send_preferred_size_changes_ || | 2274 return (!send_preferred_size_changes_ || |
| 2270 (disable_scrollbars_size_limit_.width() <= width || | 2275 (disable_scrollbars_size_limit_.width() <= width || |
| 2271 disable_scrollbars_size_limit_.height() <= height)); | 2276 disable_scrollbars_size_limit_.height() <= height)); |
| 2272 } | 2277 } |
| 2273 | 2278 |
| 2274 int RenderViewImpl::GetEnabledBindings() const { | 2279 int RenderViewImpl::GetEnabledBindings() const { |
| 2275 return enabled_bindings_; | 2280 return enabled_bindings_; |
| 2276 } | 2281 } |
| 2277 | 2282 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 WebSize scroll_offset = main_frame->scrollOffset(); | 2750 WebSize scroll_offset = main_frame->scrollOffset(); |
| 2746 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 2751 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
| 2747 } | 2752 } |
| 2748 | 2753 |
| 2749 void RenderViewImpl::OnClearFocusedElement() { | 2754 void RenderViewImpl::OnClearFocusedElement() { |
| 2750 if (webview()) | 2755 if (webview()) |
| 2751 webview()->clearFocusedElement(); | 2756 webview()->clearFocusedElement(); |
| 2752 } | 2757 } |
| 2753 | 2758 |
| 2754 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 2759 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
| 2755 if (webview()) | 2760 if (frame_widget_) |
| 2756 webview()->setIsTransparent(!opaque); | 2761 frame_widget_->setIsTransparent(!opaque); |
| 2757 if (compositor_) | 2762 if (compositor_) |
| 2758 compositor_->setHasTransparentBackground(!opaque); | 2763 compositor_->setHasTransparentBackground(!opaque); |
| 2759 } | 2764 } |
| 2760 | 2765 |
| 2761 void RenderViewImpl::OnSetActive(bool active) { | 2766 void RenderViewImpl::OnSetActive(bool active) { |
| 2762 if (webview()) | 2767 if (webview()) |
| 2763 webview()->setIsActive(active); | 2768 webview()->setIsActive(active); |
| 2764 | 2769 |
| 2765 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) | 2770 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) |
| 2766 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 2771 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3520 if (IsUseZoomForDSFEnabled()) { | 3525 if (IsUseZoomForDSFEnabled()) { |
| 3521 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3526 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3522 } else { | 3527 } else { |
| 3523 webview()->setDeviceScaleFactor(device_scale_factor_); | 3528 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3524 } | 3529 } |
| 3525 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3530 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3526 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3531 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3527 } | 3532 } |
| 3528 | 3533 |
| 3529 } // namespace content | 3534 } // namespace content |
| OLD | NEW |