OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 // it. We replace it with an empty GURL so the appropriate items are disabled | 1644 // it. We replace it with an empty GURL so the appropriate items are disabled |
1645 // in the context menu. | 1645 // in the context menu. |
1646 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large | 1646 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large |
1647 // data encoded images. We should have a way to save them. | 1647 // data encoded images. We should have a way to save them. |
1648 if (params.src_url.spec().size() > content::kMaxURLChars) | 1648 if (params.src_url.spec().size() > content::kMaxURLChars) |
1649 params.src_url = GURL(); | 1649 params.src_url = GURL(); |
1650 context_menu_node_ = data.node; | 1650 context_menu_node_ = data.node; |
1651 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); | 1651 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); |
1652 } | 1652 } |
1653 | 1653 |
1654 bool RenderViewImpl::supportsFullscreen() { | |
1655 return CommandLine::ForCurrentProcess()->HasSwitch( | |
1656 switches::kEnableVideoFullscreen); | |
1657 } | |
1658 | |
1659 void RenderViewImpl::enterFullscreenForNode(const WebKit::WebNode& node) { | |
1660 NOTIMPLEMENTED(); | |
1661 } | |
1662 | |
1663 void RenderViewImpl::exitFullscreenForNode(const WebKit::WebNode& node) { | |
1664 NOTIMPLEMENTED(); | |
1665 } | |
1666 | |
1667 void RenderViewImpl::enterFullscreen() { | 1654 void RenderViewImpl::enterFullscreen() { |
1668 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); | 1655 // TODO(darin): Remove once WebKit roll is complete. |
| 1656 enterFullScreen(); |
1669 } | 1657 } |
1670 | 1658 |
1671 void RenderViewImpl::exitFullscreen() { | 1659 void RenderViewImpl::exitFullscreen() { |
1672 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); | 1660 // TODO(darin): Remove once WebKit roll is complete. |
| 1661 exitFullScreen(); |
1673 } | 1662 } |
1674 | 1663 |
1675 void RenderViewImpl::setStatusText(const WebString& text) { | 1664 void RenderViewImpl::setStatusText(const WebString& text) { |
1676 } | 1665 } |
1677 | 1666 |
1678 void RenderViewImpl::UpdateTargetURL(const GURL& url, | 1667 void RenderViewImpl::UpdateTargetURL(const GURL& url, |
1679 const GURL& fallback_url) { | 1668 const GURL& fallback_url) { |
1680 GURL latest_url = url.is_empty() ? fallback_url : url; | 1669 GURL latest_url = url.is_empty() ? fallback_url : url; |
1681 if (latest_url == target_url_) | 1670 if (latest_url == target_url_) |
1682 return; | 1671 return; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1853 // TODO(darin): WebKit should really be smarter about suppressing events and | 1842 // TODO(darin): WebKit should really be smarter about suppressing events and |
1854 // timers so that we do not need to manage the shared timer in such a heavy | 1843 // timers so that we do not need to manage the shared timer in such a heavy |
1855 // handed manner. | 1844 // handed manner. |
1856 // | 1845 // |
1857 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1846 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
1858 RenderThreadImpl::current()->DoNotSuspendWebKitSharedTimer(); | 1847 RenderThreadImpl::current()->DoNotSuspendWebKitSharedTimer(); |
1859 | 1848 |
1860 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); | 1849 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); |
1861 } | 1850 } |
1862 | 1851 |
| 1852 bool RenderViewImpl::enterFullScreen() { |
| 1853 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); |
| 1854 return true; |
| 1855 } |
| 1856 |
| 1857 void RenderViewImpl::exitFullScreen() { |
| 1858 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); |
| 1859 } |
| 1860 |
1863 // WebKit::WebFrameClient ----------------------------------------------------- | 1861 // WebKit::WebFrameClient ----------------------------------------------------- |
1864 | 1862 |
1865 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, | 1863 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, |
1866 const WebPluginParams& params) { | 1864 const WebPluginParams& params) { |
1867 WebPlugin* plugin = NULL; | 1865 WebPlugin* plugin = NULL; |
1868 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( | 1866 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( |
1869 this, frame, params, &plugin)) { | 1867 this, frame, params, &plugin)) { |
1870 return plugin; | 1868 return plugin; |
1871 } | 1869 } |
1872 | 1870 |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3561 webview()->setZoomLevel(false, zoom_level); | 3559 webview()->setZoomLevel(false, zoom_level); |
3562 zoomLevelChanged(); | 3560 zoomLevelChanged(); |
3563 } | 3561 } |
3564 | 3562 |
3565 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | 3563 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, |
3566 double zoom_level) { | 3564 double zoom_level) { |
3567 host_zoom_levels_[url] = zoom_level; | 3565 host_zoom_levels_[url] = zoom_level; |
3568 } | 3566 } |
3569 | 3567 |
3570 void RenderViewImpl::OnExitFullscreen() { | 3568 void RenderViewImpl::OnExitFullscreen() { |
| 3569 // TODO(darin): Remove this IPC once WebKit has been updated. |
| 3570 #ifndef WEBKIT_HAS_NEW_FULLSCREEN_API |
3571 webview()->exitFullscreen(); | 3571 webview()->exitFullscreen(); |
| 3572 #endif |
3572 } | 3573 } |
3573 | 3574 |
3574 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) { | 3575 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) { |
3575 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 3576 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
3576 } | 3577 } |
3577 | 3578 |
3578 void RenderViewImpl::OnResetPageEncodingToDefault() { | 3579 void RenderViewImpl::OnResetPageEncodingToDefault() { |
3579 WebString no_encoding; | 3580 WebString no_encoding; |
3580 webview()->setPageEncoding(no_encoding); | 3581 webview()->setPageEncoding(no_encoding); |
3581 } | 3582 } |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4639 pepper_delegate_.OnLockMouseACK(succeeded); | 4640 pepper_delegate_.OnLockMouseACK(succeeded); |
4640 } | 4641 } |
4641 | 4642 |
4642 void RenderViewImpl::OnMouseLockLost() { | 4643 void RenderViewImpl::OnMouseLockLost() { |
4643 pepper_delegate_.OnMouseLockLost(); | 4644 pepper_delegate_.OnMouseLockLost(); |
4644 } | 4645 } |
4645 | 4646 |
4646 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4647 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
4647 return webview()->settings()->useThreadedCompositor(); | 4648 return webview()->settings()->useThreadedCompositor(); |
4648 } | 4649 } |
OLD | NEW |