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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 // Ensure we start with a valid next_page_id_ from the browser. | 752 // Ensure we start with a valid next_page_id_ from the browser. |
753 DCHECK_GE(next_page_id_, 0); | 753 DCHECK_GE(next_page_id_, 0); |
754 | 754 |
755 main_render_frame_.reset(RenderFrameImpl::Create( | 755 main_render_frame_.reset(RenderFrameImpl::Create( |
756 this, params->main_frame_routing_id)); | 756 this, params->main_frame_routing_id)); |
757 // The main frame WebLocalFrame object is closed by | 757 // The main frame WebLocalFrame object is closed by |
758 // RenderFrameImpl::frameDetached(). | 758 // RenderFrameImpl::frameDetached(). |
759 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); | 759 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); |
760 main_render_frame_->SetWebFrame(web_frame); | 760 main_render_frame_->SetWebFrame(web_frame); |
761 | 761 |
762 if (params->proxy_routing_id != MSG_ROUTING_NONE) { | |
763 CHECK(params->swapped_out); | |
764 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame( | |
765 main_render_frame_.get(), params->proxy_routing_id); | |
766 main_render_frame_->set_render_frame_proxy(proxy); | |
767 } | |
768 | |
769 webwidget_ = WebView::create(this); | 762 webwidget_ = WebView::create(this); |
770 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 763 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
771 | 764 |
772 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 765 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
773 | 766 |
774 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 767 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
775 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 768 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
776 | 769 |
777 #if defined(OS_ANDROID) | 770 #if defined(OS_ANDROID) |
778 const std::string region_code = | 771 const std::string region_code = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 webview()->settings()->setCompositedScrollingForFramesEnabled( | 811 webview()->settings()->setCompositedScrollingForFramesEnabled( |
819 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 812 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
820 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( | 813 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( |
821 ShouldUseExpandedHeuristicsForGpuRasterization()); | 814 ShouldUseExpandedHeuristicsForGpuRasterization()); |
822 | 815 |
823 ApplyWebPreferences(webkit_preferences_, webview()); | 816 ApplyWebPreferences(webkit_preferences_, webview()); |
824 | 817 |
825 webview()->settings()->setAllowConnectingInsecureWebSocket( | 818 webview()->settings()->setAllowConnectingInsecureWebSocket( |
826 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 819 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
827 | 820 |
828 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | 821 RenderFrameProxy* proxy = NULL; |
| 822 if (params->proxy_routing_id != MSG_ROUTING_NONE) { |
| 823 CHECK(params->swapped_out); |
| 824 proxy = RenderFrameProxy::CreateProxyToReplaceFrame( |
| 825 main_render_frame_.get(), params->proxy_routing_id); |
| 826 main_render_frame_->set_render_frame_proxy(proxy); |
| 827 } |
| 828 |
| 829 // In --site-per-process, just use the WebRemoteFrame as the main frame. |
| 830 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && |
| 831 proxy) { |
| 832 webview()->setMainFrame(proxy->web_frame()); |
| 833 } else { |
| 834 webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
| 835 } |
829 main_render_frame_->Initialize(); | 836 main_render_frame_->Initialize(); |
830 | 837 |
831 if (switches::IsTouchDragDropEnabled()) | 838 if (switches::IsTouchDragDropEnabled()) |
832 webview()->settings()->setTouchDragDropEnabled(true); | 839 webview()->settings()->setTouchDragDropEnabled(true); |
833 | 840 |
834 if (switches::IsTouchEditingEnabled()) | 841 if (switches::IsTouchEditingEnabled()) |
835 webview()->settings()->setTouchEditingEnabled(true); | 842 webview()->settings()->setTouchEditingEnabled(true); |
836 | 843 |
837 if (!params->frame_name.empty()) | 844 if (!params->frame_name.empty()) |
838 webview()->mainFrame()->setName(params->frame_name); | 845 webview()->mainFrame()->setName(params->frame_name); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 // If we have an opener_id but we weren't created by a renderer, then | 879 // If we have an opener_id but we weren't created by a renderer, then |
873 // it's the browser asking us to set our opener to another RenderView. | 880 // it's the browser asking us to set our opener to another RenderView. |
874 if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { | 881 if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { |
875 RenderViewImpl* opener_view = FromRoutingID(params->opener_id); | 882 RenderViewImpl* opener_view = FromRoutingID(params->opener_id); |
876 if (opener_view) | 883 if (opener_view) |
877 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); | 884 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); |
878 } | 885 } |
879 | 886 |
880 // If we are initially swapped out, navigate to kSwappedOutURL. | 887 // If we are initially swapped out, navigate to kSwappedOutURL. |
881 // This ensures we are in a unique origin that others cannot script. | 888 // This ensures we are in a unique origin that others cannot script. |
882 if (is_swapped_out_) | 889 if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame()) |
883 NavigateToSwappedOutURL(webview()->mainFrame()); | 890 NavigateToSwappedOutURL(webview()->mainFrame()); |
884 } | 891 } |
885 | 892 |
886 RenderViewImpl::~RenderViewImpl() { | 893 RenderViewImpl::~RenderViewImpl() { |
887 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); | 894 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); |
888 it != disambiguation_bitmaps_.end(); | 895 it != disambiguation_bitmaps_.end(); |
889 ++it) | 896 ++it) |
890 delete it->second; | 897 delete it->second; |
891 history_page_ids_.clear(); | 898 history_page_ids_.clear(); |
892 | 899 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 if (webview()) | 1331 if (webview()) |
1325 webview()->transferActiveWheelFlingAnimation(params); | 1332 webview()->transferActiveWheelFlingAnimation(params); |
1326 } | 1333 } |
1327 | 1334 |
1328 bool RenderViewImpl::HasIMETextFocus() { | 1335 bool RenderViewImpl::HasIMETextFocus() { |
1329 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 1336 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
1330 } | 1337 } |
1331 | 1338 |
1332 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1339 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
1333 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1340 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
1334 if (main_frame) | 1341 if (main_frame && main_frame->isWebLocalFrame()) |
1335 GetContentClient()->SetActiveURL(main_frame->document().url()); | 1342 GetContentClient()->SetActiveURL(main_frame->document().url()); |
1336 | 1343 |
1337 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 1344 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
1338 RenderViewObserver* observer; | 1345 RenderViewObserver* observer; |
1339 while ((observer = it.GetNext()) != NULL) | 1346 while ((observer = it.GetNext()) != NULL) |
1340 if (observer->OnMessageReceived(message)) | 1347 if (observer->OnMessageReceived(message)) |
1341 return true; | 1348 return true; |
1342 | 1349 |
1343 bool handled = true; | 1350 bool handled = true; |
1344 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1351 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2268 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2275 DocumentState* document_state = DocumentState::FromDataSource(ds); |
2269 if (!document_state) { | 2276 if (!document_state) { |
2270 document_state = new DocumentState; | 2277 document_state = new DocumentState; |
2271 ds->setExtraData(document_state); | 2278 ds->setExtraData(document_state); |
2272 if (!content_initiated) | 2279 if (!content_initiated) |
2273 PopulateDocumentStateFromPending(document_state); | 2280 PopulateDocumentStateFromPending(document_state); |
2274 } | 2281 } |
2275 | 2282 |
2276 // Carry over the user agent override flag, if it exists. | 2283 // Carry over the user agent override flag, if it exists. |
2277 if (content_initiated && webview() && webview()->mainFrame() && | 2284 if (content_initiated && webview() && webview()->mainFrame() && |
| 2285 webview()->mainFrame()->isWebLocalFrame() && |
2278 webview()->mainFrame()->dataSource()) { | 2286 webview()->mainFrame()->dataSource()) { |
2279 DocumentState* old_document_state = | 2287 DocumentState* old_document_state = |
2280 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); | 2288 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); |
2281 if (old_document_state) { | 2289 if (old_document_state) { |
2282 InternalDocumentStateData* internal_data = | 2290 InternalDocumentStateData* internal_data = |
2283 InternalDocumentStateData::FromDocumentState(document_state); | 2291 InternalDocumentStateData::FromDocumentState(document_state); |
2284 InternalDocumentStateData* old_internal_data = | 2292 InternalDocumentStateData* old_internal_data = |
2285 InternalDocumentStateData::FromDocumentState(old_document_state); | 2293 InternalDocumentStateData::FromDocumentState(old_document_state); |
2286 internal_data->set_is_overriding_user_agent( | 2294 internal_data->set_is_overriding_user_agent( |
2287 old_internal_data->is_overriding_user_agent()); | 2295 old_internal_data->is_overriding_user_agent()); |
(...skipping 15 matching lines...) Expand all Loading... |
2303 // page. We are early enough in the request process here that we | 2311 // page. We are early enough in the request process here that we |
2304 // can still see the DocumentState of the previous page and set | 2312 // can still see the DocumentState of the previous page and set |
2305 // this value appropriately. | 2313 // this value appropriately. |
2306 // TODO(gavinp): catch the important case of navigation in a new | 2314 // TODO(gavinp): catch the important case of navigation in a new |
2307 // renderer process. | 2315 // renderer process. |
2308 if (webview()) { | 2316 if (webview()) { |
2309 if (WebFrame* old_frame = webview()->mainFrame()) { | 2317 if (WebFrame* old_frame = webview()->mainFrame()) { |
2310 const WebURLRequest& original_request = ds->originalRequest(); | 2318 const WebURLRequest& original_request = ds->originalRequest(); |
2311 const GURL referrer( | 2319 const GURL referrer( |
2312 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2320 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); |
2313 if (!referrer.is_empty() && | 2321 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && |
2314 DocumentState::FromDataSource( | 2322 DocumentState::FromDataSource(old_frame->dataSource()) |
2315 old_frame->dataSource())->was_prefetcher()) { | 2323 ->was_prefetcher()) { |
2316 for (; old_frame; old_frame = old_frame->traverseNext(false)) { | 2324 for (; old_frame; old_frame = old_frame->traverseNext(false)) { |
2317 WebDataSource* old_frame_ds = old_frame->dataSource(); | 2325 WebDataSource* old_frame_ds = old_frame->dataSource(); |
2318 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { | 2326 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { |
2319 document_state->set_was_referred_by_prefetcher(true); | 2327 document_state->set_was_referred_by_prefetcher(true); |
2320 break; | 2328 break; |
2321 } | 2329 } |
2322 } | 2330 } |
2323 } | 2331 } |
2324 } | 2332 } |
2325 } | 2333 } |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 if (!webview()) | 2661 if (!webview()) |
2654 return; | 2662 return; |
2655 SendUpdateState(history_controller_->GetCurrentEntry()); | 2663 SendUpdateState(history_controller_->GetCurrentEntry()); |
2656 } | 2664 } |
2657 | 2665 |
2658 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { | 2666 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { |
2659 if (!webview()) | 2667 if (!webview()) |
2660 return NULL; | 2668 return NULL; |
2661 | 2669 |
2662 WebFrame* main_frame = webview()->mainFrame(); | 2670 WebFrame* main_frame = webview()->mainFrame(); |
2663 if (main_frame->document().isPluginDocument()) | 2671 if (main_frame->isWebLocalFrame() && |
| 2672 main_frame->document().isPluginDocument()) |
2664 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); | 2673 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); |
2665 | 2674 |
2666 #if defined(ENABLE_PLUGINS) | 2675 #if defined(ENABLE_PLUGINS) |
2667 if (plugin_find_handler_) | 2676 if (plugin_find_handler_) |
2668 return plugin_find_handler_->container()->plugin(); | 2677 return plugin_find_handler_->container()->plugin(); |
2669 #endif | 2678 #endif |
2670 | 2679 |
2671 return NULL; | 2680 return NULL; |
2672 } | 2681 } |
2673 | 2682 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3174 } | 3183 } |
3175 #endif // defined(USE_DEFAULT_RENDER_THEME) | 3184 #endif // defined(USE_DEFAULT_RENDER_THEME) |
3176 | 3185 |
3177 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 3186 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
3178 RenderThreadImpl::current()->SetFlingCurveParameters( | 3187 RenderThreadImpl::current()->SetFlingCurveParameters( |
3179 renderer_prefs.touchpad_fling_profile, | 3188 renderer_prefs.touchpad_fling_profile, |
3180 renderer_prefs.touchscreen_fling_profile); | 3189 renderer_prefs.touchscreen_fling_profile); |
3181 | 3190 |
3182 // If the zoom level for this page matches the old zoom default, and this | 3191 // If the zoom level for this page matches the old zoom default, and this |
3183 // is not a plugin, update the zoom level to match the new default. | 3192 // is not a plugin, update the zoom level to match the new default. |
3184 if (webview() && !webview()->mainFrame()->document().isPluginDocument() && | 3193 if (webview() && webview()->mainFrame()->isWebLocalFrame() && |
| 3194 !webview()->mainFrame()->document().isPluginDocument() && |
3185 !ZoomValuesEqual(old_zoom_level, | 3195 !ZoomValuesEqual(old_zoom_level, |
3186 renderer_preferences_.default_zoom_level) && | 3196 renderer_preferences_.default_zoom_level) && |
3187 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { | 3197 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { |
3188 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); | 3198 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); |
3189 zoomLevelChanged(); | 3199 zoomLevelChanged(); |
3190 } | 3200 } |
3191 | 3201 |
3192 if (webview() && | 3202 if (webview() && |
3193 old_accept_languages != renderer_preferences_.accept_languages) { | 3203 old_accept_languages != renderer_preferences_.accept_languages) { |
3194 webview()->acceptLanguagesChanged(); | 3204 webview()->acceptLanguagesChanged(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3286 // We use loadRequest instead of loadHTMLString because the former commits | 3296 // We use loadRequest instead of loadHTMLString because the former commits |
3287 // synchronously. Otherwise a new navigation can interrupt the navigation | 3297 // synchronously. Otherwise a new navigation can interrupt the navigation |
3288 // to kSwappedOutURL. If that happens to be to the page we had been | 3298 // to kSwappedOutURL. If that happens to be to the page we had been |
3289 // showing, then WebKit will never send a commit and we'll be left spinning. | 3299 // showing, then WebKit will never send a commit and we'll be left spinning. |
3290 // TODO(creis): Until we move this to RenderFrame, we may call this from a | 3300 // TODO(creis): Until we move this to RenderFrame, we may call this from a |
3291 // swapped out RenderFrame while our own is_swapped_out_ is false. | 3301 // swapped out RenderFrame while our own is_swapped_out_ is false. |
3292 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); | 3302 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); |
3293 CHECK(is_swapped_out_ || rf->is_swapped_out()); | 3303 CHECK(is_swapped_out_ || rf->is_swapped_out()); |
3294 GURL swappedOutURL(kSwappedOutURL); | 3304 GURL swappedOutURL(kSwappedOutURL); |
3295 WebURLRequest request(swappedOutURL); | 3305 WebURLRequest request(swappedOutURL); |
3296 frame->loadRequest(request); | 3306 if (frame->isWebLocalFrame()) |
| 3307 frame->loadRequest(request); |
3297 } | 3308 } |
3298 | 3309 |
3299 void RenderViewImpl::OnClosePage() { | 3310 void RenderViewImpl::OnClosePage() { |
3300 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); | 3311 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); |
3301 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 3312 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
3302 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 3313 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
3303 // in the onunload handler from appearing. For now, we're bypassing that and | 3314 // in the onunload handler from appearing. For now, we're bypassing that and |
3304 // calling the FrameLoader's CloseURL method directly. This should be | 3315 // calling the FrameLoader's CloseURL method directly. This should be |
3305 // revisited to avoid having two ways to close a page. Having a single way | 3316 // revisited to avoid having two ways to close a page. Having a single way |
3306 // to close that can run onunload is also useful for fixing | 3317 // to close that can run onunload is also useful for fixing |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 (*i)->ViewFlushedPaint(); | 3400 (*i)->ViewFlushedPaint(); |
3390 } | 3401 } |
3391 #endif | 3402 #endif |
3392 | 3403 |
3393 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | 3404 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. |
3394 // See crbug.com/112921. | 3405 // See crbug.com/112921. |
3395 if (!webview()) | 3406 if (!webview()) |
3396 return; | 3407 return; |
3397 | 3408 |
3398 WebFrame* main_frame = webview()->mainFrame(); | 3409 WebFrame* main_frame = webview()->mainFrame(); |
| 3410 for (WebFrame* frame = main_frame; frame; |
| 3411 frame = frame->traverseNext(false)) { |
| 3412 if (frame->isWebLocalFrame()) |
| 3413 main_frame = frame; |
| 3414 } |
3399 | 3415 |
3400 // If we have a provisional frame we are between the start and commit stages | 3416 // If we have a provisional frame we are between the start and commit stages |
3401 // of loading and we don't want to save stats. | 3417 // of loading and we don't want to save stats. |
3402 if (!main_frame->provisionalDataSource()) { | 3418 if (!main_frame->provisionalDataSource()) { |
3403 WebDataSource* ds = main_frame->dataSource(); | 3419 WebDataSource* ds = main_frame->dataSource(); |
3404 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3420 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3405 | 3421 |
3406 // TODO(jar): The following code should all be inside a method, probably in | 3422 // TODO(jar): The following code should all be inside a method, probably in |
3407 // NavigatorState. | 3423 // NavigatorState. |
3408 Time now = Time::Now(); | 3424 Time now = Time::Now(); |
3409 if (document_state->first_paint_time().is_null()) { | 3425 if (document_state->first_paint_time().is_null()) { |
3410 document_state->set_first_paint_time(now); | 3426 document_state->set_first_paint_time(now); |
3411 } | 3427 } |
3412 if (document_state->first_paint_after_load_time().is_null() && | 3428 if (document_state->first_paint_after_load_time().is_null() && |
3413 !document_state->finish_load_time().is_null()) { | 3429 !document_state->finish_load_time().is_null()) { |
3414 document_state->set_first_paint_after_load_time(now); | 3430 document_state->set_first_paint_after_load_time(now); |
3415 } | 3431 } |
3416 } | 3432 } |
3417 } | 3433 } |
3418 | 3434 |
3419 gfx::Vector2d RenderViewImpl::GetScrollOffset() { | 3435 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
3420 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 3436 WebFrame* main_frame = webview()->mainFrame(); |
| 3437 for (WebFrame* frame = main_frame; frame; |
| 3438 frame = frame->traverseNext(false)) { |
| 3439 // TODO(nasko): This is a hack for the case in which the top-level |
| 3440 // frame is being rendered in another process. It will not |
| 3441 // behave correctly for out of process iframes. |
| 3442 if (frame->isWebLocalFrame()) { |
| 3443 main_frame = frame; |
| 3444 break; |
| 3445 } |
| 3446 } |
| 3447 |
| 3448 WebSize scroll_offset = main_frame->scrollOffset(); |
3421 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 3449 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
3422 } | 3450 } |
3423 | 3451 |
3424 void RenderViewImpl::OnClearFocusedElement() { | 3452 void RenderViewImpl::OnClearFocusedElement() { |
3425 if (webview()) | 3453 if (webview()) |
3426 webview()->clearFocusedElement(); | 3454 webview()->clearFocusedElement(); |
3427 } | 3455 } |
3428 | 3456 |
3429 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 3457 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
3430 if (webview()) | 3458 if (webview()) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 for (plugin_it = plugin_delegates_.begin(); | 3625 for (plugin_it = plugin_delegates_.begin(); |
3598 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3626 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
3599 (*plugin_it)->SetContainerVisibility(true); | 3627 (*plugin_it)->SetContainerVisibility(true); |
3600 } | 3628 } |
3601 #endif // OS_MACOSX | 3629 #endif // OS_MACOSX |
3602 #endif // ENABLE_PLUGINS | 3630 #endif // ENABLE_PLUGINS |
3603 } | 3631 } |
3604 | 3632 |
3605 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 3633 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
3606 DCHECK(webview()); | 3634 DCHECK(webview()); |
3607 if (webview()->mainFrame()) | 3635 if (webview()->mainFrame()->isWebLocalFrame()) |
3608 return GURL(webview()->mainFrame()->document().url()); | 3636 return GURL(webview()->mainFrame()->document().url()); |
3609 else | 3637 else |
3610 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 3638 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
3611 } | 3639 } |
3612 | 3640 |
3613 void RenderViewImpl::OnSetFocus(bool enable) { | 3641 void RenderViewImpl::OnSetFocus(bool enable) { |
3614 RenderWidget::OnSetFocus(enable); | 3642 RenderWidget::OnSetFocus(enable); |
3615 | 3643 |
3616 #if defined(ENABLE_PLUGINS) | 3644 #if defined(ENABLE_PLUGINS) |
3617 if (webview() && webview()->isActive()) { | 3645 if (webview() && webview()->isActive()) { |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4295 std::vector<gfx::Size> sizes; | 4323 std::vector<gfx::Size> sizes; |
4296 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4324 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4297 if (!url.isEmpty()) | 4325 if (!url.isEmpty()) |
4298 urls.push_back( | 4326 urls.push_back( |
4299 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4327 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4300 } | 4328 } |
4301 SendUpdateFaviconURL(urls); | 4329 SendUpdateFaviconURL(urls); |
4302 } | 4330 } |
4303 | 4331 |
4304 } // namespace content | 4332 } // namespace content |
OLD | NEW |