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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 #include "third_party/WebKit/public/web/WebDataSource.h" | 137 #include "third_party/WebKit/public/web/WebDataSource.h" |
138 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" | 138 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" |
139 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" | 139 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" |
140 #include "third_party/WebKit/public/web/WebDocument.h" | 140 #include "third_party/WebKit/public/web/WebDocument.h" |
141 #include "third_party/WebKit/public/web/WebElement.h" | 141 #include "third_party/WebKit/public/web/WebElement.h" |
142 #include "third_party/WebKit/public/web/WebFileChooserParams.h" | 142 #include "third_party/WebKit/public/web/WebFileChooserParams.h" |
143 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 143 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
144 #include "third_party/WebKit/public/web/WebFormElement.h" | 144 #include "third_party/WebKit/public/web/WebFormElement.h" |
145 #include "third_party/WebKit/public/web/WebFrame.h" | 145 #include "third_party/WebKit/public/web/WebFrame.h" |
146 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" | 146 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" |
| 147 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
147 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 148 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
148 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 149 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
149 #include "third_party/WebKit/public/web/WebInputElement.h" | 150 #include "third_party/WebKit/public/web/WebInputElement.h" |
150 #include "third_party/WebKit/public/web/WebInputEvent.h" | 151 #include "third_party/WebKit/public/web/WebInputEvent.h" |
151 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 152 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
152 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" | 153 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" |
153 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 154 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
154 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" | 155 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" |
155 #include "third_party/WebKit/public/web/WebPlugin.h" | 156 #include "third_party/WebKit/public/web/WebPlugin.h" |
156 #include "third_party/WebKit/public/web/WebPluginAction.h" | 157 #include "third_party/WebKit/public/web/WebPluginAction.h" |
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 // calls DidStopLoading() without a matching DidStartLoading(). | 1755 // calls DidStopLoading() without a matching DidStartLoading(). |
1755 if (frames_in_progress_ == 0) | 1756 if (frames_in_progress_ == 0) |
1756 return; | 1757 return; |
1757 frames_in_progress_--; | 1758 frames_in_progress_--; |
1758 if (frames_in_progress_ == 0) { | 1759 if (frames_in_progress_ == 0) { |
1759 DidStopLoadingIcons(); | 1760 DidStopLoadingIcons(); |
1760 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1761 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
1761 } | 1762 } |
1762 } | 1763 } |
1763 | 1764 |
1764 void RenderViewImpl::AttachWebFrameWidget(blink::WebWidget* frame_widget) { | 1765 void RenderViewImpl::AttachWebFrameWidget(blink::WebFrameWidget* frame_widget) { |
1765 // The previous WebFrameWidget must already be detached by CloseForFrame(). | 1766 // The previous WebFrameWidget must already be detached by CloseForFrame(). |
1766 DCHECK(!frame_widget_); | 1767 DCHECK(!frame_widget_); |
1767 frame_widget_ = frame_widget; | 1768 frame_widget_ = frame_widget; |
1768 } | 1769 } |
1769 | 1770 |
1770 void RenderViewImpl::SetZoomLevel(double zoom_level) { | 1771 void RenderViewImpl::SetZoomLevel(double zoom_level) { |
1771 webview()->setZoomLevel(zoom_level); | 1772 webview()->setZoomLevel(zoom_level); |
1772 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); | 1773 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); |
1773 } | 1774 } |
1774 | 1775 |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2280 } | 2281 } |
2281 | 2282 |
2282 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { | 2283 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { |
2283 OnUpdateWebPreferences(preferences); | 2284 OnUpdateWebPreferences(preferences); |
2284 } | 2285 } |
2285 | 2286 |
2286 blink::WebView* RenderViewImpl::GetWebView() { | 2287 blink::WebView* RenderViewImpl::GetWebView() { |
2287 return webview(); | 2288 return webview(); |
2288 } | 2289 } |
2289 | 2290 |
| 2291 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { |
| 2292 return frame_widget_; |
| 2293 } |
| 2294 |
2290 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { | 2295 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { |
2291 return (!send_preferred_size_changes_ || | 2296 return (!send_preferred_size_changes_ || |
2292 (disable_scrollbars_size_limit_.width() <= width || | 2297 (disable_scrollbars_size_limit_.width() <= width || |
2293 disable_scrollbars_size_limit_.height() <= height)); | 2298 disable_scrollbars_size_limit_.height() <= height)); |
2294 } | 2299 } |
2295 | 2300 |
2296 int RenderViewImpl::GetEnabledBindings() const { | 2301 int RenderViewImpl::GetEnabledBindings() const { |
2297 return enabled_bindings_; | 2302 return enabled_bindings_; |
2298 } | 2303 } |
2299 | 2304 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2772 WebSize scroll_offset = main_frame->scrollOffset(); | 2777 WebSize scroll_offset = main_frame->scrollOffset(); |
2773 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 2778 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
2774 } | 2779 } |
2775 | 2780 |
2776 void RenderViewImpl::OnClearFocusedElement() { | 2781 void RenderViewImpl::OnClearFocusedElement() { |
2777 if (webview()) | 2782 if (webview()) |
2778 webview()->clearFocusedElement(); | 2783 webview()->clearFocusedElement(); |
2779 } | 2784 } |
2780 | 2785 |
2781 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 2786 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
2782 if (webview()) | 2787 if (frame_widget_) |
2783 webview()->setIsTransparent(!opaque); | 2788 frame_widget_->setIsTransparent(!opaque); |
2784 if (compositor_) | 2789 if (compositor_) |
2785 compositor_->setHasTransparentBackground(!opaque); | 2790 compositor_->setHasTransparentBackground(!opaque); |
2786 } | 2791 } |
2787 | 2792 |
2788 void RenderViewImpl::OnSetActive(bool active) { | 2793 void RenderViewImpl::OnSetActive(bool active) { |
2789 if (webview()) | 2794 if (webview()) |
2790 webview()->setIsActive(active); | 2795 webview()->setIsActive(active); |
2791 | 2796 |
2792 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) | 2797 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) |
2793 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 2798 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3547 if (IsUseZoomForDSFEnabled()) { | 3552 if (IsUseZoomForDSFEnabled()) { |
3548 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3553 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3549 } else { | 3554 } else { |
3550 webview()->setDeviceScaleFactor(device_scale_factor_); | 3555 webview()->setDeviceScaleFactor(device_scale_factor_); |
3551 } | 3556 } |
3552 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3557 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3553 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3558 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3554 } | 3559 } |
3555 | 3560 |
3556 } // namespace content | 3561 } // namespace content |
OLD | NEW |