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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 it->second.Run(size, png); | 1487 it->second.Run(size, png); |
1486 pending_snapshots_.erase(it++); | 1488 pending_snapshots_.erase(it++); |
1487 } else { | 1489 } else { |
1488 ++it; | 1490 ++it; |
1489 } | 1491 } |
1490 } | 1492 } |
1491 } | 1493 } |
1492 | 1494 |
1493 // blink::WebViewClient ------------------------------------------------------ | 1495 // blink::WebViewClient ------------------------------------------------------ |
1494 | 1496 |
1495 WebView* RenderViewImpl::createView( | 1497 WebView* RenderViewImpl::createView(WebLocalFrame* creator, |
1496 WebFrame* creator, | 1498 const WebURLRequest& request, |
1497 const WebURLRequest& request, | 1499 const WebWindowFeatures& features, |
1498 const WebWindowFeatures& features, | 1500 const WebString& frame_name, |
1499 const WebString& frame_name, | 1501 WebNavigationPolicy policy, |
1500 WebNavigationPolicy policy, | 1502 bool suppress_opener) { |
1501 bool suppress_opener) { | |
1502 ViewHostMsg_CreateWindow_Params params; | 1503 ViewHostMsg_CreateWindow_Params params; |
1503 params.opener_id = routing_id_; | 1504 params.opener_id = routing_id_; |
1504 params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 1505 params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
1505 if (GetContentClient()->renderer()->AllowPopup()) | 1506 if (GetContentClient()->renderer()->AllowPopup()) |
1506 params.user_gesture = true; | 1507 params.user_gesture = true; |
1507 params.window_container_type = WindowFeaturesToContainerType(features); | 1508 params.window_container_type = WindowFeaturesToContainerType(features); |
1508 params.session_storage_namespace_id = session_storage_namespace_id_; | 1509 params.session_storage_namespace_id = session_storage_namespace_id_; |
1509 if (frame_name != "_blank") | 1510 if (frame_name != "_blank") |
1510 params.frame_name = frame_name; | 1511 params.frame_name = frame_name; |
1511 params.opener_render_frame_id = | 1512 params.opener_render_frame_id = |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 static_cast<int32>(log_severity))); | 1666 static_cast<int32>(log_severity))); |
1666 } | 1667 } |
1667 | 1668 |
1668 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, | 1669 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, |
1669 static_cast<int32>(log_severity), | 1670 static_cast<int32>(log_severity), |
1670 message.text, | 1671 message.text, |
1671 static_cast<int32>(source_line), | 1672 static_cast<int32>(source_line), |
1672 source_name)); | 1673 source_name)); |
1673 } | 1674 } |
1674 | 1675 |
1675 void RenderViewImpl::printPage(WebFrame* frame) { | 1676 void RenderViewImpl::printPage(WebLocalFrame* frame) { |
1676 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1677 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
1677 PrintPage(frame, handling_input_event_)); | 1678 PrintPage(frame, handling_input_event_)); |
1678 } | 1679 } |
1679 | 1680 |
1680 blink::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { | 1681 blink::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { |
1681 return notification_provider_; | 1682 return notification_provider_; |
1682 } | 1683 } |
1683 | 1684 |
1684 bool RenderViewImpl::enumerateChosenDirectory( | 1685 bool RenderViewImpl::enumerateChosenDirectory( |
1685 const WebString& path, | 1686 const WebString& path, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 ipc_params.accept_types.reserve(params.acceptTypes.size()); | 1799 ipc_params.accept_types.reserve(params.acceptTypes.size()); |
1799 for (size_t i = 0; i < params.acceptTypes.size(); ++i) | 1800 for (size_t i = 0; i < params.acceptTypes.size(); ++i) |
1800 ipc_params.accept_types.push_back(params.acceptTypes[i]); | 1801 ipc_params.accept_types.push_back(params.acceptTypes[i]); |
1801 #if defined(OS_ANDROID) | 1802 #if defined(OS_ANDROID) |
1802 ipc_params.capture = params.useMediaCapture; | 1803 ipc_params.capture = params.useMediaCapture; |
1803 #endif | 1804 #endif |
1804 | 1805 |
1805 return ScheduleFileChooser(ipc_params, chooser_completion); | 1806 return ScheduleFileChooser(ipc_params, chooser_completion); |
1806 } | 1807 } |
1807 | 1808 |
1808 void RenderViewImpl::runModalAlertDialog(WebFrame* frame, | 1809 void RenderViewImpl::runModalAlertDialog(WebLocalFrame* frame, |
1809 const WebString& message) { | 1810 const WebString& message) { |
1810 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, | 1811 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, |
1811 message, | 1812 message, |
1812 base::string16(), | 1813 base::string16(), |
1813 frame->document().url(), | 1814 frame->document().url(), |
1814 NULL); | 1815 NULL); |
1815 } | 1816 } |
1816 | 1817 |
1817 bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, | 1818 bool RenderViewImpl::runModalConfirmDialog(WebLocalFrame* frame, |
1818 const WebString& message) { | 1819 const WebString& message) { |
1819 return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, | 1820 return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, |
1820 message, | 1821 message, |
1821 base::string16(), | 1822 base::string16(), |
1822 frame->document().url(), | 1823 frame->document().url(), |
1823 NULL); | 1824 NULL); |
1824 } | 1825 } |
1825 | 1826 |
1826 bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, | 1827 bool RenderViewImpl::runModalPromptDialog(WebLocalFrame* frame, |
1827 const WebString& message, | 1828 const WebString& message, |
1828 const WebString& default_value, | 1829 const WebString& default_value, |
1829 WebString* actual_value) { | 1830 WebString* actual_value) { |
1830 base::string16 result; | 1831 base::string16 result; |
1831 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, | 1832 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, |
1832 message, | 1833 message, |
1833 default_value, | 1834 default_value, |
1834 frame->document().url(), | 1835 frame->document().url(), |
1835 &result); | 1836 &result); |
1836 if (ok) | 1837 if (ok) |
1837 actual_value->assign(result); | 1838 actual_value->assign(result); |
1838 return ok; | 1839 return ok; |
1839 } | 1840 } |
1840 | 1841 |
1841 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1842 bool RenderViewImpl::runModalBeforeUnloadDialog(WebLocalFrame* frame, |
1842 WebFrame* frame, const WebString& message) { | 1843 const WebString& message) { |
1843 bool is_reload = false; | 1844 bool is_reload = false; |
1844 WebDataSource* ds = frame->provisionalDataSource(); | 1845 WebDataSource* ds = frame->provisionalDataSource(); |
1845 if (ds) | 1846 if (ds) |
1846 is_reload = (ds->navigationType() == blink::WebNavigationTypeReload); | 1847 is_reload = (ds->navigationType() == blink::WebNavigationTypeReload); |
1847 return runModalBeforeUnloadDialog(frame, is_reload, message); | 1848 return runModalBeforeUnloadDialog(frame, is_reload, message); |
1848 } | 1849 } |
1849 | 1850 |
1850 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1851 bool RenderViewImpl::runModalBeforeUnloadDialog(WebLocalFrame* frame, |
1851 WebFrame* frame, bool is_reload, const WebString& message) { | 1852 bool is_reload, |
| 1853 const WebString& message) { |
1852 // If we are swapping out, we have already run the beforeunload handler. | 1854 // If we are swapping out, we have already run the beforeunload handler. |
1853 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload | 1855 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload |
1854 // at all, to avoid running it twice. | 1856 // at all, to avoid running it twice. |
1855 if (is_swapped_out_) | 1857 if (is_swapped_out_) |
1856 return true; | 1858 return true; |
1857 | 1859 |
1858 // Don't allow further dialogs if we are waiting to swap out, since the | 1860 // Don't allow further dialogs if we are waiting to swap out, since the |
1859 // PageGroupLoadDeferrer in our stack prevents it. | 1861 // PageGroupLoadDeferrer in our stack prevents it. |
1860 if (suppress_dialogs_until_swap_out_) | 1862 if (suppress_dialogs_until_swap_out_) |
1861 return false; | 1863 return false; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 void RenderViewImpl::setMouseOverURL(const WebURL& url) { | 1971 void RenderViewImpl::setMouseOverURL(const WebURL& url) { |
1970 mouse_over_url_ = GURL(url); | 1972 mouse_over_url_ = GURL(url); |
1971 UpdateTargetURL(mouse_over_url_, focus_url_); | 1973 UpdateTargetURL(mouse_over_url_, focus_url_); |
1972 } | 1974 } |
1973 | 1975 |
1974 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { | 1976 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { |
1975 focus_url_ = GURL(url); | 1977 focus_url_ = GURL(url); |
1976 UpdateTargetURL(focus_url_, mouse_over_url_); | 1978 UpdateTargetURL(focus_url_, mouse_over_url_); |
1977 } | 1979 } |
1978 | 1980 |
1979 void RenderViewImpl::startDragging(WebFrame* frame, | 1981 void RenderViewImpl::startDragging(WebLocalFrame* frame, |
1980 const WebDragData& data, | 1982 const WebDragData& data, |
1981 WebDragOperationsMask mask, | 1983 WebDragOperationsMask mask, |
1982 const WebImage& image, | 1984 const WebImage& image, |
1983 const WebPoint& webImageOffset) { | 1985 const WebPoint& webImageOffset) { |
1984 DropData drop_data(DropDataBuilder::Build(data)); | 1986 DropData drop_data(DropDataBuilder::Build(data)); |
1985 drop_data.referrer_policy = frame->document().referrerPolicy(); | 1987 drop_data.referrer_policy = frame->document().referrerPolicy(); |
1986 gfx::Vector2d imageOffset(webImageOffset.x, webImageOffset.y); | 1988 gfx::Vector2d imageOffset(webImageOffset.x, webImageOffset.y); |
1987 Send(new DragHostMsg_StartDragging(routing_id_, | 1989 Send(new DragHostMsg_StartDragging(routing_id_, |
1988 drop_data, | 1990 drop_data, |
1989 mask, | 1991 mask, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 RenderWidget::initializeLayerTreeView(); | 2214 RenderWidget::initializeLayerTreeView(); |
2213 RenderWidgetCompositor* rwc = compositor(); | 2215 RenderWidgetCompositor* rwc = compositor(); |
2214 if (!rwc || !webview() || !webview()->devToolsAgent()) | 2216 if (!rwc || !webview() || !webview()->devToolsAgent()) |
2215 return; | 2217 return; |
2216 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 2218 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
2217 } | 2219 } |
2218 | 2220 |
2219 // blink::WebFrameClient ----------------------------------------------------- | 2221 // blink::WebFrameClient ----------------------------------------------------- |
2220 | 2222 |
2221 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2223 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
2222 WebFrame* frame, const blink::WebURL& url, WebMediaPlayerClient* client) { | 2224 WebLocalFrame* frame, |
| 2225 const blink::WebURL& url, |
| 2226 WebMediaPlayerClient* client) { |
2223 NOTREACHED(); | 2227 NOTREACHED(); |
2224 return NULL; | 2228 return NULL; |
2225 } | 2229 } |
2226 | 2230 |
2227 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( | 2231 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( |
2228 RenderFrame* render_frame, | 2232 RenderFrame* render_frame, |
2229 blink::WebFrame* frame, | 2233 blink::WebLocalFrame* frame, |
2230 const blink::WebURL& url, | 2234 const blink::WebURL& url, |
2231 blink::WebMediaPlayerClient* client) { | 2235 blink::WebMediaPlayerClient* client) { |
2232 FOR_EACH_OBSERVER( | 2236 FOR_EACH_OBSERVER( |
2233 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2237 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
2234 | 2238 |
2235 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, | 2239 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, |
2236 client); | 2240 client); |
2237 if (player) | 2241 if (player) |
2238 return player; | 2242 return player; |
2239 | 2243 |
2240 #if defined(OS_ANDROID) | 2244 #if defined(OS_ANDROID) |
2241 return CreateAndroidWebMediaPlayer(frame, url, client); | 2245 return CreateAndroidWebMediaPlayer(frame, url, client); |
2242 #else | 2246 #else |
2243 WebMediaPlayerParams params( | 2247 WebMediaPlayerParams params( |
2244 base::Bind(&ContentRendererClient::DeferMediaLoad, | 2248 base::Bind(&ContentRendererClient::DeferMediaLoad, |
2245 base::Unretained(GetContentClient()->renderer()), | 2249 base::Unretained(GetContentClient()->renderer()), |
2246 static_cast<RenderFrame*>(render_frame)), | 2250 static_cast<RenderFrame*>(render_frame)), |
2247 RenderThreadImpl::current()->GetAudioRendererMixerManager()->CreateInput( | 2251 RenderThreadImpl::current()->GetAudioRendererMixerManager()->CreateInput( |
2248 routing_id_, render_frame->GetRoutingID())); | 2252 routing_id_, render_frame->GetRoutingID())); |
2249 return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params); | 2253 return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params); |
2250 #endif // defined(OS_ANDROID) | 2254 #endif // defined(OS_ANDROID) |
2251 } | 2255 } |
2252 | 2256 |
2253 void RenderViewImpl::didAccessInitialDocument(WebFrame* frame) { | 2257 void RenderViewImpl::didAccessInitialDocument(WebLocalFrame* frame) { |
2254 // Notify the browser process that it is no longer safe to show the pending | 2258 // Notify the browser process that it is no longer safe to show the pending |
2255 // URL of the main frame, since a URL spoof is now possible. | 2259 // URL of the main frame, since a URL spoof is now possible. |
2256 if (!frame->parent() && page_id_ == -1) | 2260 if (!frame->parent() && page_id_ == -1) |
2257 Send(new ViewHostMsg_DidAccessInitialDocument(routing_id_)); | 2261 Send(new ViewHostMsg_DidAccessInitialDocument(routing_id_)); |
2258 } | 2262 } |
2259 | 2263 |
2260 void RenderViewImpl::didDisownOpener(blink::WebFrame* frame) { | 2264 void RenderViewImpl::didDisownOpener(blink::WebLocalFrame* frame) { |
2261 // We only need to notify the browser if the active, top-level frame clears | 2265 // We only need to notify the browser if the active, top-level frame clears |
2262 // its opener. We can ignore cases where a swapped out frame clears its | 2266 // its opener. We can ignore cases where a swapped out frame clears its |
2263 // opener after hearing about it from the browser, and the browser does not | 2267 // opener after hearing about it from the browser, and the browser does not |
2264 // (yet) care about subframe openers. | 2268 // (yet) care about subframe openers. |
2265 if (is_swapped_out_ || frame->parent()) | 2269 if (is_swapped_out_ || frame->parent()) |
2266 return; | 2270 return; |
2267 | 2271 |
2268 // Notify WebContents and all its swapped out RenderViews. | 2272 // Notify WebContents and all its swapped out RenderViews. |
2269 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); | 2273 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); |
2270 } | 2274 } |
2271 | 2275 |
2272 void RenderViewImpl::frameDetached(WebFrame* frame) { | 2276 void RenderViewImpl::frameDetached(WebFrame* frame) { |
2273 // NOTE: We may get here for either the main frame or for subframes. The | 2277 // NOTE: We may get here for either the main frame or for subframes. The |
2274 // RenderFrameImpl will be deleted immediately after this call for subframes | 2278 // RenderFrameImpl will be deleted immediately after this call for subframes |
2275 // but not for the main frame, which is owned by |main_render_frame_|. | 2279 // but not for the main frame, which is owned by |main_render_frame_|. |
2276 | 2280 |
2277 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); | 2281 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); |
2278 } | 2282 } |
2279 | 2283 |
2280 void RenderViewImpl::willClose(WebFrame* frame) { | 2284 void RenderViewImpl::willClose(WebFrame* frame) { |
2281 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); | 2285 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); |
2282 } | 2286 } |
2283 | 2287 |
2284 void RenderViewImpl::didMatchCSS( | 2288 void RenderViewImpl::didMatchCSS( |
2285 WebFrame* frame, | 2289 WebLocalFrame* frame, |
2286 const WebVector<WebString>& newly_matching_selectors, | 2290 const WebVector<WebString>& newly_matching_selectors, |
2287 const WebVector<WebString>& stopped_matching_selectors) { | 2291 const WebVector<WebString>& stopped_matching_selectors) { |
2288 FOR_EACH_OBSERVER( | 2292 FOR_EACH_OBSERVER( |
2289 RenderViewObserver, observers_, | 2293 RenderViewObserver, observers_, |
2290 DidMatchCSS(frame, newly_matching_selectors, stopped_matching_selectors)); | 2294 DidMatchCSS(frame, newly_matching_selectors, stopped_matching_selectors)); |
2291 } | 2295 } |
2292 | 2296 |
2293 void RenderViewImpl::Repaint(const gfx::Size& size) { | 2297 void RenderViewImpl::Repaint(const gfx::Size& size) { |
2294 OnRepaint(size); | 2298 OnRepaint(size); |
2295 } | 2299 } |
(...skipping 21 matching lines...) Expand all Loading... |
2317 &ssl_status.security_bits, | 2321 &ssl_status.security_bits, |
2318 &ssl_status.connection_status, | 2322 &ssl_status.connection_status, |
2319 &ssl_status.signed_certificate_timestamp_ids); | 2323 &ssl_status.signed_certificate_timestamp_ids); |
2320 return ssl_status; | 2324 return ssl_status; |
2321 } | 2325 } |
2322 | 2326 |
2323 const std::string& RenderViewImpl::GetAcceptLanguages() const { | 2327 const std::string& RenderViewImpl::GetAcceptLanguages() const { |
2324 return renderer_preferences_.accept_languages; | 2328 return renderer_preferences_.accept_languages; |
2325 } | 2329 } |
2326 | 2330 |
2327 void RenderViewImpl::willSendSubmitEvent(blink::WebFrame* frame, | 2331 void RenderViewImpl::willSendSubmitEvent(blink::WebLocalFrame* frame, |
2328 const blink::WebFormElement& form) { | 2332 const blink::WebFormElement& form) { |
2329 FOR_EACH_OBSERVER( | 2333 FOR_EACH_OBSERVER( |
2330 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); | 2334 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); |
2331 } | 2335 } |
2332 | 2336 |
2333 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 2337 void RenderViewImpl::willSubmitForm(WebLocalFrame* frame, |
2334 const WebFormElement& form) { | 2338 const WebFormElement& form) { |
2335 FOR_EACH_OBSERVER( | 2339 FOR_EACH_OBSERVER( |
2336 RenderViewObserver, observers_, WillSubmitForm(frame, form)); | 2340 RenderViewObserver, observers_, WillSubmitForm(frame, form)); |
2337 } | 2341 } |
2338 | 2342 |
2339 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { | 2343 void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame, |
| 2344 WebDataSource* ds) { |
2340 bool content_initiated = !pending_navigation_params_.get(); | 2345 bool content_initiated = !pending_navigation_params_.get(); |
2341 | 2346 |
2342 // Make sure any previous redirect URLs end up in our new data source. | 2347 // Make sure any previous redirect URLs end up in our new data source. |
2343 if (pending_navigation_params_.get()) { | 2348 if (pending_navigation_params_.get()) { |
2344 for (std::vector<GURL>::const_iterator i = | 2349 for (std::vector<GURL>::const_iterator i = |
2345 pending_navigation_params_->redirects.begin(); | 2350 pending_navigation_params_->redirects.begin(); |
2346 i != pending_navigation_params_->redirects.end(); ++i) { | 2351 i != pending_navigation_params_->redirects.end(); ++i) { |
2347 ds->appendRedirect(*i); | 2352 ds->appendRedirect(*i); |
2348 } | 2353 } |
2349 } | 2354 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 | 2512 |
2508 // When navigating to a new page, reset the page scale factor to be 1.0. | 2513 // When navigating to a new page, reset the page scale factor to be 1.0. |
2509 webview()->setInitialPageScaleOverride(1.f); | 2514 webview()->setInitialPageScaleOverride(1.f); |
2510 | 2515 |
2511 float maxPageScaleFactor = | 2516 float maxPageScaleFactor = |
2512 command_line.HasSwitch(switches::kEnablePinch) ? 4.f : 1.f ; | 2517 command_line.HasSwitch(switches::kEnablePinch) ? 4.f : 1.f ; |
2513 webview()->setPageScaleFactorLimits(1, maxPageScaleFactor); | 2518 webview()->setPageScaleFactorLimits(1, maxPageScaleFactor); |
2514 } | 2519 } |
2515 | 2520 |
2516 // TODO(nasko): Remove this method once WebTestProxy in Blink is fixed. | 2521 // TODO(nasko): Remove this method once WebTestProxy in Blink is fixed. |
2517 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { | 2522 void RenderViewImpl::didStartProvisionalLoad(WebLocalFrame* frame) {} |
2518 } | |
2519 | 2523 |
2520 void RenderViewImpl::didFailProvisionalLoad(WebFrame* frame, | 2524 void RenderViewImpl::didFailProvisionalLoad(WebLocalFrame* frame, |
2521 const WebURLError& error) { | 2525 const WebURLError& error) { |
2522 // Notify the browser that we failed a provisional load with an error. | 2526 // Notify the browser that we failed a provisional load with an error. |
2523 // | 2527 // |
2524 // Note: It is important this notification occur before DidStopLoading so the | 2528 // Note: It is important this notification occur before DidStopLoading so the |
2525 // SSL manager can react to the provisional load failure before being | 2529 // SSL manager can react to the provisional load failure before being |
2526 // notified the load stopped. | 2530 // notified the load stopped. |
2527 // | 2531 // |
2528 FOR_EACH_OBSERVER( | 2532 FOR_EACH_OBSERVER( |
2529 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); | 2533 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); |
2530 } | 2534 } |
2531 | 2535 |
2532 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, | 2536 void RenderViewImpl::didCommitProvisionalLoad(WebLocalFrame* frame, |
2533 bool is_new_navigation) { | 2537 bool is_new_navigation) { |
2534 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2538 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
2535 DidCommitProvisionalLoad(frame, is_new_navigation)); | 2539 DidCommitProvisionalLoad(frame, is_new_navigation)); |
2536 | 2540 |
2537 // TODO(nasko): Transition this code to RenderFrameImpl, since g_view_map is | 2541 // TODO(nasko): Transition this code to RenderFrameImpl, since g_view_map is |
2538 // not accessible from there. | 2542 // not accessible from there. |
2539 if (!frame->parent()) { // Only for top frames. | 2543 if (!frame->parent()) { // Only for top frames. |
2540 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); | 2544 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
2541 if (render_thread_impl) { // Can be NULL in tests. | 2545 if (render_thread_impl) { // Can be NULL in tests. |
2542 render_thread_impl->histogram_customizer()-> | 2546 render_thread_impl->histogram_customizer()-> |
2543 RenderViewNavigatedToHost(GURL(GetLoadingUrl(frame)).host(), | 2547 RenderViewNavigatedToHost(GURL(GetLoadingUrl(frame)).host(), |
2544 g_view_map.Get().size()); | 2548 g_view_map.Get().size()); |
2545 } | 2549 } |
2546 } | 2550 } |
2547 } | 2551 } |
2548 | 2552 |
2549 void RenderViewImpl::didClearWindowObject(WebFrame* frame, int world_id) { | 2553 void RenderViewImpl::didClearWindowObject(WebLocalFrame* frame, int world_id) { |
2550 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2554 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
2551 DidClearWindowObject(frame, world_id)); | 2555 DidClearWindowObject(frame, world_id)); |
2552 | 2556 |
2553 // Only install controllers into the main world. | 2557 // Only install controllers into the main world. |
2554 if (world_id) | 2558 if (world_id) |
2555 return; | 2559 return; |
2556 | 2560 |
2557 if (enabled_bindings_& BINDINGS_POLICY_WEB_UI) | 2561 if (enabled_bindings_& BINDINGS_POLICY_WEB_UI) |
2558 WebUIExtension::Install(frame); | 2562 WebUIExtension::Install(frame); |
2559 | 2563 |
2560 if (enabled_bindings_ & BINDINGS_POLICY_STATS_COLLECTION) | 2564 if (enabled_bindings_ & BINDINGS_POLICY_STATS_COLLECTION) |
2561 StatsCollectionController::Install(frame); | 2565 StatsCollectionController::Install(frame); |
2562 | 2566 |
2563 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2567 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
2564 | 2568 |
2565 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) | 2569 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) |
2566 SkiaBenchmarking::Install(frame); | 2570 SkiaBenchmarking::Install(frame); |
2567 | 2571 |
2568 if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) | 2572 if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) |
2569 MemoryBenchmarkingExtension::Install(frame); | 2573 MemoryBenchmarkingExtension::Install(frame); |
2570 } | 2574 } |
2571 | 2575 |
2572 void RenderViewImpl::didCreateDocumentElement(WebFrame* frame) { | 2576 void RenderViewImpl::didCreateDocumentElement(WebLocalFrame* frame) { |
2573 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2577 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
2574 DidCreateDocumentElement(frame)); | 2578 DidCreateDocumentElement(frame)); |
2575 } | 2579 } |
2576 | 2580 |
2577 void RenderViewImpl::didReceiveTitle(WebFrame* frame, const WebString& title, | 2581 void RenderViewImpl::didReceiveTitle(WebLocalFrame* frame, |
| 2582 const WebString& title, |
2578 WebTextDirection direction) { | 2583 WebTextDirection direction) { |
2579 UpdateTitle(frame, title, direction); | 2584 UpdateTitle(frame, title, direction); |
2580 | 2585 |
2581 // Also check whether we have new encoding name. | 2586 // Also check whether we have new encoding name. |
2582 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2587 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
2583 } | 2588 } |
2584 | 2589 |
2585 void RenderViewImpl::didChangeIcon(WebFrame* frame, | 2590 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
2586 WebIconURL::Type icon_type) { | 2591 WebIconURL::Type icon_type) { |
2587 if (frame->parent()) | 2592 if (frame->parent()) |
2588 return; | 2593 return; |
2589 | 2594 |
2590 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) | 2595 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) |
2591 return; | 2596 return; |
2592 | 2597 |
2593 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2598 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
2594 std::vector<FaviconURL> urls; | 2599 std::vector<FaviconURL> urls; |
2595 for (size_t i = 0; i < icon_urls.size(); i++) { | 2600 for (size_t i = 0; i < icon_urls.size(); i++) { |
2596 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); | 2601 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); |
2597 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 2602 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
2598 urls.push_back(FaviconURL( | 2603 urls.push_back(FaviconURL( |
2599 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); | 2604 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); |
2600 } | 2605 } |
2601 SendUpdateFaviconURL(urls); | 2606 SendUpdateFaviconURL(urls); |
2602 } | 2607 } |
2603 | 2608 |
2604 void RenderViewImpl::didFinishDocumentLoad(WebFrame* frame) { | 2609 void RenderViewImpl::didFinishDocumentLoad(WebLocalFrame* frame) { |
2605 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2610 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
2606 DidFinishDocumentLoad(frame)); | 2611 DidFinishDocumentLoad(frame)); |
2607 } | 2612 } |
2608 | 2613 |
2609 void RenderViewImpl::didHandleOnloadEvents(WebFrame* frame) { | 2614 void RenderViewImpl::didHandleOnloadEvents(WebLocalFrame* frame) { |
2610 if (webview()->mainFrame() == frame) { | 2615 if (webview()->mainFrame() == frame) { |
2611 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, | 2616 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, |
2612 page_id_)); | 2617 page_id_)); |
2613 } | 2618 } |
2614 } | 2619 } |
2615 | 2620 |
2616 void RenderViewImpl::didFailLoad(WebFrame* frame, const WebURLError& error) { | 2621 void RenderViewImpl::didFailLoad(WebLocalFrame* frame, |
| 2622 const WebURLError& error) { |
2617 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error)); | 2623 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error)); |
2618 } | 2624 } |
2619 | 2625 |
2620 void RenderViewImpl::didFinishLoad(WebFrame* frame) { | 2626 void RenderViewImpl::didFinishLoad(WebLocalFrame* frame) { |
2621 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); | 2627 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); |
2622 } | 2628 } |
2623 | 2629 |
2624 void RenderViewImpl::didNavigateWithinPage( | 2630 void RenderViewImpl::didNavigateWithinPage(WebLocalFrame* frame, |
2625 WebFrame* frame, | 2631 bool is_new_navigation) { |
2626 bool is_new_navigation) { | |
2627 // TODO(nasko): Forward calls to the main RenderFrameImpl until all | 2632 // TODO(nasko): Forward calls to the main RenderFrameImpl until all |
2628 // callers of this method on RenderView are removed. | 2633 // callers of this method on RenderView are removed. |
2629 main_render_frame_->didNavigateWithinPage(frame, is_new_navigation); | 2634 main_render_frame_->didNavigateWithinPage(frame, is_new_navigation); |
2630 } | 2635 } |
2631 | 2636 |
2632 void RenderViewImpl::didUpdateCurrentHistoryItem(WebFrame* frame) { | 2637 void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) { |
2633 StartNavStateSyncTimerIfNecessary(); | 2638 StartNavStateSyncTimerIfNecessary(); |
2634 } | 2639 } |
2635 | 2640 |
2636 void RenderViewImpl::willSendRequest(WebFrame* frame, | 2641 void RenderViewImpl::willSendRequest(WebLocalFrame* frame, |
2637 unsigned identifier, | 2642 unsigned identifier, |
2638 WebURLRequest& request, | 2643 WebURLRequest& request, |
2639 const WebURLResponse& redirect_response) { | 2644 const WebURLResponse& redirect_response) { |
2640 NOTREACHED(); | 2645 NOTREACHED(); |
2641 } | 2646 } |
2642 | 2647 |
2643 void RenderViewImpl::didReceiveResponse( | 2648 void RenderViewImpl::didReceiveResponse(WebLocalFrame* frame, |
2644 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { | 2649 unsigned identifier, |
| 2650 const WebURLResponse& response) { |
2645 NOTREACHED(); | 2651 NOTREACHED(); |
2646 } | 2652 } |
2647 | 2653 |
2648 void RenderViewImpl::didFinishResourceLoad( | 2654 void RenderViewImpl::didFinishResourceLoad(WebLocalFrame* frame, |
2649 WebFrame* frame, unsigned identifier) { | 2655 unsigned identifier) { |
2650 InternalDocumentStateData* internal_data = | 2656 InternalDocumentStateData* internal_data = |
2651 InternalDocumentStateData::FromDataSource(frame->dataSource()); | 2657 InternalDocumentStateData::FromDataSource(frame->dataSource()); |
2652 if (!internal_data->use_error_page()) | 2658 if (!internal_data->use_error_page()) |
2653 return; | 2659 return; |
2654 | 2660 |
2655 // Do not show error page when DevTools is attached. | 2661 // Do not show error page when DevTools is attached. |
2656 if (devtools_agent_->IsAttached()) | 2662 if (devtools_agent_->IsAttached()) |
2657 return; | 2663 return; |
2658 | 2664 |
2659 // Display error page, if appropriate. | 2665 // Display error page, if appropriate. |
2660 std::string error_domain = "http"; | 2666 std::string error_domain = "http"; |
2661 int http_status_code = internal_data->http_status_code(); | 2667 int http_status_code = internal_data->http_status_code(); |
2662 if (GetContentClient()->renderer()->HasErrorPage( | 2668 if (GetContentClient()->renderer()->HasErrorPage( |
2663 http_status_code, &error_domain)) { | 2669 http_status_code, &error_domain)) { |
2664 WebURLError error; | 2670 WebURLError error; |
2665 error.unreachableURL = frame->document().url(); | 2671 error.unreachableURL = frame->document().url(); |
2666 error.domain = WebString::fromUTF8(error_domain); | 2672 error.domain = WebString::fromUTF8(error_domain); |
2667 error.reason = http_status_code; | 2673 error.reason = http_status_code; |
2668 LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, true); | 2674 LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, true); |
2669 } | 2675 } |
2670 } | 2676 } |
2671 | 2677 |
2672 void RenderViewImpl::didLoadResourceFromMemoryCache( | 2678 void RenderViewImpl::didLoadResourceFromMemoryCache( |
2673 WebFrame* frame, const WebURLRequest& request, | 2679 WebLocalFrame* frame, |
| 2680 const WebURLRequest& request, |
2674 const WebURLResponse& response) { | 2681 const WebURLResponse& response) { |
2675 NOTREACHED(); | 2682 NOTREACHED(); |
2676 } | 2683 } |
2677 | 2684 |
2678 void RenderViewImpl::didDisplayInsecureContent(WebFrame* frame) { | 2685 void RenderViewImpl::didDisplayInsecureContent(WebLocalFrame* frame) { |
2679 NOTREACHED(); | 2686 NOTREACHED(); |
2680 } | 2687 } |
2681 | 2688 |
2682 void RenderViewImpl::didRunInsecureContent( | 2689 void RenderViewImpl::didRunInsecureContent(WebLocalFrame* frame, |
2683 WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) { | 2690 const WebSecurityOrigin& origin, |
| 2691 const WebURL& target) { |
2684 NOTREACHED(); | 2692 NOTREACHED(); |
2685 } | 2693 } |
2686 | 2694 |
2687 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, | 2695 void RenderViewImpl::didCreateScriptContext(WebLocalFrame* frame, |
2688 v8::Handle<v8::Context> context, | 2696 v8::Handle<v8::Context> context, |
2689 int extension_group, | 2697 int extension_group, |
2690 int world_id) { | 2698 int world_id) { |
2691 NOTREACHED(); | 2699 NOTREACHED(); |
2692 } | 2700 } |
2693 | 2701 |
2694 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, | 2702 void RenderViewImpl::willReleaseScriptContext(WebLocalFrame* frame, |
2695 v8::Handle<v8::Context> context, | 2703 v8::Handle<v8::Context> context, |
2696 int world_id) { | 2704 int world_id) { |
2697 NOTREACHED(); | 2705 NOTREACHED(); |
2698 } | 2706 } |
2699 | 2707 |
2700 void RenderViewImpl::CheckPreferredSize() { | 2708 void RenderViewImpl::CheckPreferredSize() { |
2701 // We don't always want to send the change messages over IPC, only if we've | 2709 // We don't always want to send the change messages over IPC, only if we've |
2702 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 2710 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
2703 // message. | 2711 // message. |
2704 if (!send_preferred_size_changes_ || !webview()) | 2712 if (!send_preferred_size_changes_ || !webview()) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 media_stream_dispatcher_, | 2755 media_stream_dispatcher_, |
2748 RenderThreadImpl::current()->GetMediaStreamDependencyFactory()); | 2756 RenderThreadImpl::current()->GetMediaStreamDependencyFactory()); |
2749 media_stream_client_ = media_stream_impl; | 2757 media_stream_client_ = media_stream_impl; |
2750 web_user_media_client_ = media_stream_impl; | 2758 web_user_media_client_ = media_stream_impl; |
2751 return true; | 2759 return true; |
2752 #else | 2760 #else |
2753 return false; | 2761 return false; |
2754 #endif | 2762 #endif |
2755 } | 2763 } |
2756 | 2764 |
2757 void RenderViewImpl::didChangeContentsSize(WebFrame* frame, | 2765 void RenderViewImpl::didChangeContentsSize(WebLocalFrame* frame, |
2758 const WebSize& size) { | 2766 const WebSize& size) { |
2759 if (webview()->mainFrame() != frame) | 2767 if (webview()->mainFrame() != frame) |
2760 return; | 2768 return; |
2761 WebView* frameView = frame->view(); | 2769 WebView* frameView = frame->view(); |
2762 if (!frameView) | 2770 if (!frameView) |
2763 return; | 2771 return; |
2764 | 2772 |
2765 bool has_horizontal_scrollbar = frame->hasHorizontalScrollbar(); | 2773 bool has_horizontal_scrollbar = frame->hasHorizontalScrollbar(); |
2766 bool has_vertical_scrollbar = frame->hasVerticalScrollbar(); | 2774 bool has_vertical_scrollbar = frame->hasVerticalScrollbar(); |
2767 | 2775 |
(...skipping 20 matching lines...) Expand all Loading... |
2788 Send(new ViewHostMsg_DidChangeScrollOffsetPinningForMainFrame( | 2796 Send(new ViewHostMsg_DidChangeScrollOffsetPinningForMainFrame( |
2789 routing_id_, is_pinned_to_left, is_pinned_to_right)); | 2797 routing_id_, is_pinned_to_left, is_pinned_to_right)); |
2790 | 2798 |
2791 cached_is_main_frame_pinned_to_left_ = is_pinned_to_left; | 2799 cached_is_main_frame_pinned_to_left_ = is_pinned_to_left; |
2792 cached_is_main_frame_pinned_to_right_ = is_pinned_to_right; | 2800 cached_is_main_frame_pinned_to_right_ = is_pinned_to_right; |
2793 } | 2801 } |
2794 | 2802 |
2795 Send(new ViewHostMsg_DidChangeScrollOffset(routing_id_)); | 2803 Send(new ViewHostMsg_DidChangeScrollOffset(routing_id_)); |
2796 } | 2804 } |
2797 | 2805 |
2798 void RenderViewImpl::didChangeScrollOffset(WebFrame* frame) { | 2806 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { |
2799 StartNavStateSyncTimerIfNecessary(); | 2807 StartNavStateSyncTimerIfNecessary(); |
2800 | 2808 |
2801 if (webview()->mainFrame() == frame) | 2809 if (webview()->mainFrame() == frame) |
2802 UpdateScrollState(frame); | 2810 UpdateScrollState(frame); |
2803 | 2811 |
2804 FOR_EACH_OBSERVER( | 2812 FOR_EACH_OBSERVER( |
2805 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); | 2813 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); |
2806 } | 2814 } |
2807 | 2815 |
2808 void RenderViewImpl::willInsertBody(blink::WebFrame* frame) { | 2816 void RenderViewImpl::willInsertBody(blink::WebLocalFrame* frame) { |
2809 NOTREACHED(); | 2817 NOTREACHED(); |
2810 } | 2818 } |
2811 | 2819 |
2812 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebFrame* frame) { | 2820 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebLocalFrame* frame) { |
2813 if (frame != webview()->mainFrame()) | 2821 if (frame != webview()->mainFrame()) |
2814 return; | 2822 return; |
2815 | 2823 |
2816 InternalDocumentStateData* data = | 2824 InternalDocumentStateData* data = |
2817 InternalDocumentStateData::FromDataSource(frame->dataSource()); | 2825 InternalDocumentStateData::FromDataSource(frame->dataSource()); |
2818 data->set_did_first_visually_non_empty_layout(true); | 2826 data->set_did_first_visually_non_empty_layout(true); |
2819 | 2827 |
2820 #if defined(OS_ANDROID) | 2828 #if defined(OS_ANDROID) |
2821 // Update body background color if necessary. | 2829 // Update body background color if necessary. |
2822 SkColor bg_color = webwidget_->backgroundColor(); | 2830 SkColor bg_color = webwidget_->backgroundColor(); |
(...skipping 30 matching lines...) Expand all Loading... |
2853 NOTREACHED(); | 2861 NOTREACHED(); |
2854 } | 2862 } |
2855 | 2863 |
2856 void RenderViewImpl::reportFindInPageSelection(int request_id, | 2864 void RenderViewImpl::reportFindInPageSelection(int request_id, |
2857 int active_match_ordinal, | 2865 int active_match_ordinal, |
2858 const WebRect& selection_rect) { | 2866 const WebRect& selection_rect) { |
2859 NOTREACHED(); | 2867 NOTREACHED(); |
2860 } | 2868 } |
2861 | 2869 |
2862 void RenderViewImpl::requestStorageQuota( | 2870 void RenderViewImpl::requestStorageQuota( |
2863 WebFrame* frame, | 2871 WebLocalFrame* frame, |
2864 WebStorageQuotaType type, | 2872 WebStorageQuotaType type, |
2865 unsigned long long requested_size, | 2873 unsigned long long requested_size, |
2866 blink::WebStorageQuotaCallbacks callbacks) { | 2874 blink::WebStorageQuotaCallbacks callbacks) { |
2867 NOTREACHED(); | 2875 NOTREACHED(); |
2868 } | 2876 } |
2869 | 2877 |
2870 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | 2878 bool RenderViewImpl::willCheckAndDispatchMessageEvent( |
2871 blink::WebFrame* sourceFrame, | 2879 blink::WebLocalFrame* sourceFrame, |
2872 blink::WebFrame* targetFrame, | 2880 blink::WebFrame* targetFrame, |
2873 blink::WebSecurityOrigin target_origin, | 2881 blink::WebSecurityOrigin target_origin, |
2874 blink::WebDOMMessageEvent event) { | 2882 blink::WebDOMMessageEvent event) { |
2875 if (!is_swapped_out_) | 2883 if (!is_swapped_out_) |
2876 return false; | 2884 return false; |
2877 | 2885 |
2878 ViewMsg_PostMessage_Params params; | 2886 ViewMsg_PostMessage_Params params; |
2879 params.data = event.data().toString(); | 2887 params.data = event.data().toString(); |
2880 params.source_origin = event.origin(); | 2888 params.source_origin = event.origin(); |
2881 if (!target_origin.isNull()) | 2889 if (!target_origin.isNull()) |
(...skipping 26 matching lines...) Expand all Loading... |
2908 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); | 2916 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); |
2909 return true; | 2917 return true; |
2910 } | 2918 } |
2911 | 2919 |
2912 void RenderViewImpl::willOpenSocketStream( | 2920 void RenderViewImpl::willOpenSocketStream( |
2913 WebSocketStreamHandle* handle) { | 2921 WebSocketStreamHandle* handle) { |
2914 NOTREACHED(); | 2922 NOTREACHED(); |
2915 } | 2923 } |
2916 | 2924 |
2917 void RenderViewImpl::willStartUsingPeerConnectionHandler( | 2925 void RenderViewImpl::willStartUsingPeerConnectionHandler( |
2918 blink::WebFrame* frame, blink::WebRTCPeerConnectionHandler* handler) { | 2926 blink::WebLocalFrame* frame, |
| 2927 blink::WebRTCPeerConnectionHandler* handler) { |
2919 NOTREACHED(); | 2928 NOTREACHED(); |
2920 } | 2929 } |
2921 | 2930 |
2922 blink::WebString RenderViewImpl::acceptLanguages() { | 2931 blink::WebString RenderViewImpl::acceptLanguages() { |
2923 return WebString::fromUTF8(renderer_preferences_.accept_languages); | 2932 return WebString::fromUTF8(renderer_preferences_.accept_languages); |
2924 } | 2933 } |
2925 | 2934 |
2926 blink::WebString RenderViewImpl::userAgentOverride( | 2935 blink::WebString RenderViewImpl::userAgentOverride(blink::WebLocalFrame* frame, |
2927 blink::WebFrame* frame, | 2936 const blink::WebURL& url) { |
2928 const blink::WebURL& url) { | |
2929 NOTREACHED(); | 2937 NOTREACHED(); |
2930 return blink::WebString(); | 2938 return blink::WebString(); |
2931 } | 2939 } |
2932 | 2940 |
2933 WebString RenderViewImpl::doNotTrackValue(WebFrame* frame) { | 2941 WebString RenderViewImpl::doNotTrackValue(WebLocalFrame* frame) { |
2934 NOTREACHED(); | 2942 NOTREACHED(); |
2935 return blink::WebString(); | 2943 return blink::WebString(); |
2936 } | 2944 } |
2937 | 2945 |
2938 bool RenderViewImpl::allowWebGL(WebFrame* frame, bool default_value) { | 2946 bool RenderViewImpl::allowWebGL(WebLocalFrame* frame, bool default_value) { |
2939 NOTREACHED(); | 2947 NOTREACHED(); |
2940 return false; | 2948 return false; |
2941 } | 2949 } |
2942 | 2950 |
2943 void RenderViewImpl::didLoseWebGLContext( | 2951 void RenderViewImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, |
2944 blink::WebFrame* frame, | 2952 int arb_robustness_status_code) { |
2945 int arb_robustness_status_code) { | |
2946 NOTREACHED(); | 2953 NOTREACHED(); |
2947 } | 2954 } |
2948 | 2955 |
2949 // blink::WebPageSerializerClient implementation ------------------------------ | 2956 // blink::WebPageSerializerClient implementation ------------------------------ |
2950 | 2957 |
2951 void RenderViewImpl::didSerializeDataForFrame( | 2958 void RenderViewImpl::didSerializeDataForFrame( |
2952 const WebURL& frame_url, | 2959 const WebURL& frame_url, |
2953 const WebCString& data, | 2960 const WebCString& data, |
2954 WebPageSerializerClient::PageSerializationStatus status) { | 2961 WebPageSerializerClient::PageSerializationStatus status) { |
2955 Send(new ViewHostMsg_SendSerializedHtmlData( | 2962 Send(new ViewHostMsg_SendSerializedHtmlData( |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 } | 3053 } |
3047 | 3054 |
3048 float RenderViewImpl::GetFilteredTimePerFrame() const { | 3055 float RenderViewImpl::GetFilteredTimePerFrame() const { |
3049 return filtered_time_per_frame(); | 3056 return filtered_time_per_frame(); |
3050 } | 3057 } |
3051 | 3058 |
3052 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { | 3059 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { |
3053 return visibilityState(); | 3060 return visibilityState(); |
3054 } | 3061 } |
3055 | 3062 |
3056 void RenderViewImpl::RunModalAlertDialog(blink::WebFrame* frame, | 3063 void RenderViewImpl::RunModalAlertDialog(blink::WebLocalFrame* frame, |
3057 const blink::WebString& message) { | 3064 const blink::WebString& message) { |
3058 return runModalAlertDialog(frame, message); | 3065 return runModalAlertDialog(frame, message); |
3059 } | 3066 } |
3060 | 3067 |
3061 void RenderViewImpl::DidStartLoading() { | 3068 void RenderViewImpl::DidStartLoading() { |
3062 main_render_frame_->didStartLoading(true); | 3069 main_render_frame_->didStartLoading(true); |
3063 } | 3070 } |
3064 | 3071 |
3065 void RenderViewImpl::DidStopLoading() { | 3072 void RenderViewImpl::DidStopLoading() { |
3066 main_render_frame_->didStopLoading(); | 3073 main_render_frame_->didStopLoading(); |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3692 const base::FilePath& local_directory_name) { | 3699 const base::FilePath& local_directory_name) { |
3693 | 3700 |
3694 // Convert std::vector of GURLs to WebVector<WebURL> | 3701 // Convert std::vector of GURLs to WebVector<WebURL> |
3695 WebVector<WebURL> weburl_links(links); | 3702 WebVector<WebURL> weburl_links(links); |
3696 | 3703 |
3697 // Convert std::vector of base::FilePath to WebVector<WebString> | 3704 // Convert std::vector of base::FilePath to WebVector<WebString> |
3698 WebVector<WebString> webstring_paths(local_paths.size()); | 3705 WebVector<WebString> webstring_paths(local_paths.size()); |
3699 for (size_t i = 0; i < local_paths.size(); i++) | 3706 for (size_t i = 0; i < local_paths.size(); i++) |
3700 webstring_paths[i] = local_paths[i].AsUTF16Unsafe(); | 3707 webstring_paths[i] = local_paths[i].AsUTF16Unsafe(); |
3701 | 3708 |
3702 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, | 3709 WebPageSerializer::serialize(webview()->mainFrame()->toWebLocalFrame(), |
| 3710 true, |
| 3711 this, |
| 3712 weburl_links, |
3703 webstring_paths, | 3713 webstring_paths, |
3704 local_directory_name.AsUTF16Unsafe()); | 3714 local_directory_name.AsUTF16Unsafe()); |
3705 } | 3715 } |
3706 | 3716 |
3707 void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { | 3717 void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { |
3708 // Don't show any more dialogs until we finish OnSwapOut. | 3718 // Don't show any more dialogs until we finish OnSwapOut. |
3709 suppress_dialogs_until_swap_out_ = true; | 3719 suppress_dialogs_until_swap_out_ = true; |
3710 } | 3720 } |
3711 | 3721 |
3712 void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { | 3722 void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4174 it != plugin_delegates_.end(); ++it) { | 4184 it != plugin_delegates_.end(); ++it) { |
4175 (*it)->ImeCompositionCompleted(text, focused_plugin_id_); | 4185 (*it)->ImeCompositionCompleted(text, focused_plugin_id_); |
4176 } | 4186 } |
4177 return; | 4187 return; |
4178 } | 4188 } |
4179 #endif // OS_WIN | 4189 #endif // OS_WIN |
4180 #endif // ENABLE_PLUGINS | 4190 #endif // ENABLE_PLUGINS |
4181 if (replacement_range.IsValid() && webview()) { | 4191 if (replacement_range.IsValid() && webview()) { |
4182 // Select the text in |replacement_range|, it will then be replaced by | 4192 // Select the text in |replacement_range|, it will then be replaced by |
4183 // text added by the call to RenderWidget::OnImeConfirmComposition(). | 4193 // text added by the call to RenderWidget::OnImeConfirmComposition(). |
4184 if (WebFrame* frame = webview()->focusedFrame()) { | 4194 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) { |
4185 WebRange webrange = WebRange::fromDocumentRange( | 4195 WebRange webrange = WebRange::fromDocumentRange( |
4186 frame, replacement_range.start(), replacement_range.length()); | 4196 frame, replacement_range.start(), replacement_range.length()); |
4187 if (!webrange.isNull()) | 4197 if (!webrange.isNull()) |
4188 frame->selectRange(webrange); | 4198 frame->selectRange(webrange); |
4189 } | 4199 } |
4190 } | 4200 } |
4191 RenderWidget::OnImeConfirmComposition(text, | 4201 RenderWidget::OnImeConfirmComposition(text, |
4192 replacement_range, | 4202 replacement_range, |
4193 keep_selection); | 4203 keep_selection); |
4194 } | 4204 } |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4827 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); | 4837 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); |
4828 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4838 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4829 if (!url.isEmpty()) | 4839 if (!url.isEmpty()) |
4830 urls.push_back( | 4840 urls.push_back( |
4831 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4841 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4832 } | 4842 } |
4833 SendUpdateFaviconURL(urls); | 4843 SendUpdateFaviconURL(urls); |
4834 } | 4844 } |
4835 | 4845 |
4836 } // namespace content | 4846 } // namespace content |
OLD | NEW |