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