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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 // Ensure we start with a valid next_page_id_ from the browser. | 754 // Ensure we start with a valid next_page_id_ from the browser. |
755 DCHECK_GE(next_page_id_, 0); | 755 DCHECK_GE(next_page_id_, 0); |
756 | 756 |
757 main_render_frame_.reset(RenderFrameImpl::Create( | 757 main_render_frame_.reset(RenderFrameImpl::Create( |
758 this, params->main_frame_routing_id)); | 758 this, params->main_frame_routing_id)); |
759 // The main frame WebLocalFrame object is closed by | 759 // The main frame WebLocalFrame object is closed by |
760 // RenderFrameImpl::frameDetached(). | 760 // RenderFrameImpl::frameDetached(). |
761 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); | 761 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); |
762 main_render_frame_->SetWebFrame(web_frame); | 762 main_render_frame_->SetWebFrame(web_frame); |
763 | 763 |
764 if (params->proxy_routing_id != MSG_ROUTING_NONE) { | |
765 CHECK(params->swapped_out); | |
766 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame( | |
767 main_render_frame_.get(), params->proxy_routing_id); | |
768 main_render_frame_->set_render_frame_proxy(proxy); | |
769 } | |
770 | |
771 webwidget_ = WebView::create(this); | 764 webwidget_ = WebView::create(this); |
772 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 765 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
773 | 766 |
774 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 767 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
775 | 768 |
776 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 769 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
777 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 770 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
778 | 771 |
779 #if defined(OS_ANDROID) | 772 #if defined(OS_ANDROID) |
780 const std::string region_code = | 773 const std::string region_code = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
820 webview()->settings()->setCompositedScrollingForFramesEnabled( | 813 webview()->settings()->setCompositedScrollingForFramesEnabled( |
821 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 814 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
822 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( | 815 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( |
823 ShouldUseExpandedHeuristicsForGpuRasterization()); | 816 ShouldUseExpandedHeuristicsForGpuRasterization()); |
824 | 817 |
825 ApplyWebPreferences(webkit_preferences_, webview()); | 818 ApplyWebPreferences(webkit_preferences_, webview()); |
826 | 819 |
827 webview()->settings()->setAllowConnectingInsecureWebSocket( | 820 webview()->settings()->setAllowConnectingInsecureWebSocket( |
828 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 821 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
829 | 822 |
830 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | 823 RenderFrameProxy* proxy = NULL; |
824 if (params->proxy_routing_id != MSG_ROUTING_NONE) { | |
825 CHECK(params->swapped_out); | |
826 proxy = RenderFrameProxy::CreateProxyToReplaceFrame( | |
827 main_render_frame_.get(), params->proxy_routing_id); | |
828 main_render_frame_->set_render_frame_proxy(proxy); | |
829 } | |
830 | |
831 // In --site-per-process, just use the WebRemoteFrame as the main frame. | |
832 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && | |
833 proxy) { | |
834 webview()->setMainFrame(proxy->web_frame()); | |
835 } else { | |
836 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | |
837 } | |
831 main_render_frame_->Initialize(); | 838 main_render_frame_->Initialize(); |
832 | 839 |
833 if (switches::IsTouchDragDropEnabled()) | 840 if (switches::IsTouchDragDropEnabled()) |
834 webview()->settings()->setTouchDragDropEnabled(true); | 841 webview()->settings()->setTouchDragDropEnabled(true); |
835 | 842 |
836 if (switches::IsTouchEditingEnabled()) | 843 if (switches::IsTouchEditingEnabled()) |
837 webview()->settings()->setTouchEditingEnabled(true); | 844 webview()->settings()->setTouchEditingEnabled(true); |
838 | 845 |
839 if (!params->frame_name.empty()) | 846 if (!params->frame_name.empty()) |
840 webview()->mainFrame()->setName(params->frame_name); | 847 webview()->mainFrame()->setName(params->frame_name); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
874 // If we have an opener_id but we weren't created by a renderer, then | 881 // If we have an opener_id but we weren't created by a renderer, then |
875 // it's the browser asking us to set our opener to another RenderView. | 882 // it's the browser asking us to set our opener to another RenderView. |
876 if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { | 883 if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { |
877 RenderViewImpl* opener_view = FromRoutingID(params->opener_id); | 884 RenderViewImpl* opener_view = FromRoutingID(params->opener_id); |
878 if (opener_view) | 885 if (opener_view) |
879 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); | 886 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); |
880 } | 887 } |
881 | 888 |
882 // If we are initially swapped out, navigate to kSwappedOutURL. | 889 // If we are initially swapped out, navigate to kSwappedOutURL. |
883 // This ensures we are in a unique origin that others cannot script. | 890 // This ensures we are in a unique origin that others cannot script. |
884 if (is_swapped_out_) | 891 if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame()) |
885 NavigateToSwappedOutURL(webview()->mainFrame()); | 892 NavigateToSwappedOutURL(webview()->mainFrame()); |
886 } | 893 } |
887 | 894 |
888 RenderViewImpl::~RenderViewImpl() { | 895 RenderViewImpl::~RenderViewImpl() { |
889 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); | 896 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); |
890 it != disambiguation_bitmaps_.end(); | 897 it != disambiguation_bitmaps_.end(); |
891 ++it) | 898 ++it) |
892 delete it->second; | 899 delete it->second; |
893 history_page_ids_.clear(); | 900 history_page_ids_.clear(); |
894 | 901 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1328 if (webview()) | 1335 if (webview()) |
1329 webview()->transferActiveWheelFlingAnimation(params); | 1336 webview()->transferActiveWheelFlingAnimation(params); |
1330 } | 1337 } |
1331 | 1338 |
1332 bool RenderViewImpl::HasIMETextFocus() { | 1339 bool RenderViewImpl::HasIMETextFocus() { |
1333 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 1340 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
1334 } | 1341 } |
1335 | 1342 |
1336 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1343 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
1337 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1344 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
1338 if (main_frame) | 1345 if (main_frame && main_frame->isWebLocalFrame()) |
1339 GetContentClient()->SetActiveURL(main_frame->document().url()); | 1346 GetContentClient()->SetActiveURL(main_frame->document().url()); |
1340 | 1347 |
1341 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 1348 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
1342 RenderViewObserver* observer; | 1349 RenderViewObserver* observer; |
1343 while ((observer = it.GetNext()) != NULL) | 1350 while ((observer = it.GetNext()) != NULL) |
1344 if (observer->OnMessageReceived(message)) | 1351 if (observer->OnMessageReceived(message)) |
1345 return true; | 1352 return true; |
1346 | 1353 |
1347 bool handled = true; | 1354 bool handled = true; |
1348 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1355 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2265 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2272 DocumentState* document_state = DocumentState::FromDataSource(ds); |
2266 if (!document_state) { | 2273 if (!document_state) { |
2267 document_state = new DocumentState; | 2274 document_state = new DocumentState; |
2268 ds->setExtraData(document_state); | 2275 ds->setExtraData(document_state); |
2269 if (!content_initiated) | 2276 if (!content_initiated) |
2270 PopulateDocumentStateFromPending(document_state); | 2277 PopulateDocumentStateFromPending(document_state); |
2271 } | 2278 } |
2272 | 2279 |
2273 // Carry over the user agent override flag, if it exists. | 2280 // Carry over the user agent override flag, if it exists. |
2274 if (content_initiated && webview() && webview()->mainFrame() && | 2281 if (content_initiated && webview() && webview()->mainFrame() && |
2282 webview()->mainFrame()->isWebLocalFrame() && | |
2275 webview()->mainFrame()->dataSource()) { | 2283 webview()->mainFrame()->dataSource()) { |
2276 DocumentState* old_document_state = | 2284 DocumentState* old_document_state = |
2277 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); | 2285 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); |
2278 if (old_document_state) { | 2286 if (old_document_state) { |
2279 InternalDocumentStateData* internal_data = | 2287 InternalDocumentStateData* internal_data = |
2280 InternalDocumentStateData::FromDocumentState(document_state); | 2288 InternalDocumentStateData::FromDocumentState(document_state); |
2281 InternalDocumentStateData* old_internal_data = | 2289 InternalDocumentStateData* old_internal_data = |
2282 InternalDocumentStateData::FromDocumentState(old_document_state); | 2290 InternalDocumentStateData::FromDocumentState(old_document_state); |
2283 internal_data->set_is_overriding_user_agent( | 2291 internal_data->set_is_overriding_user_agent( |
2284 old_internal_data->is_overriding_user_agent()); | 2292 old_internal_data->is_overriding_user_agent()); |
(...skipping 15 matching lines...) Expand all Loading... | |
2300 // page. We are early enough in the request process here that we | 2308 // page. We are early enough in the request process here that we |
2301 // can still see the DocumentState of the previous page and set | 2309 // can still see the DocumentState of the previous page and set |
2302 // this value appropriately. | 2310 // this value appropriately. |
2303 // TODO(gavinp): catch the important case of navigation in a new | 2311 // TODO(gavinp): catch the important case of navigation in a new |
2304 // renderer process. | 2312 // renderer process. |
2305 if (webview()) { | 2313 if (webview()) { |
2306 if (WebFrame* old_frame = webview()->mainFrame()) { | 2314 if (WebFrame* old_frame = webview()->mainFrame()) { |
2307 const WebURLRequest& original_request = ds->originalRequest(); | 2315 const WebURLRequest& original_request = ds->originalRequest(); |
2308 const GURL referrer( | 2316 const GURL referrer( |
2309 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2317 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); |
2310 if (!referrer.is_empty() && | 2318 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && |
2311 DocumentState::FromDataSource( | 2319 DocumentState::FromDataSource(old_frame->dataSource()) |
2312 old_frame->dataSource())->was_prefetcher()) { | 2320 ->was_prefetcher()) { |
2313 for (; old_frame; old_frame = old_frame->traverseNext(false)) { | 2321 for (; old_frame; old_frame = old_frame->traverseNext(false)) { |
2314 WebDataSource* old_frame_ds = old_frame->dataSource(); | 2322 WebDataSource* old_frame_ds = old_frame->dataSource(); |
2315 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { | 2323 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { |
2316 document_state->set_was_referred_by_prefetcher(true); | 2324 document_state->set_was_referred_by_prefetcher(true); |
2317 break; | 2325 break; |
2318 } | 2326 } |
2319 } | 2327 } |
2320 } | 2328 } |
2321 } | 2329 } |
2322 } | 2330 } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2643 if (!webview()) | 2651 if (!webview()) |
2644 return; | 2652 return; |
2645 SendUpdateState(history_controller_->GetCurrentEntry()); | 2653 SendUpdateState(history_controller_->GetCurrentEntry()); |
2646 } | 2654 } |
2647 | 2655 |
2648 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { | 2656 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { |
2649 if (!webview()) | 2657 if (!webview()) |
2650 return NULL; | 2658 return NULL; |
2651 | 2659 |
2652 WebFrame* main_frame = webview()->mainFrame(); | 2660 WebFrame* main_frame = webview()->mainFrame(); |
2653 if (main_frame->document().isPluginDocument()) | 2661 if (main_frame->isWebLocalFrame() && |
2662 main_frame->document().isPluginDocument()) | |
2654 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); | 2663 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); |
2655 | 2664 |
2656 #if defined(ENABLE_PLUGINS) | 2665 #if defined(ENABLE_PLUGINS) |
2657 if (plugin_find_handler_) | 2666 if (plugin_find_handler_) |
2658 return plugin_find_handler_->container()->plugin(); | 2667 return plugin_find_handler_->container()->plugin(); |
2659 #endif | 2668 #endif |
2660 | 2669 |
2661 return NULL; | 2670 return NULL; |
2662 } | 2671 } |
2663 | 2672 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3164 } | 3173 } |
3165 #endif // defined(USE_DEFAULT_RENDER_THEME) | 3174 #endif // defined(USE_DEFAULT_RENDER_THEME) |
3166 | 3175 |
3167 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 3176 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
3168 RenderThreadImpl::current()->SetFlingCurveParameters( | 3177 RenderThreadImpl::current()->SetFlingCurveParameters( |
3169 renderer_prefs.touchpad_fling_profile, | 3178 renderer_prefs.touchpad_fling_profile, |
3170 renderer_prefs.touchscreen_fling_profile); | 3179 renderer_prefs.touchscreen_fling_profile); |
3171 | 3180 |
3172 // If the zoom level for this page matches the old zoom default, and this | 3181 // If the zoom level for this page matches the old zoom default, and this |
3173 // is not a plugin, update the zoom level to match the new default. | 3182 // is not a plugin, update the zoom level to match the new default. |
3174 if (webview() && !webview()->mainFrame()->document().isPluginDocument() && | 3183 if (webview() && webview()->mainFrame()->isWebLocalFrame() && |
3184 !webview()->mainFrame()->document().isPluginDocument() && | |
3175 !ZoomValuesEqual(old_zoom_level, | 3185 !ZoomValuesEqual(old_zoom_level, |
3176 renderer_preferences_.default_zoom_level) && | 3186 renderer_preferences_.default_zoom_level) && |
3177 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { | 3187 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { |
3178 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); | 3188 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); |
3179 zoomLevelChanged(); | 3189 zoomLevelChanged(); |
3180 } | 3190 } |
3181 | 3191 |
3182 if (webview() && | 3192 if (webview() && |
3183 old_accept_languages != renderer_preferences_.accept_languages) { | 3193 old_accept_languages != renderer_preferences_.accept_languages) { |
3184 webview()->acceptLanguagesChanged(); | 3194 webview()->acceptLanguagesChanged(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3276 // We use loadRequest instead of loadHTMLString because the former commits | 3286 // We use loadRequest instead of loadHTMLString because the former commits |
3277 // synchronously. Otherwise a new navigation can interrupt the navigation | 3287 // synchronously. Otherwise a new navigation can interrupt the navigation |
3278 // to kSwappedOutURL. If that happens to be to the page we had been | 3288 // to kSwappedOutURL. If that happens to be to the page we had been |
3279 // showing, then WebKit will never send a commit and we'll be left spinning. | 3289 // showing, then WebKit will never send a commit and we'll be left spinning. |
3280 // TODO(creis): Until we move this to RenderFrame, we may call this from a | 3290 // TODO(creis): Until we move this to RenderFrame, we may call this from a |
3281 // swapped out RenderFrame while our own is_swapped_out_ is false. | 3291 // swapped out RenderFrame while our own is_swapped_out_ is false. |
3282 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); | 3292 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); |
3283 CHECK(is_swapped_out_ || rf->is_swapped_out()); | 3293 CHECK(is_swapped_out_ || rf->is_swapped_out()); |
3284 GURL swappedOutURL(kSwappedOutURL); | 3294 GURL swappedOutURL(kSwappedOutURL); |
3285 WebURLRequest request(swappedOutURL); | 3295 WebURLRequest request(swappedOutURL); |
3286 frame->loadRequest(request); | 3296 if (frame->isWebLocalFrame()) |
3297 frame->loadRequest(request); | |
3287 } | 3298 } |
3288 | 3299 |
3289 void RenderViewImpl::OnClosePage() { | 3300 void RenderViewImpl::OnClosePage() { |
3290 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); | 3301 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); |
3291 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 3302 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
3292 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 3303 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
3293 // in the onunload handler from appearing. For now, we're bypassing that and | 3304 // in the onunload handler from appearing. For now, we're bypassing that and |
3294 // calling the FrameLoader's CloseURL method directly. This should be | 3305 // calling the FrameLoader's CloseURL method directly. This should be |
3295 // revisited to avoid having two ways to close a page. Having a single way | 3306 // revisited to avoid having two ways to close a page. Having a single way |
3296 // to close that can run onunload is also useful for fixing | 3307 // to close that can run onunload is also useful for fixing |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3379 (*i)->ViewFlushedPaint(); | 3390 (*i)->ViewFlushedPaint(); |
3380 } | 3391 } |
3381 #endif | 3392 #endif |
3382 | 3393 |
3383 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | 3394 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. |
3384 // See crbug.com/112921. | 3395 // See crbug.com/112921. |
3385 if (!webview()) | 3396 if (!webview()) |
3386 return; | 3397 return; |
3387 | 3398 |
3388 WebFrame* main_frame = webview()->mainFrame(); | 3399 WebFrame* main_frame = webview()->mainFrame(); |
3400 for (WebFrame* frame = main_frame; frame; | |
3401 frame = frame->traverseNext(false)) { | |
3402 if (frame->isWebLocalFrame()) | |
3403 main_frame = frame; | |
3404 } | |
3389 | 3405 |
3390 // If we have a provisional frame we are between the start and commit stages | 3406 // If we have a provisional frame we are between the start and commit stages |
3391 // of loading and we don't want to save stats. | 3407 // of loading and we don't want to save stats. |
3392 if (!main_frame->provisionalDataSource()) { | 3408 if (!main_frame->provisionalDataSource()) { |
3393 WebDataSource* ds = main_frame->dataSource(); | 3409 WebDataSource* ds = main_frame->dataSource(); |
3394 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3410 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3395 InternalDocumentStateData* data = | 3411 InternalDocumentStateData* data = |
3396 InternalDocumentStateData::FromDocumentState(document_state); | 3412 InternalDocumentStateData::FromDocumentState(document_state); |
3397 if (data->did_first_visually_non_empty_layout() && | 3413 if (data->did_first_visually_non_empty_layout() && |
3398 !data->did_first_visually_non_empty_paint()) { | 3414 !data->did_first_visually_non_empty_paint()) { |
3399 data->set_did_first_visually_non_empty_paint(true); | 3415 data->set_did_first_visually_non_empty_paint(true); |
3400 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_)); | 3416 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_)); |
3401 } | 3417 } |
3402 | 3418 |
3403 // TODO(jar): The following code should all be inside a method, probably in | 3419 // TODO(jar): The following code should all be inside a method, probably in |
3404 // NavigatorState. | 3420 // NavigatorState. |
3405 Time now = Time::Now(); | 3421 Time now = Time::Now(); |
3406 if (document_state->first_paint_time().is_null()) { | 3422 if (document_state->first_paint_time().is_null()) { |
3407 document_state->set_first_paint_time(now); | 3423 document_state->set_first_paint_time(now); |
3408 } | 3424 } |
3409 if (document_state->first_paint_after_load_time().is_null() && | 3425 if (document_state->first_paint_after_load_time().is_null() && |
3410 !document_state->finish_load_time().is_null()) { | 3426 !document_state->finish_load_time().is_null()) { |
3411 document_state->set_first_paint_after_load_time(now); | 3427 document_state->set_first_paint_after_load_time(now); |
3412 } | 3428 } |
3413 } | 3429 } |
3414 } | 3430 } |
3415 | 3431 |
3416 gfx::Vector2d RenderViewImpl::GetScrollOffset() { | 3432 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
3417 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 3433 WebFrame* main_frame = webview()->mainFrame(); |
3434 for (WebFrame* frame = main_frame; frame; | |
Charlie Reis
2014/07/24 22:36:32
This loop doesn't make sense to me. Wouldn't it e
kenrb
2014/07/25 23:42:06
Changed to find the first localFrame in the tree.
| |
3435 frame = frame->traverseNext(false)) { | |
3436 if (frame->isWebLocalFrame()) | |
3437 main_frame = frame; | |
3438 } | |
3439 | |
3440 WebSize scroll_offset = main_frame->scrollOffset(); | |
3418 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 3441 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
3419 } | 3442 } |
3420 | 3443 |
3421 void RenderViewImpl::OnClearFocusedElement() { | 3444 void RenderViewImpl::OnClearFocusedElement() { |
3422 if (webview()) | 3445 if (webview()) |
3423 webview()->clearFocusedElement(); | 3446 webview()->clearFocusedElement(); |
3424 } | 3447 } |
3425 | 3448 |
3426 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 3449 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
3427 if (webview()) | 3450 if (webview()) |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3592 for (plugin_it = plugin_delegates_.begin(); | 3615 for (plugin_it = plugin_delegates_.begin(); |
3593 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3616 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
3594 (*plugin_it)->SetContainerVisibility(true); | 3617 (*plugin_it)->SetContainerVisibility(true); |
3595 } | 3618 } |
3596 #endif // OS_MACOSX | 3619 #endif // OS_MACOSX |
3597 #endif // ENABLE_PLUGINS | 3620 #endif // ENABLE_PLUGINS |
3598 } | 3621 } |
3599 | 3622 |
3600 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 3623 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
3601 DCHECK(webview()); | 3624 DCHECK(webview()); |
3602 if (webview()->mainFrame()) | 3625 if (webview()->mainFrame()->isWebLocalFrame()) |
3603 return GURL(webview()->mainFrame()->document().url()); | 3626 return GURL(webview()->mainFrame()->document().url()); |
3604 else | 3627 else |
3605 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 3628 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
3606 } | 3629 } |
3607 | 3630 |
3608 void RenderViewImpl::OnSetFocus(bool enable) { | 3631 void RenderViewImpl::OnSetFocus(bool enable) { |
3609 RenderWidget::OnSetFocus(enable); | 3632 RenderWidget::OnSetFocus(enable); |
3610 | 3633 |
3611 #if defined(ENABLE_PLUGINS) | 3634 #if defined(ENABLE_PLUGINS) |
3612 if (webview() && webview()->isActive()) { | 3635 if (webview() && webview()->isActive()) { |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4287 std::vector<gfx::Size> sizes; | 4310 std::vector<gfx::Size> sizes; |
4288 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4311 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4289 if (!url.isEmpty()) | 4312 if (!url.isEmpty()) |
4290 urls.push_back( | 4313 urls.push_back( |
4291 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4314 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4292 } | 4315 } |
4293 SendUpdateFaviconURL(urls); | 4316 SendUpdateFaviconURL(urls); |
4294 } | 4317 } |
4295 | 4318 |
4296 } // namespace content | 4319 } // namespace content |
OLD | NEW |