| 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 // Ensure we start with a valid next_page_id_ from the browser. | 755 // Ensure we start with a valid next_page_id_ from the browser. |
| 756 DCHECK_GE(next_page_id_, 0); | 756 DCHECK_GE(next_page_id_, 0); |
| 757 | 757 |
| 758 main_render_frame_.reset(RenderFrameImpl::Create( | 758 main_render_frame_.reset(RenderFrameImpl::Create( |
| 759 this, params->main_frame_routing_id)); | 759 this, params->main_frame_routing_id)); |
| 760 // The main frame WebLocalFrame object is closed by | 760 // The main frame WebLocalFrame object is closed by |
| 761 // RenderFrameImpl::frameDetached(). | 761 // RenderFrameImpl::frameDetached(). |
| 762 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); | 762 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); |
| 763 main_render_frame_->SetWebFrame(web_frame); | 763 main_render_frame_->SetWebFrame(web_frame); |
| 764 | 764 |
| 765 if (params->proxy_routing_id != MSG_ROUTING_NONE) { | |
| 766 CHECK(params->swapped_out); | |
| 767 RenderFrameProxy* proxy = | |
| 768 RenderFrameProxy::CreateFrameProxy(params->proxy_routing_id, | |
| 769 params->main_frame_routing_id); | |
| 770 main_render_frame_->set_render_frame_proxy(proxy); | |
| 771 } | |
| 772 | |
| 773 webwidget_ = WebView::create(this); | 765 webwidget_ = WebView::create(this); |
| 774 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 766 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
| 775 | 767 |
| 776 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 768 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 777 | 769 |
| 778 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 770 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
| 779 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 771 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
| 780 | 772 |
| 781 #if defined(OS_ANDROID) | 773 #if defined(OS_ANDROID) |
| 782 const std::string region_code = | 774 const std::string region_code = |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 webview()->settings()->setCompositedScrollingForFramesEnabled( | 814 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 823 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 815 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 824 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( | 816 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( |
| 825 ShouldUseExpandedHeuristicsForGpuRasterization()); | 817 ShouldUseExpandedHeuristicsForGpuRasterization()); |
| 826 | 818 |
| 827 ApplyWebPreferences(webkit_preferences_, webview()); | 819 ApplyWebPreferences(webkit_preferences_, webview()); |
| 828 | 820 |
| 829 webview()->settings()->setAllowConnectingInsecureWebSocket( | 821 webview()->settings()->setAllowConnectingInsecureWebSocket( |
| 830 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 822 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
| 831 | 823 |
| 832 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | 824 RenderFrameProxy* proxy = NULL; |
| 825 if (params->proxy_routing_id != MSG_ROUTING_NONE) { |
| 826 CHECK(params->swapped_out); |
| 827 proxy = RenderFrameProxy::CreateProxyToReplaceFrame( |
| 828 main_render_frame_.get(), params->proxy_routing_id); |
| 829 main_render_frame_->set_render_frame_proxy(proxy); |
| 830 } |
| 831 |
| 832 // In --site-per-process, just use the WebRemoteFrame as the main frame. |
| 833 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && |
| 834 proxy) { |
| 835 webview()->setMainFrame(proxy->web_frame()); |
| 836 } else { |
| 837 webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
| 838 } |
| 833 main_render_frame_->Initialize(); | 839 main_render_frame_->Initialize(); |
| 834 | 840 |
| 835 if (switches::IsTouchDragDropEnabled()) | 841 if (switches::IsTouchDragDropEnabled()) |
| 836 webview()->settings()->setTouchDragDropEnabled(true); | 842 webview()->settings()->setTouchDragDropEnabled(true); |
| 837 | 843 |
| 838 if (switches::IsTouchEditingEnabled()) | 844 if (switches::IsTouchEditingEnabled()) |
| 839 webview()->settings()->setTouchEditingEnabled(true); | 845 webview()->settings()->setTouchEditingEnabled(true); |
| 840 | 846 |
| 841 if (!params->frame_name.empty()) | 847 if (!params->frame_name.empty()) |
| 842 webview()->mainFrame()->setName(params->frame_name); | 848 webview()->mainFrame()->setName(params->frame_name); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 // If we have an opener_id but we weren't created by a renderer, then | 885 // If we have an opener_id but we weren't created by a renderer, then |
| 880 // it's the browser asking us to set our opener to another RenderView. | 886 // it's the browser asking us to set our opener to another RenderView. |
| 881 if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { | 887 if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { |
| 882 RenderViewImpl* opener_view = FromRoutingID(params->opener_id); | 888 RenderViewImpl* opener_view = FromRoutingID(params->opener_id); |
| 883 if (opener_view) | 889 if (opener_view) |
| 884 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); | 890 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); |
| 885 } | 891 } |
| 886 | 892 |
| 887 // If we are initially swapped out, navigate to kSwappedOutURL. | 893 // If we are initially swapped out, navigate to kSwappedOutURL. |
| 888 // This ensures we are in a unique origin that others cannot script. | 894 // This ensures we are in a unique origin that others cannot script. |
| 889 if (is_swapped_out_) | 895 if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame()) |
| 890 NavigateToSwappedOutURL(webview()->mainFrame()); | 896 NavigateToSwappedOutURL(webview()->mainFrame()); |
| 891 } | 897 } |
| 892 | 898 |
| 893 RenderViewImpl::~RenderViewImpl() { | 899 RenderViewImpl::~RenderViewImpl() { |
| 894 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); | 900 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); |
| 895 it != disambiguation_bitmaps_.end(); | 901 it != disambiguation_bitmaps_.end(); |
| 896 ++it) | 902 ++it) |
| 897 delete it->second; | 903 delete it->second; |
| 898 history_page_ids_.clear(); | 904 history_page_ids_.clear(); |
| 899 | 905 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 if (webview()) | 1341 if (webview()) |
| 1336 webview()->transferActiveWheelFlingAnimation(params); | 1342 webview()->transferActiveWheelFlingAnimation(params); |
| 1337 } | 1343 } |
| 1338 | 1344 |
| 1339 bool RenderViewImpl::HasIMETextFocus() { | 1345 bool RenderViewImpl::HasIMETextFocus() { |
| 1340 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 1346 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
| 1341 } | 1347 } |
| 1342 | 1348 |
| 1343 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1349 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
| 1344 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1350 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
| 1345 if (main_frame) | 1351 if (main_frame && main_frame->isWebLocalFrame()) |
| 1346 GetContentClient()->SetActiveURL(main_frame->document().url()); | 1352 GetContentClient()->SetActiveURL(main_frame->document().url()); |
| 1347 | 1353 |
| 1348 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 1354 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
| 1349 RenderViewObserver* observer; | 1355 RenderViewObserver* observer; |
| 1350 while ((observer = it.GetNext()) != NULL) | 1356 while ((observer = it.GetNext()) != NULL) |
| 1351 if (observer->OnMessageReceived(message)) | 1357 if (observer->OnMessageReceived(message)) |
| 1352 return true; | 1358 return true; |
| 1353 | 1359 |
| 1354 bool handled = true; | 1360 bool handled = true; |
| 1355 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1361 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2279 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2274 if (!document_state) { | 2280 if (!document_state) { |
| 2275 document_state = new DocumentState; | 2281 document_state = new DocumentState; |
| 2276 ds->setExtraData(document_state); | 2282 ds->setExtraData(document_state); |
| 2277 if (!content_initiated) | 2283 if (!content_initiated) |
| 2278 PopulateDocumentStateFromPending(document_state); | 2284 PopulateDocumentStateFromPending(document_state); |
| 2279 } | 2285 } |
| 2280 | 2286 |
| 2281 // Carry over the user agent override flag, if it exists. | 2287 // Carry over the user agent override flag, if it exists. |
| 2282 if (content_initiated && webview() && webview()->mainFrame() && | 2288 if (content_initiated && webview() && webview()->mainFrame() && |
| 2289 webview()->mainFrame()->isWebLocalFrame() && |
| 2283 webview()->mainFrame()->dataSource()) { | 2290 webview()->mainFrame()->dataSource()) { |
| 2284 DocumentState* old_document_state = | 2291 DocumentState* old_document_state = |
| 2285 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); | 2292 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); |
| 2286 if (old_document_state) { | 2293 if (old_document_state) { |
| 2287 InternalDocumentStateData* internal_data = | 2294 InternalDocumentStateData* internal_data = |
| 2288 InternalDocumentStateData::FromDocumentState(document_state); | 2295 InternalDocumentStateData::FromDocumentState(document_state); |
| 2289 InternalDocumentStateData* old_internal_data = | 2296 InternalDocumentStateData* old_internal_data = |
| 2290 InternalDocumentStateData::FromDocumentState(old_document_state); | 2297 InternalDocumentStateData::FromDocumentState(old_document_state); |
| 2291 internal_data->set_is_overriding_user_agent( | 2298 internal_data->set_is_overriding_user_agent( |
| 2292 old_internal_data->is_overriding_user_agent()); | 2299 old_internal_data->is_overriding_user_agent()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2308 // page. We are early enough in the request process here that we | 2315 // page. We are early enough in the request process here that we |
| 2309 // can still see the DocumentState of the previous page and set | 2316 // can still see the DocumentState of the previous page and set |
| 2310 // this value appropriately. | 2317 // this value appropriately. |
| 2311 // TODO(gavinp): catch the important case of navigation in a new | 2318 // TODO(gavinp): catch the important case of navigation in a new |
| 2312 // renderer process. | 2319 // renderer process. |
| 2313 if (webview()) { | 2320 if (webview()) { |
| 2314 if (WebFrame* old_frame = webview()->mainFrame()) { | 2321 if (WebFrame* old_frame = webview()->mainFrame()) { |
| 2315 const WebURLRequest& original_request = ds->originalRequest(); | 2322 const WebURLRequest& original_request = ds->originalRequest(); |
| 2316 const GURL referrer( | 2323 const GURL referrer( |
| 2317 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2324 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); |
| 2318 if (!referrer.is_empty() && | 2325 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && |
| 2319 DocumentState::FromDataSource( | 2326 DocumentState::FromDataSource(old_frame->dataSource()) |
| 2320 old_frame->dataSource())->was_prefetcher()) { | 2327 ->was_prefetcher()) { |
| 2321 for (; old_frame; old_frame = old_frame->traverseNext(false)) { | 2328 for (; old_frame; old_frame = old_frame->traverseNext(false)) { |
| 2322 WebDataSource* old_frame_ds = old_frame->dataSource(); | 2329 WebDataSource* old_frame_ds = old_frame->dataSource(); |
| 2323 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { | 2330 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { |
| 2324 document_state->set_was_referred_by_prefetcher(true); | 2331 document_state->set_was_referred_by_prefetcher(true); |
| 2325 break; | 2332 break; |
| 2326 } | 2333 } |
| 2327 } | 2334 } |
| 2328 } | 2335 } |
| 2329 } | 2336 } |
| 2330 } | 2337 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 if (!webview()) | 2658 if (!webview()) |
| 2652 return; | 2659 return; |
| 2653 SendUpdateState(history_controller_->GetCurrentEntry()); | 2660 SendUpdateState(history_controller_->GetCurrentEntry()); |
| 2654 } | 2661 } |
| 2655 | 2662 |
| 2656 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { | 2663 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { |
| 2657 if (!webview()) | 2664 if (!webview()) |
| 2658 return NULL; | 2665 return NULL; |
| 2659 | 2666 |
| 2660 WebFrame* main_frame = webview()->mainFrame(); | 2667 WebFrame* main_frame = webview()->mainFrame(); |
| 2661 if (main_frame->document().isPluginDocument()) | 2668 if (main_frame->isWebLocalFrame() && |
| 2669 main_frame->document().isPluginDocument()) |
| 2662 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); | 2670 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); |
| 2663 | 2671 |
| 2664 #if defined(ENABLE_PLUGINS) | 2672 #if defined(ENABLE_PLUGINS) |
| 2665 if (plugin_find_handler_) | 2673 if (plugin_find_handler_) |
| 2666 return plugin_find_handler_->container()->plugin(); | 2674 return plugin_find_handler_->container()->plugin(); |
| 2667 #endif | 2675 #endif |
| 2668 | 2676 |
| 2669 return NULL; | 2677 return NULL; |
| 2670 } | 2678 } |
| 2671 | 2679 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3156 } | 3164 } |
| 3157 #endif // defined(USE_DEFAULT_RENDER_THEME) | 3165 #endif // defined(USE_DEFAULT_RENDER_THEME) |
| 3158 | 3166 |
| 3159 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 3167 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
| 3160 RenderThreadImpl::current()->SetFlingCurveParameters( | 3168 RenderThreadImpl::current()->SetFlingCurveParameters( |
| 3161 renderer_prefs.touchpad_fling_profile, | 3169 renderer_prefs.touchpad_fling_profile, |
| 3162 renderer_prefs.touchscreen_fling_profile); | 3170 renderer_prefs.touchscreen_fling_profile); |
| 3163 | 3171 |
| 3164 // If the zoom level for this page matches the old zoom default, and this | 3172 // If the zoom level for this page matches the old zoom default, and this |
| 3165 // is not a plugin, update the zoom level to match the new default. | 3173 // is not a plugin, update the zoom level to match the new default. |
| 3166 if (webview() && !webview()->mainFrame()->document().isPluginDocument() && | 3174 if (webview() && webview()->mainFrame()->isWebLocalFrame() && |
| 3175 !webview()->mainFrame()->document().isPluginDocument() && |
| 3167 !ZoomValuesEqual(old_zoom_level, | 3176 !ZoomValuesEqual(old_zoom_level, |
| 3168 renderer_preferences_.default_zoom_level) && | 3177 renderer_preferences_.default_zoom_level) && |
| 3169 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { | 3178 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { |
| 3170 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); | 3179 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); |
| 3171 zoomLevelChanged(); | 3180 zoomLevelChanged(); |
| 3172 } | 3181 } |
| 3173 | 3182 |
| 3174 if (webview() && | 3183 if (webview() && |
| 3175 old_accept_languages != renderer_preferences_.accept_languages) { | 3184 old_accept_languages != renderer_preferences_.accept_languages) { |
| 3176 webview()->acceptLanguagesChanged(); | 3185 webview()->acceptLanguagesChanged(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3268 // We use loadRequest instead of loadHTMLString because the former commits | 3277 // We use loadRequest instead of loadHTMLString because the former commits |
| 3269 // synchronously. Otherwise a new navigation can interrupt the navigation | 3278 // synchronously. Otherwise a new navigation can interrupt the navigation |
| 3270 // to kSwappedOutURL. If that happens to be to the page we had been | 3279 // to kSwappedOutURL. If that happens to be to the page we had been |
| 3271 // showing, then WebKit will never send a commit and we'll be left spinning. | 3280 // showing, then WebKit will never send a commit and we'll be left spinning. |
| 3272 // TODO(creis): Until we move this to RenderFrame, we may call this from a | 3281 // TODO(creis): Until we move this to RenderFrame, we may call this from a |
| 3273 // swapped out RenderFrame while our own is_swapped_out_ is false. | 3282 // swapped out RenderFrame while our own is_swapped_out_ is false. |
| 3274 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); | 3283 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); |
| 3275 CHECK(is_swapped_out_ || rf->is_swapped_out()); | 3284 CHECK(is_swapped_out_ || rf->is_swapped_out()); |
| 3276 GURL swappedOutURL(kSwappedOutURL); | 3285 GURL swappedOutURL(kSwappedOutURL); |
| 3277 WebURLRequest request(swappedOutURL); | 3286 WebURLRequest request(swappedOutURL); |
| 3278 frame->loadRequest(request); | 3287 if (frame->isWebLocalFrame()) |
| 3288 frame->loadRequest(request); |
| 3279 } | 3289 } |
| 3280 | 3290 |
| 3281 void RenderViewImpl::OnClosePage() { | 3291 void RenderViewImpl::OnClosePage() { |
| 3282 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); | 3292 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); |
| 3283 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 3293 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
| 3284 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 3294 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
| 3285 // in the onunload handler from appearing. For now, we're bypassing that and | 3295 // in the onunload handler from appearing. For now, we're bypassing that and |
| 3286 // calling the FrameLoader's CloseURL method directly. This should be | 3296 // calling the FrameLoader's CloseURL method directly. This should be |
| 3287 // revisited to avoid having two ways to close a page. Having a single way | 3297 // revisited to avoid having two ways to close a page. Having a single way |
| 3288 // to close that can run onunload is also useful for fixing | 3298 // to close that can run onunload is also useful for fixing |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3370 (*i)->ViewFlushedPaint(); | 3380 (*i)->ViewFlushedPaint(); |
| 3371 } | 3381 } |
| 3372 #endif | 3382 #endif |
| 3373 | 3383 |
| 3374 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | 3384 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. |
| 3375 // See crbug.com/112921. | 3385 // See crbug.com/112921. |
| 3376 if (!webview()) | 3386 if (!webview()) |
| 3377 return; | 3387 return; |
| 3378 | 3388 |
| 3379 WebFrame* main_frame = webview()->mainFrame(); | 3389 WebFrame* main_frame = webview()->mainFrame(); |
| 3390 for (WebFrame* frame = main_frame; frame; |
| 3391 frame = frame->traverseNext(false)) { |
| 3392 if (frame->isWebLocalFrame()) |
| 3393 main_frame = frame; |
| 3394 } |
| 3380 | 3395 |
| 3381 // If we have a provisional frame we are between the start and commit stages | 3396 // If we have a provisional frame we are between the start and commit stages |
| 3382 // of loading and we don't want to save stats. | 3397 // of loading and we don't want to save stats. |
| 3383 if (!main_frame->provisionalDataSource()) { | 3398 if (!main_frame->provisionalDataSource()) { |
| 3384 WebDataSource* ds = main_frame->dataSource(); | 3399 WebDataSource* ds = main_frame->dataSource(); |
| 3385 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3400 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3386 InternalDocumentStateData* data = | 3401 InternalDocumentStateData* data = |
| 3387 InternalDocumentStateData::FromDocumentState(document_state); | 3402 InternalDocumentStateData::FromDocumentState(document_state); |
| 3388 if (data->did_first_visually_non_empty_layout() && | 3403 if (data->did_first_visually_non_empty_layout() && |
| 3389 !data->did_first_visually_non_empty_paint()) { | 3404 !data->did_first_visually_non_empty_paint()) { |
| 3390 data->set_did_first_visually_non_empty_paint(true); | 3405 data->set_did_first_visually_non_empty_paint(true); |
| 3391 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_)); | 3406 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_)); |
| 3392 } | 3407 } |
| 3393 | 3408 |
| 3394 // TODO(jar): The following code should all be inside a method, probably in | 3409 // TODO(jar): The following code should all be inside a method, probably in |
| 3395 // NavigatorState. | 3410 // NavigatorState. |
| 3396 Time now = Time::Now(); | 3411 Time now = Time::Now(); |
| 3397 if (document_state->first_paint_time().is_null()) { | 3412 if (document_state->first_paint_time().is_null()) { |
| 3398 document_state->set_first_paint_time(now); | 3413 document_state->set_first_paint_time(now); |
| 3399 } | 3414 } |
| 3400 if (document_state->first_paint_after_load_time().is_null() && | 3415 if (document_state->first_paint_after_load_time().is_null() && |
| 3401 !document_state->finish_load_time().is_null()) { | 3416 !document_state->finish_load_time().is_null()) { |
| 3402 document_state->set_first_paint_after_load_time(now); | 3417 document_state->set_first_paint_after_load_time(now); |
| 3403 } | 3418 } |
| 3404 } | 3419 } |
| 3405 } | 3420 } |
| 3406 | 3421 |
| 3407 gfx::Vector2d RenderViewImpl::GetScrollOffset() { | 3422 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
| 3408 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 3423 WebFrame* main_frame = webview()->mainFrame(); |
| 3424 for (WebFrame* frame = main_frame; frame; |
| 3425 frame = frame->traverseNext(false)) { |
| 3426 if (frame->isWebLocalFrame()) |
| 3427 main_frame = frame; |
| 3428 } |
| 3429 |
| 3430 WebSize scroll_offset = main_frame->scrollOffset(); |
| 3409 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 3431 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
| 3410 } | 3432 } |
| 3411 | 3433 |
| 3412 void RenderViewImpl::OnClearFocusedElement() { | 3434 void RenderViewImpl::OnClearFocusedElement() { |
| 3413 if (webview()) | 3435 if (webview()) |
| 3414 webview()->clearFocusedElement(); | 3436 webview()->clearFocusedElement(); |
| 3415 } | 3437 } |
| 3416 | 3438 |
| 3417 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 3439 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
| 3418 if (webview()) | 3440 if (webview()) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3602 for (plugin_it = plugin_delegates_.begin(); | 3624 for (plugin_it = plugin_delegates_.begin(); |
| 3603 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3625 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
| 3604 (*plugin_it)->SetContainerVisibility(true); | 3626 (*plugin_it)->SetContainerVisibility(true); |
| 3605 } | 3627 } |
| 3606 #endif // OS_MACOSX | 3628 #endif // OS_MACOSX |
| 3607 #endif // ENABLE_PLUGINS | 3629 #endif // ENABLE_PLUGINS |
| 3608 } | 3630 } |
| 3609 | 3631 |
| 3610 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 3632 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
| 3611 DCHECK(webview()); | 3633 DCHECK(webview()); |
| 3612 if (webview()->mainFrame()) | 3634 if (webview()->mainFrame()->isWebLocalFrame()) |
| 3613 return GURL(webview()->mainFrame()->document().url()); | 3635 return GURL(webview()->mainFrame()->document().url()); |
| 3614 else | 3636 else |
| 3615 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 3637 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
| 3616 } | 3638 } |
| 3617 | 3639 |
| 3618 void RenderViewImpl::OnSetFocus(bool enable) { | 3640 void RenderViewImpl::OnSetFocus(bool enable) { |
| 3619 RenderWidget::OnSetFocus(enable); | 3641 RenderWidget::OnSetFocus(enable); |
| 3620 | 3642 |
| 3621 #if defined(ENABLE_PLUGINS) | 3643 #if defined(ENABLE_PLUGINS) |
| 3622 if (webview() && webview()->isActive()) { | 3644 if (webview() && webview()->isActive()) { |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4295 std::vector<gfx::Size> sizes; | 4317 std::vector<gfx::Size> sizes; |
| 4296 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4318 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4297 if (!url.isEmpty()) | 4319 if (!url.isEmpty()) |
| 4298 urls.push_back( | 4320 urls.push_back( |
| 4299 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4321 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4300 } | 4322 } |
| 4301 SendUpdateFaviconURL(urls); | 4323 SendUpdateFaviconURL(urls); |
| 4302 } | 4324 } |
| 4303 | 4325 |
| 4304 } // namespace content | 4326 } // namespace content |
| OLD | NEW |