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