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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 #include "third_party/WebKit/public/web/WebDataSource.h" | 135 #include "third_party/WebKit/public/web/WebDataSource.h" |
136 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" | 136 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" |
137 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" | 137 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" |
138 #include "third_party/WebKit/public/web/WebDocument.h" | 138 #include "third_party/WebKit/public/web/WebDocument.h" |
139 #include "third_party/WebKit/public/web/WebElement.h" | 139 #include "third_party/WebKit/public/web/WebElement.h" |
140 #include "third_party/WebKit/public/web/WebFileChooserParams.h" | 140 #include "third_party/WebKit/public/web/WebFileChooserParams.h" |
141 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 141 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
142 #include "third_party/WebKit/public/web/WebFormElement.h" | 142 #include "third_party/WebKit/public/web/WebFormElement.h" |
143 #include "third_party/WebKit/public/web/WebFrame.h" | 143 #include "third_party/WebKit/public/web/WebFrame.h" |
144 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" | 144 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" |
| 145 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
145 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 146 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
146 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 147 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
147 #include "third_party/WebKit/public/web/WebInputElement.h" | 148 #include "third_party/WebKit/public/web/WebInputElement.h" |
148 #include "third_party/WebKit/public/web/WebInputEvent.h" | 149 #include "third_party/WebKit/public/web/WebInputEvent.h" |
149 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 150 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
150 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" | 151 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" |
151 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 152 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
152 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" | 153 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" |
153 #include "third_party/WebKit/public/web/WebPlugin.h" | 154 #include "third_party/WebKit/public/web/WebPlugin.h" |
154 #include "third_party/WebKit/public/web/WebPluginAction.h" | 155 #include "third_party/WebKit/public/web/WebPluginAction.h" |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 // calls DidStopLoading() without a matching DidStartLoading(). | 1756 // calls DidStopLoading() without a matching DidStartLoading(). |
1756 if (frames_in_progress_ == 0) | 1757 if (frames_in_progress_ == 0) |
1757 return; | 1758 return; |
1758 frames_in_progress_--; | 1759 frames_in_progress_--; |
1759 if (frames_in_progress_ == 0) { | 1760 if (frames_in_progress_ == 0) { |
1760 DidStopLoadingIcons(); | 1761 DidStopLoadingIcons(); |
1761 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1762 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
1762 } | 1763 } |
1763 } | 1764 } |
1764 | 1765 |
1765 void RenderViewImpl::AttachWebFrameWidget(blink::WebWidget* frame_widget) { | 1766 void RenderViewImpl::AttachWebFrameWidget(blink::WebFrameWidget* frame_widget) { |
1766 // The previous WebFrameWidget must already be detached by CloseForFrame(). | 1767 // The previous WebFrameWidget must already be detached by CloseForFrame(). |
1767 DCHECK(!frame_widget_); | 1768 DCHECK(!frame_widget_); |
1768 frame_widget_ = frame_widget; | 1769 frame_widget_ = frame_widget; |
1769 } | 1770 } |
1770 | 1771 |
1771 void RenderViewImpl::SetZoomLevel(double zoom_level) { | 1772 void RenderViewImpl::SetZoomLevel(double zoom_level) { |
1772 webview()->setZoomLevel(zoom_level); | 1773 webview()->setZoomLevel(zoom_level); |
1773 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); | 1774 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); |
1774 } | 1775 } |
1775 | 1776 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2273 } | 2274 } |
2274 | 2275 |
2275 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { | 2276 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { |
2276 OnUpdateWebPreferences(preferences); | 2277 OnUpdateWebPreferences(preferences); |
2277 } | 2278 } |
2278 | 2279 |
2279 blink::WebView* RenderViewImpl::GetWebView() { | 2280 blink::WebView* RenderViewImpl::GetWebView() { |
2280 return webview(); | 2281 return webview(); |
2281 } | 2282 } |
2282 | 2283 |
| 2284 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { |
| 2285 return frame_widget_; |
| 2286 } |
| 2287 |
2283 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { | 2288 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { |
2284 return (!send_preferred_size_changes_ || | 2289 return (!send_preferred_size_changes_ || |
2285 (disable_scrollbars_size_limit_.width() <= width || | 2290 (disable_scrollbars_size_limit_.width() <= width || |
2286 disable_scrollbars_size_limit_.height() <= height)); | 2291 disable_scrollbars_size_limit_.height() <= height)); |
2287 } | 2292 } |
2288 | 2293 |
2289 int RenderViewImpl::GetEnabledBindings() const { | 2294 int RenderViewImpl::GetEnabledBindings() const { |
2290 return enabled_bindings_; | 2295 return enabled_bindings_; |
2291 } | 2296 } |
2292 | 2297 |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2760 WebSize scroll_offset = main_frame->scrollOffset(); | 2765 WebSize scroll_offset = main_frame->scrollOffset(); |
2761 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 2766 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
2762 } | 2767 } |
2763 | 2768 |
2764 void RenderViewImpl::OnClearFocusedElement() { | 2769 void RenderViewImpl::OnClearFocusedElement() { |
2765 if (webview()) | 2770 if (webview()) |
2766 webview()->clearFocusedElement(); | 2771 webview()->clearFocusedElement(); |
2767 } | 2772 } |
2768 | 2773 |
2769 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 2774 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
2770 if (webview()) | 2775 if (frame_widget_) |
2771 webview()->setIsTransparent(!opaque); | 2776 frame_widget_->setIsTransparent(!opaque); |
2772 if (compositor_) | 2777 if (compositor_) |
2773 compositor_->setHasTransparentBackground(!opaque); | 2778 compositor_->setHasTransparentBackground(!opaque); |
2774 } | 2779 } |
2775 | 2780 |
2776 void RenderViewImpl::OnSetActive(bool active) { | 2781 void RenderViewImpl::OnSetActive(bool active) { |
2777 if (webview()) | 2782 if (webview()) |
2778 webview()->setIsActive(active); | 2783 webview()->setIsActive(active); |
2779 | 2784 |
2780 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) | 2785 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) |
2781 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 2786 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3535 if (IsUseZoomForDSFEnabled()) { | 3540 if (IsUseZoomForDSFEnabled()) { |
3536 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3541 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3537 } else { | 3542 } else { |
3538 webview()->setDeviceScaleFactor(device_scale_factor_); | 3543 webview()->setDeviceScaleFactor(device_scale_factor_); |
3539 } | 3544 } |
3540 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3545 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3541 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3546 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3542 } | 3547 } |
3543 | 3548 |
3544 } // namespace content | 3549 } // namespace content |
OLD | NEW |