| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 #include "third_party/WebKit/public/web/WebElement.h" | 159 #include "third_party/WebKit/public/web/WebElement.h" |
| 160 #include "third_party/WebKit/public/web/WebFileChooserParams.h" | 160 #include "third_party/WebKit/public/web/WebFileChooserParams.h" |
| 161 #include "third_party/WebKit/public/web/WebFindOptions.h" | 161 #include "third_party/WebKit/public/web/WebFindOptions.h" |
| 162 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 162 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
| 163 #include "third_party/WebKit/public/web/WebFormElement.h" | 163 #include "third_party/WebKit/public/web/WebFormElement.h" |
| 164 #include "third_party/WebKit/public/web/WebFrame.h" | 164 #include "third_party/WebKit/public/web/WebFrame.h" |
| 165 #include "third_party/WebKit/public/web/WebGlyphCache.h" | 165 #include "third_party/WebKit/public/web/WebGlyphCache.h" |
| 166 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 166 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 167 #include "third_party/WebKit/public/web/WebInputElement.h" | 167 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 168 #include "third_party/WebKit/public/web/WebInputEvent.h" | 168 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 169 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 169 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" | 170 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" |
| 170 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 171 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| 171 #include "third_party/WebKit/public/web/WebNodeList.h" | 172 #include "third_party/WebKit/public/web/WebNodeList.h" |
| 172 #include "third_party/WebKit/public/web/WebPageSerializer.h" | 173 #include "third_party/WebKit/public/web/WebPageSerializer.h" |
| 173 #include "third_party/WebKit/public/web/WebPlugin.h" | 174 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 174 #include "third_party/WebKit/public/web/WebPluginAction.h" | 175 #include "third_party/WebKit/public/web/WebPluginAction.h" |
| 175 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 176 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 176 #include "third_party/WebKit/public/web/WebPluginDocument.h" | 177 #include "third_party/WebKit/public/web/WebPluginDocument.h" |
| 177 #include "third_party/WebKit/public/web/WebRange.h" | 178 #include "third_party/WebKit/public/web/WebRange.h" |
| 178 #include "third_party/WebKit/public/web/WebScriptSource.h" | 179 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 using blink::WebFormControlElement; | 265 using blink::WebFormControlElement; |
| 265 using blink::WebFormElement; | 266 using blink::WebFormElement; |
| 266 using blink::WebFrame; | 267 using blink::WebFrame; |
| 267 using blink::WebGestureEvent; | 268 using blink::WebGestureEvent; |
| 268 using blink::WebHistoryItem; | 269 using blink::WebHistoryItem; |
| 269 using blink::WebHTTPBody; | 270 using blink::WebHTTPBody; |
| 270 using blink::WebIconURL; | 271 using blink::WebIconURL; |
| 271 using blink::WebImage; | 272 using blink::WebImage; |
| 272 using blink::WebInputElement; | 273 using blink::WebInputElement; |
| 273 using blink::WebInputEvent; | 274 using blink::WebInputEvent; |
| 275 using blink::WebLocalFrame; |
| 274 using blink::WebMediaPlayer; | 276 using blink::WebMediaPlayer; |
| 275 using blink::WebMediaPlayerAction; | 277 using blink::WebMediaPlayerAction; |
| 276 using blink::WebMediaPlayerClient; | 278 using blink::WebMediaPlayerClient; |
| 277 using blink::WebMouseEvent; | 279 using blink::WebMouseEvent; |
| 278 using blink::WebNavigationPolicy; | 280 using blink::WebNavigationPolicy; |
| 279 using blink::WebNavigationType; | 281 using blink::WebNavigationType; |
| 280 using blink::WebNode; | 282 using blink::WebNode; |
| 281 using blink::WebPageSerializer; | 283 using blink::WebPageSerializer; |
| 282 using blink::WebPageSerializerClient; | 284 using blink::WebPageSerializerClient; |
| 283 using blink::WebPeerConnection00Handler; | 285 using blink::WebPeerConnection00Handler; |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 webview()->settings()->setCompositedScrollingForFramesEnabled( | 773 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 772 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 774 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 773 webview()->settings() | 775 webview()->settings() |
| 774 ->setAcceleratedCompositingForGpuRasterizationHintEnabled( | 776 ->setAcceleratedCompositingForGpuRasterizationHintEnabled( |
| 775 ShouldUseCompositingForGpuRasterizationHint()); | 777 ShouldUseCompositingForGpuRasterizationHint()); |
| 776 | 778 |
| 777 ApplyWebPreferences(webkit_preferences_, webview()); | 779 ApplyWebPreferences(webkit_preferences_, webview()); |
| 778 | 780 |
| 779 main_render_frame_.reset( | 781 main_render_frame_.reset( |
| 780 RenderFrameImpl::Create(this, params->main_frame_routing_id)); | 782 RenderFrameImpl::Create(this, params->main_frame_routing_id)); |
| 781 // The main frame WebFrame object is closed by | 783 // The main frame WebLocalFrame object is closed by |
| 782 // RenderFrameImpl::frameDetached(). | 784 // RenderFrameImpl::frameDetached(). |
| 783 webview()->setMainFrame(WebFrame::create(main_render_frame_.get())); | 785 webview()->setMainFrame(WebLocalFrame::create(main_render_frame_.get())); |
| 784 main_render_frame_->SetWebFrame(webview()->mainFrame()); | 786 main_render_frame_->SetWebFrame(webview()->mainFrame()->toWebLocalFrame()); |
| 785 | 787 |
| 786 if (switches::IsTouchDragDropEnabled()) | 788 if (switches::IsTouchDragDropEnabled()) |
| 787 webview()->settings()->setTouchDragDropEnabled(true); | 789 webview()->settings()->setTouchDragDropEnabled(true); |
| 788 | 790 |
| 789 if (switches::IsTouchEditingEnabled()) | 791 if (switches::IsTouchEditingEnabled()) |
| 790 webview()->settings()->setTouchEditingEnabled(true); | 792 webview()->settings()->setTouchEditingEnabled(true); |
| 791 | 793 |
| 792 if (!params->frame_name.empty()) | 794 if (!params->frame_name.empty()) |
| 793 webview()->mainFrame()->setName(params->frame_name); | 795 webview()->mainFrame()->setName(params->frame_name); |
| 794 | 796 |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 it->second.Run(size, png); | 1463 it->second.Run(size, png); |
| 1462 pending_snapshots_.erase(it++); | 1464 pending_snapshots_.erase(it++); |
| 1463 } else { | 1465 } else { |
| 1464 ++it; | 1466 ++it; |
| 1465 } | 1467 } |
| 1466 } | 1468 } |
| 1467 } | 1469 } |
| 1468 | 1470 |
| 1469 // blink::WebViewClient ------------------------------------------------------ | 1471 // blink::WebViewClient ------------------------------------------------------ |
| 1470 | 1472 |
| 1471 WebView* RenderViewImpl::createView( | 1473 WebView* RenderViewImpl::createView(WebLocalFrame* creator, |
| 1472 WebFrame* creator, | 1474 const WebURLRequest& request, |
| 1473 const WebURLRequest& request, | 1475 const WebWindowFeatures& features, |
| 1474 const WebWindowFeatures& features, | 1476 const WebString& frame_name, |
| 1475 const WebString& frame_name, | 1477 WebNavigationPolicy policy, |
| 1476 WebNavigationPolicy policy, | 1478 bool suppress_opener) { |
| 1477 bool suppress_opener) { | |
| 1478 ViewHostMsg_CreateWindow_Params params; | 1479 ViewHostMsg_CreateWindow_Params params; |
| 1479 params.opener_id = routing_id_; | 1480 params.opener_id = routing_id_; |
| 1480 params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 1481 params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
| 1481 if (GetContentClient()->renderer()->AllowPopup()) | 1482 if (GetContentClient()->renderer()->AllowPopup()) |
| 1482 params.user_gesture = true; | 1483 params.user_gesture = true; |
| 1483 params.window_container_type = WindowFeaturesToContainerType(features); | 1484 params.window_container_type = WindowFeaturesToContainerType(features); |
| 1484 params.session_storage_namespace_id = session_storage_namespace_id_; | 1485 params.session_storage_namespace_id = session_storage_namespace_id_; |
| 1485 if (frame_name != "_blank") | 1486 if (frame_name != "_blank") |
| 1486 params.frame_name = frame_name; | 1487 params.frame_name = frame_name; |
| 1487 params.opener_render_frame_id = | 1488 params.opener_render_frame_id = |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 #else | 1596 #else |
| 1596 return NULL; | 1597 return NULL; |
| 1597 #endif | 1598 #endif |
| 1598 } | 1599 } |
| 1599 | 1600 |
| 1600 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { | 1601 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { |
| 1601 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1602 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
| 1602 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1603 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
| 1603 } | 1604 } |
| 1604 | 1605 |
| 1605 void RenderViewImpl::printPage(WebFrame* frame) { | 1606 void RenderViewImpl::printPage(WebLocalFrame* frame) { |
| 1606 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1607 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 1607 PrintPage(frame, handling_input_event_)); | 1608 PrintPage(frame, handling_input_event_)); |
| 1608 } | 1609 } |
| 1609 | 1610 |
| 1610 blink::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { | 1611 blink::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { |
| 1611 return notification_provider_; | 1612 return notification_provider_; |
| 1612 } | 1613 } |
| 1613 | 1614 |
| 1614 bool RenderViewImpl::enumerateChosenDirectory( | 1615 bool RenderViewImpl::enumerateChosenDirectory( |
| 1615 const WebString& path, | 1616 const WebString& path, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1728 ipc_params.accept_types.reserve(params.acceptTypes.size()); | 1729 ipc_params.accept_types.reserve(params.acceptTypes.size()); |
| 1729 for (size_t i = 0; i < params.acceptTypes.size(); ++i) | 1730 for (size_t i = 0; i < params.acceptTypes.size(); ++i) |
| 1730 ipc_params.accept_types.push_back(params.acceptTypes[i]); | 1731 ipc_params.accept_types.push_back(params.acceptTypes[i]); |
| 1731 #if defined(OS_ANDROID) | 1732 #if defined(OS_ANDROID) |
| 1732 ipc_params.capture = params.useMediaCapture; | 1733 ipc_params.capture = params.useMediaCapture; |
| 1733 #endif | 1734 #endif |
| 1734 | 1735 |
| 1735 return ScheduleFileChooser(ipc_params, chooser_completion); | 1736 return ScheduleFileChooser(ipc_params, chooser_completion); |
| 1736 } | 1737 } |
| 1737 | 1738 |
| 1738 void RenderViewImpl::runModalAlertDialog(WebFrame* frame, | 1739 void RenderViewImpl::runModalAlertDialog(WebLocalFrame* frame, |
| 1739 const WebString& message) { | 1740 const WebString& message) { |
| 1740 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, | 1741 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, |
| 1741 message, | 1742 message, |
| 1742 base::string16(), | 1743 base::string16(), |
| 1743 frame->document().url(), | 1744 frame->document().url(), |
| 1744 NULL); | 1745 NULL); |
| 1745 } | 1746 } |
| 1746 | 1747 |
| 1747 bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, | 1748 bool RenderViewImpl::runModalConfirmDialog(WebLocalFrame* frame, |
| 1748 const WebString& message) { | 1749 const WebString& message) { |
| 1749 return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, | 1750 return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, |
| 1750 message, | 1751 message, |
| 1751 base::string16(), | 1752 base::string16(), |
| 1752 frame->document().url(), | 1753 frame->document().url(), |
| 1753 NULL); | 1754 NULL); |
| 1754 } | 1755 } |
| 1755 | 1756 |
| 1756 bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, | 1757 bool RenderViewImpl::runModalPromptDialog(WebLocalFrame* frame, |
| 1757 const WebString& message, | 1758 const WebString& message, |
| 1758 const WebString& default_value, | 1759 const WebString& default_value, |
| 1759 WebString* actual_value) { | 1760 WebString* actual_value) { |
| 1760 base::string16 result; | 1761 base::string16 result; |
| 1761 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, | 1762 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, |
| 1762 message, | 1763 message, |
| 1763 default_value, | 1764 default_value, |
| 1764 frame->document().url(), | 1765 frame->document().url(), |
| 1765 &result); | 1766 &result); |
| 1766 if (ok) | 1767 if (ok) |
| 1767 actual_value->assign(result); | 1768 actual_value->assign(result); |
| 1768 return ok; | 1769 return ok; |
| 1769 } | 1770 } |
| 1770 | 1771 |
| 1771 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1772 bool RenderViewImpl::runModalBeforeUnloadDialog(WebLocalFrame* frame, |
| 1772 WebFrame* frame, const WebString& message) { | 1773 const WebString& message) { |
| 1773 bool is_reload = false; | 1774 bool is_reload = false; |
| 1774 WebDataSource* ds = frame->provisionalDataSource(); | 1775 WebDataSource* ds = frame->provisionalDataSource(); |
| 1775 if (ds) | 1776 if (ds) |
| 1776 is_reload = (ds->navigationType() == blink::WebNavigationTypeReload); | 1777 is_reload = (ds->navigationType() == blink::WebNavigationTypeReload); |
| 1777 return runModalBeforeUnloadDialog(frame, is_reload, message); | 1778 return runModalBeforeUnloadDialog(frame, is_reload, message); |
| 1778 } | 1779 } |
| 1779 | 1780 |
| 1780 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1781 bool RenderViewImpl::runModalBeforeUnloadDialog(WebLocalFrame* frame, |
| 1781 WebFrame* frame, bool is_reload, const WebString& message) { | 1782 bool is_reload, |
| 1783 const WebString& message) { |
| 1782 // If we are swapping out, we have already run the beforeunload handler. | 1784 // If we are swapping out, we have already run the beforeunload handler. |
| 1783 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload | 1785 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload |
| 1784 // at all, to avoid running it twice. | 1786 // at all, to avoid running it twice. |
| 1785 if (is_swapped_out_) | 1787 if (is_swapped_out_) |
| 1786 return true; | 1788 return true; |
| 1787 | 1789 |
| 1788 // Don't allow further dialogs if we are waiting to swap out, since the | 1790 // Don't allow further dialogs if we are waiting to swap out, since the |
| 1789 // PageGroupLoadDeferrer in our stack prevents it. | 1791 // PageGroupLoadDeferrer in our stack prevents it. |
| 1790 if (suppress_dialogs_until_swap_out_) | 1792 if (suppress_dialogs_until_swap_out_) |
| 1791 return false; | 1793 return false; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 void RenderViewImpl::setMouseOverURL(const WebURL& url) { | 1901 void RenderViewImpl::setMouseOverURL(const WebURL& url) { |
| 1900 mouse_over_url_ = GURL(url); | 1902 mouse_over_url_ = GURL(url); |
| 1901 UpdateTargetURL(mouse_over_url_, focus_url_); | 1903 UpdateTargetURL(mouse_over_url_, focus_url_); |
| 1902 } | 1904 } |
| 1903 | 1905 |
| 1904 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { | 1906 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { |
| 1905 focus_url_ = GURL(url); | 1907 focus_url_ = GURL(url); |
| 1906 UpdateTargetURL(focus_url_, mouse_over_url_); | 1908 UpdateTargetURL(focus_url_, mouse_over_url_); |
| 1907 } | 1909 } |
| 1908 | 1910 |
| 1909 void RenderViewImpl::startDragging(WebFrame* frame, | 1911 void RenderViewImpl::startDragging(WebLocalFrame* frame, |
| 1910 const WebDragData& data, | 1912 const WebDragData& data, |
| 1911 WebDragOperationsMask mask, | 1913 WebDragOperationsMask mask, |
| 1912 const WebImage& image, | 1914 const WebImage& image, |
| 1913 const WebPoint& webImageOffset) { | 1915 const WebPoint& webImageOffset) { |
| 1914 DropData drop_data(DropDataBuilder::Build(data)); | 1916 DropData drop_data(DropDataBuilder::Build(data)); |
| 1915 drop_data.referrer_policy = frame->document().referrerPolicy(); | 1917 drop_data.referrer_policy = frame->document().referrerPolicy(); |
| 1916 gfx::Vector2d imageOffset(webImageOffset.x, webImageOffset.y); | 1918 gfx::Vector2d imageOffset(webImageOffset.x, webImageOffset.y); |
| 1917 Send(new DragHostMsg_StartDragging(routing_id_, | 1919 Send(new DragHostMsg_StartDragging(routing_id_, |
| 1918 drop_data, | 1920 drop_data, |
| 1919 mask, | 1921 mask, |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 RenderWidget::initializeLayerTreeView(); | 2144 RenderWidget::initializeLayerTreeView(); |
| 2143 RenderWidgetCompositor* rwc = compositor(); | 2145 RenderWidgetCompositor* rwc = compositor(); |
| 2144 if (!rwc || !webview() || !webview()->devToolsAgent()) | 2146 if (!rwc || !webview() || !webview()->devToolsAgent()) |
| 2145 return; | 2147 return; |
| 2146 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 2148 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
| 2147 } | 2149 } |
| 2148 | 2150 |
| 2149 // blink::WebFrameClient ----------------------------------------------------- | 2151 // blink::WebFrameClient ----------------------------------------------------- |
| 2150 | 2152 |
| 2151 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2153 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
| 2152 WebFrame* frame, const blink::WebURL& url, WebMediaPlayerClient* client) { | 2154 WebLocalFrame* frame, |
| 2155 const blink::WebURL& url, |
| 2156 WebMediaPlayerClient* client) { |
| 2153 NOTREACHED(); | 2157 NOTREACHED(); |
| 2154 return NULL; | 2158 return NULL; |
| 2155 } | 2159 } |
| 2156 | 2160 |
| 2157 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( | 2161 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( |
| 2158 RenderFrame* render_frame, | 2162 RenderFrame* render_frame, |
| 2159 blink::WebFrame* frame, | 2163 blink::WebLocalFrame* frame, |
| 2160 const blink::WebURL& url, | 2164 const blink::WebURL& url, |
| 2161 blink::WebMediaPlayerClient* client) { | 2165 blink::WebMediaPlayerClient* client) { |
| 2162 FOR_EACH_OBSERVER( | 2166 FOR_EACH_OBSERVER( |
| 2163 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2167 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
| 2164 | 2168 |
| 2165 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, | 2169 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, |
| 2166 client); | 2170 client); |
| 2167 if (player) | 2171 if (player) |
| 2168 return player; | 2172 return player; |
| 2169 | 2173 |
| 2170 #if defined(OS_ANDROID) | 2174 #if defined(OS_ANDROID) |
| 2171 return CreateAndroidWebMediaPlayer(frame, url, client); | 2175 return CreateAndroidWebMediaPlayer(frame, url, client); |
| 2172 #else | 2176 #else |
| 2173 WebMediaPlayerParams params( | 2177 WebMediaPlayerParams params( |
| 2174 base::Bind(&ContentRendererClient::DeferMediaLoad, | 2178 base::Bind(&ContentRendererClient::DeferMediaLoad, |
| 2175 base::Unretained(GetContentClient()->renderer()), | 2179 base::Unretained(GetContentClient()->renderer()), |
| 2176 static_cast<RenderFrame*>(render_frame)), | 2180 static_cast<RenderFrame*>(render_frame)), |
| 2177 RenderThreadImpl::current()->GetAudioRendererMixerManager()->CreateInput( | 2181 RenderThreadImpl::current()->GetAudioRendererMixerManager()->CreateInput( |
| 2178 routing_id_, render_frame->GetRoutingID())); | 2182 routing_id_, render_frame->GetRoutingID())); |
| 2179 return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params); | 2183 return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params); |
| 2180 #endif // defined(OS_ANDROID) | 2184 #endif // defined(OS_ANDROID) |
| 2181 } | 2185 } |
| 2182 | 2186 |
| 2183 void RenderViewImpl::didAccessInitialDocument(WebFrame* frame) { | 2187 void RenderViewImpl::didAccessInitialDocument(WebLocalFrame* frame) { |
| 2184 // Notify the browser process that it is no longer safe to show the pending | 2188 // Notify the browser process that it is no longer safe to show the pending |
| 2185 // URL of the main frame, since a URL spoof is now possible. | 2189 // URL of the main frame, since a URL spoof is now possible. |
| 2186 if (!frame->parent() && page_id_ == -1) | 2190 if (!frame->parent() && page_id_ == -1) |
| 2187 Send(new ViewHostMsg_DidAccessInitialDocument(routing_id_)); | 2191 Send(new ViewHostMsg_DidAccessInitialDocument(routing_id_)); |
| 2188 } | 2192 } |
| 2189 | 2193 |
| 2190 void RenderViewImpl::didDisownOpener(blink::WebFrame* frame) { | 2194 void RenderViewImpl::didDisownOpener(blink::WebLocalFrame* frame) { |
| 2191 // We only need to notify the browser if the active, top-level frame clears | 2195 // We only need to notify the browser if the active, top-level frame clears |
| 2192 // its opener. We can ignore cases where a swapped out frame clears its | 2196 // its opener. We can ignore cases where a swapped out frame clears its |
| 2193 // opener after hearing about it from the browser, and the browser does not | 2197 // opener after hearing about it from the browser, and the browser does not |
| 2194 // (yet) care about subframe openers. | 2198 // (yet) care about subframe openers. |
| 2195 if (is_swapped_out_ || frame->parent()) | 2199 if (is_swapped_out_ || frame->parent()) |
| 2196 return; | 2200 return; |
| 2197 | 2201 |
| 2198 // Notify WebContents and all its swapped out RenderViews. | 2202 // Notify WebContents and all its swapped out RenderViews. |
| 2199 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); | 2203 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); |
| 2200 } | 2204 } |
| 2201 | 2205 |
| 2202 void RenderViewImpl::frameDetached(WebFrame* frame) { | 2206 void RenderViewImpl::frameDetached(WebFrame* frame) { |
| 2203 // NOTE: We may get here for either the main frame or for subframes. The | 2207 // NOTE: We may get here for either the main frame or for subframes. The |
| 2204 // RenderFrameImpl will be deleted immediately after this call for subframes | 2208 // RenderFrameImpl will be deleted immediately after this call for subframes |
| 2205 // but not for the main frame, which is owned by |main_render_frame_|. | 2209 // but not for the main frame, which is owned by |main_render_frame_|. |
| 2206 | 2210 |
| 2207 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); | 2211 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); |
| 2208 } | 2212 } |
| 2209 | 2213 |
| 2210 void RenderViewImpl::willClose(WebFrame* frame) { | 2214 void RenderViewImpl::willClose(WebFrame* frame) { |
| 2211 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); | 2215 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); |
| 2212 } | 2216 } |
| 2213 | 2217 |
| 2214 void RenderViewImpl::didMatchCSS( | 2218 void RenderViewImpl::didMatchCSS( |
| 2215 WebFrame* frame, | 2219 WebLocalFrame* frame, |
| 2216 const WebVector<WebString>& newly_matching_selectors, | 2220 const WebVector<WebString>& newly_matching_selectors, |
| 2217 const WebVector<WebString>& stopped_matching_selectors) { | 2221 const WebVector<WebString>& stopped_matching_selectors) { |
| 2218 FOR_EACH_OBSERVER( | 2222 FOR_EACH_OBSERVER( |
| 2219 RenderViewObserver, observers_, | 2223 RenderViewObserver, observers_, |
| 2220 DidMatchCSS(frame, newly_matching_selectors, stopped_matching_selectors)); | 2224 DidMatchCSS(frame, newly_matching_selectors, stopped_matching_selectors)); |
| 2221 } | 2225 } |
| 2222 | 2226 |
| 2223 void RenderViewImpl::Repaint(const gfx::Size& size) { | 2227 void RenderViewImpl::Repaint(const gfx::Size& size) { |
| 2224 OnRepaint(size); | 2228 OnRepaint(size); |
| 2225 } | 2229 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2247 &ssl_status.security_bits, | 2251 &ssl_status.security_bits, |
| 2248 &ssl_status.connection_status, | 2252 &ssl_status.connection_status, |
| 2249 &ssl_status.signed_certificate_timestamp_ids); | 2253 &ssl_status.signed_certificate_timestamp_ids); |
| 2250 return ssl_status; | 2254 return ssl_status; |
| 2251 } | 2255 } |
| 2252 | 2256 |
| 2253 const std::string& RenderViewImpl::GetAcceptLanguages() const { | 2257 const std::string& RenderViewImpl::GetAcceptLanguages() const { |
| 2254 return renderer_preferences_.accept_languages; | 2258 return renderer_preferences_.accept_languages; |
| 2255 } | 2259 } |
| 2256 | 2260 |
| 2257 void RenderViewImpl::willSendSubmitEvent(blink::WebFrame* frame, | 2261 void RenderViewImpl::willSendSubmitEvent(blink::WebLocalFrame* frame, |
| 2258 const blink::WebFormElement& form) { | 2262 const blink::WebFormElement& form) { |
| 2259 FOR_EACH_OBSERVER( | 2263 FOR_EACH_OBSERVER( |
| 2260 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); | 2264 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); |
| 2261 } | 2265 } |
| 2262 | 2266 |
| 2263 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 2267 void RenderViewImpl::willSubmitForm(WebLocalFrame* frame, |
| 2264 const WebFormElement& form) { | 2268 const WebFormElement& form) { |
| 2265 FOR_EACH_OBSERVER( | 2269 FOR_EACH_OBSERVER( |
| 2266 RenderViewObserver, observers_, WillSubmitForm(frame, form)); | 2270 RenderViewObserver, observers_, WillSubmitForm(frame, form)); |
| 2267 } | 2271 } |
| 2268 | 2272 |
| 2269 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { | 2273 void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame, |
| 2274 WebDataSource* ds) { |
| 2270 bool content_initiated = !pending_navigation_params_.get(); | 2275 bool content_initiated = !pending_navigation_params_.get(); |
| 2271 | 2276 |
| 2272 // Make sure any previous redirect URLs end up in our new data source. | 2277 // Make sure any previous redirect URLs end up in our new data source. |
| 2273 if (pending_navigation_params_.get()) { | 2278 if (pending_navigation_params_.get()) { |
| 2274 for (std::vector<GURL>::const_iterator i = | 2279 for (std::vector<GURL>::const_iterator i = |
| 2275 pending_navigation_params_->redirects.begin(); | 2280 pending_navigation_params_->redirects.begin(); |
| 2276 i != pending_navigation_params_->redirects.end(); ++i) { | 2281 i != pending_navigation_params_->redirects.end(); ++i) { |
| 2277 ds->appendRedirect(*i); | 2282 ds->appendRedirect(*i); |
| 2278 } | 2283 } |
| 2279 } | 2284 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 | 2442 |
| 2438 // When navigating to a new page, reset the page scale factor to be 1.0. | 2443 // When navigating to a new page, reset the page scale factor to be 1.0. |
| 2439 webview()->setInitialPageScaleOverride(1.f); | 2444 webview()->setInitialPageScaleOverride(1.f); |
| 2440 | 2445 |
| 2441 float maxPageScaleFactor = | 2446 float maxPageScaleFactor = |
| 2442 command_line.HasSwitch(switches::kEnablePinch) ? 4.f : 1.f ; | 2447 command_line.HasSwitch(switches::kEnablePinch) ? 4.f : 1.f ; |
| 2443 webview()->setPageScaleFactorLimits(1, maxPageScaleFactor); | 2448 webview()->setPageScaleFactorLimits(1, maxPageScaleFactor); |
| 2444 } | 2449 } |
| 2445 | 2450 |
| 2446 // TODO(nasko): Remove this method once WebTestProxy in Blink is fixed. | 2451 // TODO(nasko): Remove this method once WebTestProxy in Blink is fixed. |
| 2447 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { | 2452 void RenderViewImpl::didStartProvisionalLoad(WebLocalFrame* frame) {} |
| 2448 } | |
| 2449 | 2453 |
| 2450 void RenderViewImpl::didFailProvisionalLoad(WebFrame* frame, | 2454 void RenderViewImpl::didFailProvisionalLoad(WebLocalFrame* frame, |
| 2451 const WebURLError& error) { | 2455 const WebURLError& error) { |
| 2452 // Notify the browser that we failed a provisional load with an error. | 2456 // Notify the browser that we failed a provisional load with an error. |
| 2453 // | 2457 // |
| 2454 // Note: It is important this notification occur before DidStopLoading so the | 2458 // Note: It is important this notification occur before DidStopLoading so the |
| 2455 // SSL manager can react to the provisional load failure before being | 2459 // SSL manager can react to the provisional load failure before being |
| 2456 // notified the load stopped. | 2460 // notified the load stopped. |
| 2457 // | 2461 // |
| 2458 FOR_EACH_OBSERVER( | 2462 FOR_EACH_OBSERVER( |
| 2459 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); | 2463 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); |
| 2460 } | 2464 } |
| 2461 | 2465 |
| 2462 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, | 2466 void RenderViewImpl::didCommitProvisionalLoad(WebLocalFrame* frame, |
| 2463 bool is_new_navigation) { | 2467 bool is_new_navigation) { |
| 2464 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2468 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2465 DidCommitProvisionalLoad(frame, is_new_navigation)); | 2469 DidCommitProvisionalLoad(frame, is_new_navigation)); |
| 2466 | 2470 |
| 2467 // TODO(nasko): Transition this code to RenderFrameImpl, since g_view_map is | 2471 // TODO(nasko): Transition this code to RenderFrameImpl, since g_view_map is |
| 2468 // not accessible from there. | 2472 // not accessible from there. |
| 2469 if (!frame->parent()) { // Only for top frames. | 2473 if (!frame->parent()) { // Only for top frames. |
| 2470 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); | 2474 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
| 2471 if (render_thread_impl) { // Can be NULL in tests. | 2475 if (render_thread_impl) { // Can be NULL in tests. |
| 2472 render_thread_impl->histogram_customizer()-> | 2476 render_thread_impl->histogram_customizer()-> |
| 2473 RenderViewNavigatedToHost(GURL(GetLoadingUrl(frame)).host(), | 2477 RenderViewNavigatedToHost(GURL(GetLoadingUrl(frame)).host(), |
| 2474 g_view_map.Get().size()); | 2478 g_view_map.Get().size()); |
| 2475 } | 2479 } |
| 2476 } | 2480 } |
| 2477 } | 2481 } |
| 2478 | 2482 |
| 2479 void RenderViewImpl::didClearWindowObject(WebFrame* frame, int world_id) { | 2483 void RenderViewImpl::didClearWindowObject(WebLocalFrame* frame, int world_id) { |
| 2480 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2484 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2481 DidClearWindowObject(frame, world_id)); | 2485 DidClearWindowObject(frame, world_id)); |
| 2482 | 2486 |
| 2483 // Only install controllers into the main world. | 2487 // Only install controllers into the main world. |
| 2484 if (world_id) | 2488 if (world_id) |
| 2485 return; | 2489 return; |
| 2486 | 2490 |
| 2487 if (enabled_bindings_& BINDINGS_POLICY_WEB_UI) | 2491 if (enabled_bindings_& BINDINGS_POLICY_WEB_UI) |
| 2488 WebUIExtension::Install(frame); | 2492 WebUIExtension::Install(frame); |
| 2489 | 2493 |
| 2490 if (enabled_bindings_ & BINDINGS_POLICY_STATS_COLLECTION) | 2494 if (enabled_bindings_ & BINDINGS_POLICY_STATS_COLLECTION) |
| 2491 StatsCollectionController::Install(frame); | 2495 StatsCollectionController::Install(frame); |
| 2492 | 2496 |
| 2493 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2497 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 2494 | 2498 |
| 2495 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) | 2499 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) |
| 2496 SkiaBenchmarking::Install(frame); | 2500 SkiaBenchmarking::Install(frame); |
| 2497 | 2501 |
| 2498 if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) | 2502 if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) |
| 2499 MemoryBenchmarkingExtension::Install(frame); | 2503 MemoryBenchmarkingExtension::Install(frame); |
| 2500 } | 2504 } |
| 2501 | 2505 |
| 2502 void RenderViewImpl::didCreateDocumentElement(WebFrame* frame) { | 2506 void RenderViewImpl::didCreateDocumentElement(WebLocalFrame* frame) { |
| 2503 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2507 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2504 DidCreateDocumentElement(frame)); | 2508 DidCreateDocumentElement(frame)); |
| 2505 } | 2509 } |
| 2506 | 2510 |
| 2507 void RenderViewImpl::didReceiveTitle(WebFrame* frame, const WebString& title, | 2511 void RenderViewImpl::didReceiveTitle(WebLocalFrame* frame, |
| 2512 const WebString& title, |
| 2508 WebTextDirection direction) { | 2513 WebTextDirection direction) { |
| 2509 UpdateTitle(frame, title, direction); | 2514 UpdateTitle(frame, title, direction); |
| 2510 | 2515 |
| 2511 // Also check whether we have new encoding name. | 2516 // Also check whether we have new encoding name. |
| 2512 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2517 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 2513 } | 2518 } |
| 2514 | 2519 |
| 2515 void RenderViewImpl::didChangeIcon(WebFrame* frame, | 2520 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2516 WebIconURL::Type icon_type) { | 2521 WebIconURL::Type icon_type) { |
| 2517 if (frame->parent()) | 2522 if (frame->parent()) |
| 2518 return; | 2523 return; |
| 2519 | 2524 |
| 2520 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) | 2525 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) |
| 2521 return; | 2526 return; |
| 2522 | 2527 |
| 2523 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2528 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
| 2524 std::vector<FaviconURL> urls; | 2529 std::vector<FaviconURL> urls; |
| 2525 for (size_t i = 0; i < icon_urls.size(); i++) { | 2530 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 2526 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); | 2531 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); |
| 2527 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 2532 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 2528 urls.push_back(FaviconURL( | 2533 urls.push_back(FaviconURL( |
| 2529 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); | 2534 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 2530 } | 2535 } |
| 2531 SendUpdateFaviconURL(urls); | 2536 SendUpdateFaviconURL(urls); |
| 2532 } | 2537 } |
| 2533 | 2538 |
| 2534 void RenderViewImpl::didFinishDocumentLoad(WebFrame* frame) { | 2539 void RenderViewImpl::didFinishDocumentLoad(WebLocalFrame* frame) { |
| 2535 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2540 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2536 DidFinishDocumentLoad(frame)); | 2541 DidFinishDocumentLoad(frame)); |
| 2537 } | 2542 } |
| 2538 | 2543 |
| 2539 void RenderViewImpl::didHandleOnloadEvents(WebFrame* frame) { | 2544 void RenderViewImpl::didHandleOnloadEvents(WebLocalFrame* frame) { |
| 2540 if (webview()->mainFrame() == frame) { | 2545 if (webview()->mainFrame() == frame) { |
| 2541 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, | 2546 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, |
| 2542 page_id_)); | 2547 page_id_)); |
| 2543 } | 2548 } |
| 2544 } | 2549 } |
| 2545 | 2550 |
| 2546 void RenderViewImpl::didFailLoad(WebFrame* frame, const WebURLError& error) { | 2551 void RenderViewImpl::didFailLoad(WebLocalFrame* frame, |
| 2552 const WebURLError& error) { |
| 2547 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error)); | 2553 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error)); |
| 2548 } | 2554 } |
| 2549 | 2555 |
| 2550 void RenderViewImpl::didFinishLoad(WebFrame* frame) { | 2556 void RenderViewImpl::didFinishLoad(WebLocalFrame* frame) { |
| 2551 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); | 2557 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); |
| 2552 } | 2558 } |
| 2553 | 2559 |
| 2554 void RenderViewImpl::didNavigateWithinPage( | 2560 void RenderViewImpl::didNavigateWithinPage(WebLocalFrame* frame, |
| 2555 WebFrame* frame, | 2561 bool is_new_navigation) { |
| 2556 bool is_new_navigation) { | |
| 2557 // TODO(nasko): Forward calls to the main RenderFrameImpl until all | 2562 // TODO(nasko): Forward calls to the main RenderFrameImpl until all |
| 2558 // callers of this method on RenderView are removed. | 2563 // callers of this method on RenderView are removed. |
| 2559 main_render_frame_->didNavigateWithinPage(frame, is_new_navigation); | 2564 main_render_frame_->didNavigateWithinPage(frame, is_new_navigation); |
| 2560 } | 2565 } |
| 2561 | 2566 |
| 2562 void RenderViewImpl::didUpdateCurrentHistoryItem(WebFrame* frame) { | 2567 void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) { |
| 2563 StartNavStateSyncTimerIfNecessary(); | 2568 StartNavStateSyncTimerIfNecessary(); |
| 2564 } | 2569 } |
| 2565 | 2570 |
| 2566 void RenderViewImpl::willSendRequest(WebFrame* frame, | 2571 void RenderViewImpl::willSendRequest(WebLocalFrame* frame, |
| 2567 unsigned identifier, | 2572 unsigned identifier, |
| 2568 WebURLRequest& request, | 2573 WebURLRequest& request, |
| 2569 const WebURLResponse& redirect_response) { | 2574 const WebURLResponse& redirect_response) { |
| 2570 NOTREACHED(); | 2575 NOTREACHED(); |
| 2571 } | 2576 } |
| 2572 | 2577 |
| 2573 void RenderViewImpl::didReceiveResponse( | 2578 void RenderViewImpl::didReceiveResponse(WebLocalFrame* frame, |
| 2574 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { | 2579 unsigned identifier, |
| 2580 const WebURLResponse& response) { |
| 2575 NOTREACHED(); | 2581 NOTREACHED(); |
| 2576 } | 2582 } |
| 2577 | 2583 |
| 2578 void RenderViewImpl::didFinishResourceLoad( | 2584 void RenderViewImpl::didFinishResourceLoad(WebLocalFrame* frame, |
| 2579 WebFrame* frame, unsigned identifier) { | 2585 unsigned identifier) { |
| 2580 InternalDocumentStateData* internal_data = | 2586 InternalDocumentStateData* internal_data = |
| 2581 InternalDocumentStateData::FromDataSource(frame->dataSource()); | 2587 InternalDocumentStateData::FromDataSource(frame->dataSource()); |
| 2582 if (!internal_data->use_error_page()) | 2588 if (!internal_data->use_error_page()) |
| 2583 return; | 2589 return; |
| 2584 | 2590 |
| 2585 // Do not show error page when DevTools is attached. | 2591 // Do not show error page when DevTools is attached. |
| 2586 if (devtools_agent_->IsAttached()) | 2592 if (devtools_agent_->IsAttached()) |
| 2587 return; | 2593 return; |
| 2588 | 2594 |
| 2589 // Display error page, if appropriate. | 2595 // Display error page, if appropriate. |
| 2590 std::string error_domain = "http"; | 2596 std::string error_domain = "http"; |
| 2591 int http_status_code = internal_data->http_status_code(); | 2597 int http_status_code = internal_data->http_status_code(); |
| 2592 if (GetContentClient()->renderer()->HasErrorPage( | 2598 if (GetContentClient()->renderer()->HasErrorPage( |
| 2593 http_status_code, &error_domain)) { | 2599 http_status_code, &error_domain)) { |
| 2594 WebURLError error; | 2600 WebURLError error; |
| 2595 error.unreachableURL = frame->document().url(); | 2601 error.unreachableURL = frame->document().url(); |
| 2596 error.domain = WebString::fromUTF8(error_domain); | 2602 error.domain = WebString::fromUTF8(error_domain); |
| 2597 error.reason = http_status_code; | 2603 error.reason = http_status_code; |
| 2598 LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, true); | 2604 LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, true); |
| 2599 } | 2605 } |
| 2600 } | 2606 } |
| 2601 | 2607 |
| 2602 void RenderViewImpl::didLoadResourceFromMemoryCache( | 2608 void RenderViewImpl::didLoadResourceFromMemoryCache( |
| 2603 WebFrame* frame, const WebURLRequest& request, | 2609 WebLocalFrame* frame, |
| 2610 const WebURLRequest& request, |
| 2604 const WebURLResponse& response) { | 2611 const WebURLResponse& response) { |
| 2605 NOTREACHED(); | 2612 NOTREACHED(); |
| 2606 } | 2613 } |
| 2607 | 2614 |
| 2608 void RenderViewImpl::didDisplayInsecureContent(WebFrame* frame) { | 2615 void RenderViewImpl::didDisplayInsecureContent(WebLocalFrame* frame) { |
| 2609 NOTREACHED(); | 2616 NOTREACHED(); |
| 2610 } | 2617 } |
| 2611 | 2618 |
| 2612 void RenderViewImpl::didRunInsecureContent( | 2619 void RenderViewImpl::didRunInsecureContent(WebLocalFrame* frame, |
| 2613 WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) { | 2620 const WebSecurityOrigin& origin, |
| 2621 const WebURL& target) { |
| 2614 NOTREACHED(); | 2622 NOTREACHED(); |
| 2615 } | 2623 } |
| 2616 | 2624 |
| 2617 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, | 2625 void RenderViewImpl::didCreateScriptContext(WebLocalFrame* frame, |
| 2618 v8::Handle<v8::Context> context, | 2626 v8::Handle<v8::Context> context, |
| 2619 int extension_group, | 2627 int extension_group, |
| 2620 int world_id) { | 2628 int world_id) { |
| 2621 NOTREACHED(); | 2629 NOTREACHED(); |
| 2622 } | 2630 } |
| 2623 | 2631 |
| 2624 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, | 2632 void RenderViewImpl::willReleaseScriptContext(WebLocalFrame* frame, |
| 2625 v8::Handle<v8::Context> context, | 2633 v8::Handle<v8::Context> context, |
| 2626 int world_id) { | 2634 int world_id) { |
| 2627 NOTREACHED(); | 2635 NOTREACHED(); |
| 2628 } | 2636 } |
| 2629 | 2637 |
| 2630 void RenderViewImpl::CheckPreferredSize() { | 2638 void RenderViewImpl::CheckPreferredSize() { |
| 2631 // We don't always want to send the change messages over IPC, only if we've | 2639 // We don't always want to send the change messages over IPC, only if we've |
| 2632 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 2640 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
| 2633 // message. | 2641 // message. |
| 2634 if (!send_preferred_size_changes_ || !webview()) | 2642 if (!send_preferred_size_changes_ || !webview()) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 media_stream_dispatcher_, | 2685 media_stream_dispatcher_, |
| 2678 RenderThreadImpl::current()->GetMediaStreamDependencyFactory()); | 2686 RenderThreadImpl::current()->GetMediaStreamDependencyFactory()); |
| 2679 media_stream_client_ = media_stream_impl; | 2687 media_stream_client_ = media_stream_impl; |
| 2680 web_user_media_client_ = media_stream_impl; | 2688 web_user_media_client_ = media_stream_impl; |
| 2681 return true; | 2689 return true; |
| 2682 #else | 2690 #else |
| 2683 return false; | 2691 return false; |
| 2684 #endif | 2692 #endif |
| 2685 } | 2693 } |
| 2686 | 2694 |
| 2687 void RenderViewImpl::didChangeContentsSize(WebFrame* frame, | 2695 void RenderViewImpl::didChangeContentsSize(WebLocalFrame* frame, |
| 2688 const WebSize& size) { | 2696 const WebSize& size) { |
| 2689 if (webview()->mainFrame() != frame) | 2697 if (webview()->mainFrame() != frame) |
| 2690 return; | 2698 return; |
| 2691 WebView* frameView = frame->view(); | 2699 WebView* frameView = frame->view(); |
| 2692 if (!frameView) | 2700 if (!frameView) |
| 2693 return; | 2701 return; |
| 2694 | 2702 |
| 2695 bool has_horizontal_scrollbar = frame->hasHorizontalScrollbar(); | 2703 bool has_horizontal_scrollbar = frame->hasHorizontalScrollbar(); |
| 2696 bool has_vertical_scrollbar = frame->hasVerticalScrollbar(); | 2704 bool has_vertical_scrollbar = frame->hasVerticalScrollbar(); |
| 2697 | 2705 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2718 Send(new ViewHostMsg_DidChangeScrollOffsetPinningForMainFrame( | 2726 Send(new ViewHostMsg_DidChangeScrollOffsetPinningForMainFrame( |
| 2719 routing_id_, is_pinned_to_left, is_pinned_to_right)); | 2727 routing_id_, is_pinned_to_left, is_pinned_to_right)); |
| 2720 | 2728 |
| 2721 cached_is_main_frame_pinned_to_left_ = is_pinned_to_left; | 2729 cached_is_main_frame_pinned_to_left_ = is_pinned_to_left; |
| 2722 cached_is_main_frame_pinned_to_right_ = is_pinned_to_right; | 2730 cached_is_main_frame_pinned_to_right_ = is_pinned_to_right; |
| 2723 } | 2731 } |
| 2724 | 2732 |
| 2725 Send(new ViewHostMsg_DidChangeScrollOffset(routing_id_)); | 2733 Send(new ViewHostMsg_DidChangeScrollOffset(routing_id_)); |
| 2726 } | 2734 } |
| 2727 | 2735 |
| 2728 void RenderViewImpl::didChangeScrollOffset(WebFrame* frame) { | 2736 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { |
| 2729 StartNavStateSyncTimerIfNecessary(); | 2737 StartNavStateSyncTimerIfNecessary(); |
| 2730 | 2738 |
| 2731 if (webview()->mainFrame() == frame) | 2739 if (webview()->mainFrame() == frame) |
| 2732 UpdateScrollState(frame); | 2740 UpdateScrollState(frame); |
| 2733 | 2741 |
| 2734 FOR_EACH_OBSERVER( | 2742 FOR_EACH_OBSERVER( |
| 2735 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); | 2743 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); |
| 2736 } | 2744 } |
| 2737 | 2745 |
| 2738 void RenderViewImpl::willInsertBody(blink::WebFrame* frame) { | 2746 void RenderViewImpl::willInsertBody(blink::WebLocalFrame* frame) { |
| 2739 NOTREACHED(); | 2747 NOTREACHED(); |
| 2740 } | 2748 } |
| 2741 | 2749 |
| 2742 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebFrame* frame) { | 2750 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebLocalFrame* frame) { |
| 2743 if (frame != webview()->mainFrame()) | 2751 if (frame != webview()->mainFrame()) |
| 2744 return; | 2752 return; |
| 2745 | 2753 |
| 2746 InternalDocumentStateData* data = | 2754 InternalDocumentStateData* data = |
| 2747 InternalDocumentStateData::FromDataSource(frame->dataSource()); | 2755 InternalDocumentStateData::FromDataSource(frame->dataSource()); |
| 2748 data->set_did_first_visually_non_empty_layout(true); | 2756 data->set_did_first_visually_non_empty_layout(true); |
| 2749 | 2757 |
| 2750 #if defined(OS_ANDROID) | 2758 #if defined(OS_ANDROID) |
| 2751 // Update body background color if necessary. | 2759 // Update body background color if necessary. |
| 2752 SkColor bg_color = webwidget_->backgroundColor(); | 2760 SkColor bg_color = webwidget_->backgroundColor(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2783 NOTREACHED(); | 2791 NOTREACHED(); |
| 2784 } | 2792 } |
| 2785 | 2793 |
| 2786 void RenderViewImpl::reportFindInPageSelection(int request_id, | 2794 void RenderViewImpl::reportFindInPageSelection(int request_id, |
| 2787 int active_match_ordinal, | 2795 int active_match_ordinal, |
| 2788 const WebRect& selection_rect) { | 2796 const WebRect& selection_rect) { |
| 2789 NOTREACHED(); | 2797 NOTREACHED(); |
| 2790 } | 2798 } |
| 2791 | 2799 |
| 2792 void RenderViewImpl::requestStorageQuota( | 2800 void RenderViewImpl::requestStorageQuota( |
| 2793 WebFrame* frame, | 2801 WebLocalFrame* frame, |
| 2794 WebStorageQuotaType type, | 2802 WebStorageQuotaType type, |
| 2795 unsigned long long requested_size, | 2803 unsigned long long requested_size, |
| 2796 blink::WebStorageQuotaCallbacks callbacks) { | 2804 blink::WebStorageQuotaCallbacks callbacks) { |
| 2797 NOTREACHED(); | 2805 NOTREACHED(); |
| 2798 } | 2806 } |
| 2799 | 2807 |
| 2800 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | 2808 bool RenderViewImpl::willCheckAndDispatchMessageEvent( |
| 2801 blink::WebFrame* sourceFrame, | 2809 blink::WebLocalFrame* sourceFrame, |
| 2802 blink::WebFrame* targetFrame, | 2810 blink::WebFrame* targetFrame, |
| 2803 blink::WebSecurityOrigin target_origin, | 2811 blink::WebSecurityOrigin target_origin, |
| 2804 blink::WebDOMMessageEvent event) { | 2812 blink::WebDOMMessageEvent event) { |
| 2805 if (!is_swapped_out_) | 2813 if (!is_swapped_out_) |
| 2806 return false; | 2814 return false; |
| 2807 | 2815 |
| 2808 ViewMsg_PostMessage_Params params; | 2816 ViewMsg_PostMessage_Params params; |
| 2809 params.data = event.data().toString(); | 2817 params.data = event.data().toString(); |
| 2810 params.source_origin = event.origin(); | 2818 params.source_origin = event.origin(); |
| 2811 if (!target_origin.isNull()) | 2819 if (!target_origin.isNull()) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2838 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); | 2846 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); |
| 2839 return true; | 2847 return true; |
| 2840 } | 2848 } |
| 2841 | 2849 |
| 2842 void RenderViewImpl::willOpenSocketStream( | 2850 void RenderViewImpl::willOpenSocketStream( |
| 2843 WebSocketStreamHandle* handle) { | 2851 WebSocketStreamHandle* handle) { |
| 2844 NOTREACHED(); | 2852 NOTREACHED(); |
| 2845 } | 2853 } |
| 2846 | 2854 |
| 2847 void RenderViewImpl::willStartUsingPeerConnectionHandler( | 2855 void RenderViewImpl::willStartUsingPeerConnectionHandler( |
| 2848 blink::WebFrame* frame, blink::WebRTCPeerConnectionHandler* handler) { | 2856 blink::WebLocalFrame* frame, |
| 2857 blink::WebRTCPeerConnectionHandler* handler) { |
| 2849 NOTREACHED(); | 2858 NOTREACHED(); |
| 2850 } | 2859 } |
| 2851 | 2860 |
| 2852 blink::WebString RenderViewImpl::acceptLanguages() { | 2861 blink::WebString RenderViewImpl::acceptLanguages() { |
| 2853 return WebString::fromUTF8(renderer_preferences_.accept_languages); | 2862 return WebString::fromUTF8(renderer_preferences_.accept_languages); |
| 2854 } | 2863 } |
| 2855 | 2864 |
| 2856 blink::WebString RenderViewImpl::userAgentOverride( | 2865 blink::WebString RenderViewImpl::userAgentOverride(blink::WebLocalFrame* frame, |
| 2857 blink::WebFrame* frame, | 2866 const blink::WebURL& url) { |
| 2858 const blink::WebURL& url) { | |
| 2859 NOTREACHED(); | 2867 NOTREACHED(); |
| 2860 return blink::WebString(); | 2868 return blink::WebString(); |
| 2861 } | 2869 } |
| 2862 | 2870 |
| 2863 WebString RenderViewImpl::doNotTrackValue(WebFrame* frame) { | 2871 WebString RenderViewImpl::doNotTrackValue(WebLocalFrame* frame) { |
| 2864 NOTREACHED(); | 2872 NOTREACHED(); |
| 2865 return blink::WebString(); | 2873 return blink::WebString(); |
| 2866 } | 2874 } |
| 2867 | 2875 |
| 2868 bool RenderViewImpl::allowWebGL(WebFrame* frame, bool default_value) { | 2876 bool RenderViewImpl::allowWebGL(WebLocalFrame* frame, bool default_value) { |
| 2869 NOTREACHED(); | 2877 NOTREACHED(); |
| 2870 return false; | 2878 return false; |
| 2871 } | 2879 } |
| 2872 | 2880 |
| 2873 void RenderViewImpl::didLoseWebGLContext( | 2881 void RenderViewImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, |
| 2874 blink::WebFrame* frame, | 2882 int arb_robustness_status_code) { |
| 2875 int arb_robustness_status_code) { | |
| 2876 NOTREACHED(); | 2883 NOTREACHED(); |
| 2877 } | 2884 } |
| 2878 | 2885 |
| 2879 // blink::WebPageSerializerClient implementation ------------------------------ | 2886 // blink::WebPageSerializerClient implementation ------------------------------ |
| 2880 | 2887 |
| 2881 void RenderViewImpl::didSerializeDataForFrame( | 2888 void RenderViewImpl::didSerializeDataForFrame( |
| 2882 const WebURL& frame_url, | 2889 const WebURL& frame_url, |
| 2883 const WebCString& data, | 2890 const WebCString& data, |
| 2884 WebPageSerializerClient::PageSerializationStatus status) { | 2891 WebPageSerializerClient::PageSerializationStatus status) { |
| 2885 Send(new ViewHostMsg_SendSerializedHtmlData( | 2892 Send(new ViewHostMsg_SendSerializedHtmlData( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2976 } | 2983 } |
| 2977 | 2984 |
| 2978 float RenderViewImpl::GetFilteredTimePerFrame() const { | 2985 float RenderViewImpl::GetFilteredTimePerFrame() const { |
| 2979 return filtered_time_per_frame(); | 2986 return filtered_time_per_frame(); |
| 2980 } | 2987 } |
| 2981 | 2988 |
| 2982 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { | 2989 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { |
| 2983 return visibilityState(); | 2990 return visibilityState(); |
| 2984 } | 2991 } |
| 2985 | 2992 |
| 2986 void RenderViewImpl::RunModalAlertDialog(blink::WebFrame* frame, | 2993 void RenderViewImpl::RunModalAlertDialog(blink::WebLocalFrame* frame, |
| 2987 const blink::WebString& message) { | 2994 const blink::WebString& message) { |
| 2988 return runModalAlertDialog(frame, message); | 2995 return runModalAlertDialog(frame, message); |
| 2989 } | 2996 } |
| 2990 | 2997 |
| 2991 void RenderViewImpl::DidStartLoading() { | 2998 void RenderViewImpl::DidStartLoading() { |
| 2992 main_render_frame_->didStartLoading(true); | 2999 main_render_frame_->didStartLoading(true); |
| 2993 } | 3000 } |
| 2994 | 3001 |
| 2995 void RenderViewImpl::DidStopLoading() { | 3002 void RenderViewImpl::DidStopLoading() { |
| 2996 main_render_frame_->didStopLoading(); | 3003 main_render_frame_->didStopLoading(); |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3617 const base::FilePath& local_directory_name) { | 3624 const base::FilePath& local_directory_name) { |
| 3618 | 3625 |
| 3619 // Convert std::vector of GURLs to WebVector<WebURL> | 3626 // Convert std::vector of GURLs to WebVector<WebURL> |
| 3620 WebVector<WebURL> weburl_links(links); | 3627 WebVector<WebURL> weburl_links(links); |
| 3621 | 3628 |
| 3622 // Convert std::vector of base::FilePath to WebVector<WebString> | 3629 // Convert std::vector of base::FilePath to WebVector<WebString> |
| 3623 WebVector<WebString> webstring_paths(local_paths.size()); | 3630 WebVector<WebString> webstring_paths(local_paths.size()); |
| 3624 for (size_t i = 0; i < local_paths.size(); i++) | 3631 for (size_t i = 0; i < local_paths.size(); i++) |
| 3625 webstring_paths[i] = local_paths[i].AsUTF16Unsafe(); | 3632 webstring_paths[i] = local_paths[i].AsUTF16Unsafe(); |
| 3626 | 3633 |
| 3627 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, | 3634 WebPageSerializer::serialize(webview()->mainFrame()->toWebLocalFrame(), |
| 3635 true, |
| 3636 this, |
| 3637 weburl_links, |
| 3628 webstring_paths, | 3638 webstring_paths, |
| 3629 local_directory_name.AsUTF16Unsafe()); | 3639 local_directory_name.AsUTF16Unsafe()); |
| 3630 } | 3640 } |
| 3631 | 3641 |
| 3632 void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { | 3642 void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { |
| 3633 // Don't show any more dialogs until we finish OnSwapOut. | 3643 // Don't show any more dialogs until we finish OnSwapOut. |
| 3634 suppress_dialogs_until_swap_out_ = true; | 3644 suppress_dialogs_until_swap_out_ = true; |
| 3635 } | 3645 } |
| 3636 | 3646 |
| 3637 void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { | 3647 void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4099 it != plugin_delegates_.end(); ++it) { | 4109 it != plugin_delegates_.end(); ++it) { |
| 4100 (*it)->ImeCompositionCompleted(text, focused_plugin_id_); | 4110 (*it)->ImeCompositionCompleted(text, focused_plugin_id_); |
| 4101 } | 4111 } |
| 4102 return; | 4112 return; |
| 4103 } | 4113 } |
| 4104 #endif // OS_WIN | 4114 #endif // OS_WIN |
| 4105 #endif // ENABLE_PLUGINS | 4115 #endif // ENABLE_PLUGINS |
| 4106 if (replacement_range.IsValid() && webview()) { | 4116 if (replacement_range.IsValid() && webview()) { |
| 4107 // Select the text in |replacement_range|, it will then be replaced by | 4117 // Select the text in |replacement_range|, it will then be replaced by |
| 4108 // text added by the call to RenderWidget::OnImeConfirmComposition(). | 4118 // text added by the call to RenderWidget::OnImeConfirmComposition(). |
| 4109 if (WebFrame* frame = webview()->focusedFrame()) { | 4119 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) { |
| 4110 WebRange webrange = WebRange::fromDocumentRange( | 4120 WebRange webrange = WebRange::fromDocumentRange( |
| 4111 frame, replacement_range.start(), replacement_range.length()); | 4121 frame, replacement_range.start(), replacement_range.length()); |
| 4112 if (!webrange.isNull()) | 4122 if (!webrange.isNull()) |
| 4113 frame->selectRange(webrange); | 4123 frame->selectRange(webrange); |
| 4114 } | 4124 } |
| 4115 } | 4125 } |
| 4116 RenderWidget::OnImeConfirmComposition(text, | 4126 RenderWidget::OnImeConfirmComposition(text, |
| 4117 replacement_range, | 4127 replacement_range, |
| 4118 keep_selection); | 4128 keep_selection); |
| 4119 } | 4129 } |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4752 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); | 4762 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); |
| 4753 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4763 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4754 if (!url.isEmpty()) | 4764 if (!url.isEmpty()) |
| 4755 urls.push_back( | 4765 urls.push_back( |
| 4756 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4766 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4757 } | 4767 } |
| 4758 SendUpdateFaviconURL(urls); | 4768 SendUpdateFaviconURL(urls); |
| 4759 } | 4769 } |
| 4760 | 4770 |
| 4761 } // namespace content | 4771 } // namespace content |
| OLD | NEW |