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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 if (webview()) | 1329 if (webview()) |
1323 webview()->transferActiveWheelFlingAnimation(params); | 1330 webview()->transferActiveWheelFlingAnimation(params); |
1324 } | 1331 } |
1325 | 1332 |
1326 bool RenderViewImpl::HasIMETextFocus() { | 1333 bool RenderViewImpl::HasIMETextFocus() { |
1327 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 1334 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
1328 } | 1335 } |
1329 | 1336 |
1330 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1337 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
1331 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1338 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
1332 if (main_frame) | 1339 if (main_frame && main_frame->isWebLocalFrame()) |
1333 GetContentClient()->SetActiveURL(main_frame->document().url()); | 1340 GetContentClient()->SetActiveURL(main_frame->document().url()); |
1334 | 1341 |
1335 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 1342 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
1336 RenderViewObserver* observer; | 1343 RenderViewObserver* observer; |
1337 while ((observer = it.GetNext()) != NULL) | 1344 while ((observer = it.GetNext()) != NULL) |
1338 if (observer->OnMessageReceived(message)) | 1345 if (observer->OnMessageReceived(message)) |
1339 return true; | 1346 return true; |
1340 | 1347 |
1341 bool handled = true; | 1348 bool handled = true; |
1342 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1349 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2266 DocumentState* document_state = DocumentState::FromDataSource(ds); |
2260 if (!document_state) { | 2267 if (!document_state) { |
2261 document_state = new DocumentState; | 2268 document_state = new DocumentState; |
2262 ds->setExtraData(document_state); | 2269 ds->setExtraData(document_state); |
2263 if (!content_initiated) | 2270 if (!content_initiated) |
2264 PopulateDocumentStateFromPending(document_state); | 2271 PopulateDocumentStateFromPending(document_state); |
2265 } | 2272 } |
2266 | 2273 |
2267 // Carry over the user agent override flag, if it exists. | 2274 // Carry over the user agent override flag, if it exists. |
2268 if (content_initiated && webview() && webview()->mainFrame() && | 2275 if (content_initiated && webview() && webview()->mainFrame() && |
| 2276 webview()->mainFrame()->isWebLocalFrame() && |
2269 webview()->mainFrame()->dataSource()) { | 2277 webview()->mainFrame()->dataSource()) { |
2270 DocumentState* old_document_state = | 2278 DocumentState* old_document_state = |
2271 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); | 2279 DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); |
2272 if (old_document_state) { | 2280 if (old_document_state) { |
2273 InternalDocumentStateData* internal_data = | 2281 InternalDocumentStateData* internal_data = |
2274 InternalDocumentStateData::FromDocumentState(document_state); | 2282 InternalDocumentStateData::FromDocumentState(document_state); |
2275 InternalDocumentStateData* old_internal_data = | 2283 InternalDocumentStateData* old_internal_data = |
2276 InternalDocumentStateData::FromDocumentState(old_document_state); | 2284 InternalDocumentStateData::FromDocumentState(old_document_state); |
2277 internal_data->set_is_overriding_user_agent( | 2285 internal_data->set_is_overriding_user_agent( |
2278 old_internal_data->is_overriding_user_agent()); | 2286 old_internal_data->is_overriding_user_agent()); |
(...skipping 15 matching lines...) Expand all Loading... |
2294 // page. We are early enough in the request process here that we | 2302 // page. We are early enough in the request process here that we |
2295 // can still see the DocumentState of the previous page and set | 2303 // can still see the DocumentState of the previous page and set |
2296 // this value appropriately. | 2304 // this value appropriately. |
2297 // TODO(gavinp): catch the important case of navigation in a new | 2305 // TODO(gavinp): catch the important case of navigation in a new |
2298 // renderer process. | 2306 // renderer process. |
2299 if (webview()) { | 2307 if (webview()) { |
2300 if (WebFrame* old_frame = webview()->mainFrame()) { | 2308 if (WebFrame* old_frame = webview()->mainFrame()) { |
2301 const WebURLRequest& original_request = ds->originalRequest(); | 2309 const WebURLRequest& original_request = ds->originalRequest(); |
2302 const GURL referrer( | 2310 const GURL referrer( |
2303 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2311 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); |
2304 if (!referrer.is_empty() && | 2312 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && |
2305 DocumentState::FromDataSource( | 2313 DocumentState::FromDataSource(old_frame->dataSource()) |
2306 old_frame->dataSource())->was_prefetcher()) { | 2314 ->was_prefetcher()) { |
2307 for (; old_frame; old_frame = old_frame->traverseNext(false)) { | 2315 for (; old_frame; old_frame = old_frame->traverseNext(false)) { |
2308 WebDataSource* old_frame_ds = old_frame->dataSource(); | 2316 WebDataSource* old_frame_ds = old_frame->dataSource(); |
2309 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { | 2317 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { |
2310 document_state->set_was_referred_by_prefetcher(true); | 2318 document_state->set_was_referred_by_prefetcher(true); |
2311 break; | 2319 break; |
2312 } | 2320 } |
2313 } | 2321 } |
2314 } | 2322 } |
2315 } | 2323 } |
2316 } | 2324 } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 if (!webview()) | 2645 if (!webview()) |
2638 return; | 2646 return; |
2639 SendUpdateState(history_controller_->GetCurrentEntry()); | 2647 SendUpdateState(history_controller_->GetCurrentEntry()); |
2640 } | 2648 } |
2641 | 2649 |
2642 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { | 2650 blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { |
2643 if (!webview()) | 2651 if (!webview()) |
2644 return NULL; | 2652 return NULL; |
2645 | 2653 |
2646 WebFrame* main_frame = webview()->mainFrame(); | 2654 WebFrame* main_frame = webview()->mainFrame(); |
2647 if (main_frame->document().isPluginDocument()) | 2655 if (main_frame->isWebLocalFrame() && |
| 2656 main_frame->document().isPluginDocument()) |
2648 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); | 2657 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); |
2649 | 2658 |
2650 #if defined(ENABLE_PLUGINS) | 2659 #if defined(ENABLE_PLUGINS) |
2651 if (plugin_find_handler_) | 2660 if (plugin_find_handler_) |
2652 return plugin_find_handler_->container()->plugin(); | 2661 return plugin_find_handler_->container()->plugin(); |
2653 #endif | 2662 #endif |
2654 | 2663 |
2655 return NULL; | 2664 return NULL; |
2656 } | 2665 } |
2657 | 2666 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3158 } | 3167 } |
3159 #endif // defined(USE_DEFAULT_RENDER_THEME) | 3168 #endif // defined(USE_DEFAULT_RENDER_THEME) |
3160 | 3169 |
3161 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 3170 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
3162 RenderThreadImpl::current()->SetFlingCurveParameters( | 3171 RenderThreadImpl::current()->SetFlingCurveParameters( |
3163 renderer_prefs.touchpad_fling_profile, | 3172 renderer_prefs.touchpad_fling_profile, |
3164 renderer_prefs.touchscreen_fling_profile); | 3173 renderer_prefs.touchscreen_fling_profile); |
3165 | 3174 |
3166 // If the zoom level for this page matches the old zoom default, and this | 3175 // If the zoom level for this page matches the old zoom default, and this |
3167 // is not a plugin, update the zoom level to match the new default. | 3176 // is not a plugin, update the zoom level to match the new default. |
3168 if (webview() && !webview()->mainFrame()->document().isPluginDocument() && | 3177 if (webview() && webview()->mainFrame()->isWebLocalFrame() && |
| 3178 !webview()->mainFrame()->document().isPluginDocument() && |
3169 !ZoomValuesEqual(old_zoom_level, | 3179 !ZoomValuesEqual(old_zoom_level, |
3170 renderer_preferences_.default_zoom_level) && | 3180 renderer_preferences_.default_zoom_level) && |
3171 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { | 3181 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { |
3172 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); | 3182 webview()->setZoomLevel(renderer_preferences_.default_zoom_level); |
3173 zoomLevelChanged(); | 3183 zoomLevelChanged(); |
3174 } | 3184 } |
3175 | 3185 |
3176 if (webview() && | 3186 if (webview() && |
3177 old_accept_languages != renderer_preferences_.accept_languages) { | 3187 old_accept_languages != renderer_preferences_.accept_languages) { |
3178 webview()->acceptLanguagesChanged(); | 3188 webview()->acceptLanguagesChanged(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 // We use loadRequest instead of loadHTMLString because the former commits | 3280 // We use loadRequest instead of loadHTMLString because the former commits |
3271 // synchronously. Otherwise a new navigation can interrupt the navigation | 3281 // synchronously. Otherwise a new navigation can interrupt the navigation |
3272 // to kSwappedOutURL. If that happens to be to the page we had been | 3282 // to kSwappedOutURL. If that happens to be to the page we had been |
3273 // showing, then WebKit will never send a commit and we'll be left spinning. | 3283 // showing, then WebKit will never send a commit and we'll be left spinning. |
3274 // TODO(creis): Until we move this to RenderFrame, we may call this from a | 3284 // TODO(creis): Until we move this to RenderFrame, we may call this from a |
3275 // swapped out RenderFrame while our own is_swapped_out_ is false. | 3285 // swapped out RenderFrame while our own is_swapped_out_ is false. |
3276 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); | 3286 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); |
3277 CHECK(is_swapped_out_ || rf->is_swapped_out()); | 3287 CHECK(is_swapped_out_ || rf->is_swapped_out()); |
3278 GURL swappedOutURL(kSwappedOutURL); | 3288 GURL swappedOutURL(kSwappedOutURL); |
3279 WebURLRequest request(swappedOutURL); | 3289 WebURLRequest request(swappedOutURL); |
3280 frame->loadRequest(request); | 3290 if (frame->isWebLocalFrame()) |
| 3291 frame->loadRequest(request); |
3281 } | 3292 } |
3282 | 3293 |
3283 void RenderViewImpl::OnClosePage() { | 3294 void RenderViewImpl::OnClosePage() { |
3284 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); | 3295 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); |
3285 // 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 |
3286 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 3297 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
3287 // 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 |
3288 // calling the FrameLoader's CloseURL method directly. This should be | 3299 // calling the FrameLoader's CloseURL method directly. This should be |
3289 // 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 |
3290 // 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... |
3373 (*i)->ViewFlushedPaint(); | 3384 (*i)->ViewFlushedPaint(); |
3374 } | 3385 } |
3375 #endif | 3386 #endif |
3376 | 3387 |
3377 // 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. |
3378 // See crbug.com/112921. | 3389 // See crbug.com/112921. |
3379 if (!webview()) | 3390 if (!webview()) |
3380 return; | 3391 return; |
3381 | 3392 |
3382 WebFrame* main_frame = webview()->mainFrame(); | 3393 WebFrame* main_frame = webview()->mainFrame(); |
| 3394 for (WebFrame* frame = main_frame; frame; |
| 3395 frame = frame->traverseNext(false)) { |
| 3396 if (frame->isWebLocalFrame()) |
| 3397 main_frame = frame; |
| 3398 } |
3383 | 3399 |
3384 // If we have a provisional frame we are between the start and commit stages | 3400 // If we have a provisional frame we are between the start and commit stages |
3385 // of loading and we don't want to save stats. | 3401 // of loading and we don't want to save stats. |
3386 if (!main_frame->provisionalDataSource()) { | 3402 if (!main_frame->provisionalDataSource()) { |
3387 WebDataSource* ds = main_frame->dataSource(); | 3403 WebDataSource* ds = main_frame->dataSource(); |
3388 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3404 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3389 | 3405 |
3390 // TODO(jar): The following code should all be inside a method, probably in | 3406 // TODO(jar): The following code should all be inside a method, probably in |
3391 // NavigatorState. | 3407 // NavigatorState. |
3392 Time now = Time::Now(); | 3408 Time now = Time::Now(); |
3393 if (document_state->first_paint_time().is_null()) { | 3409 if (document_state->first_paint_time().is_null()) { |
3394 document_state->set_first_paint_time(now); | 3410 document_state->set_first_paint_time(now); |
3395 } | 3411 } |
3396 if (document_state->first_paint_after_load_time().is_null() && | 3412 if (document_state->first_paint_after_load_time().is_null() && |
3397 !document_state->finish_load_time().is_null()) { | 3413 !document_state->finish_load_time().is_null()) { |
3398 document_state->set_first_paint_after_load_time(now); | 3414 document_state->set_first_paint_after_load_time(now); |
3399 } | 3415 } |
3400 } | 3416 } |
3401 } | 3417 } |
3402 | 3418 |
3403 gfx::Vector2d RenderViewImpl::GetScrollOffset() { | 3419 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
3404 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 3420 WebFrame* main_frame = webview()->mainFrame(); |
| 3421 for (WebFrame* frame = main_frame; frame; |
| 3422 frame = frame->traverseNext(false)) { |
| 3423 // TODO(nasko): This is a hack for the case in which the top-level |
| 3424 // frame is being rendered in another process. It will not |
| 3425 // behave correctly for out of process iframes. |
| 3426 if (frame->isWebLocalFrame()) { |
| 3427 main_frame = frame; |
| 3428 break; |
| 3429 } |
| 3430 } |
| 3431 |
| 3432 WebSize scroll_offset = main_frame->scrollOffset(); |
3405 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 3433 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
3406 } | 3434 } |
3407 | 3435 |
3408 void RenderViewImpl::OnClearFocusedElement() { | 3436 void RenderViewImpl::OnClearFocusedElement() { |
3409 if (webview()) | 3437 if (webview()) |
3410 webview()->clearFocusedElement(); | 3438 webview()->clearFocusedElement(); |
3411 } | 3439 } |
3412 | 3440 |
3413 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 3441 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
3414 if (webview()) | 3442 if (webview()) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3581 for (plugin_it = plugin_delegates_.begin(); | 3609 for (plugin_it = plugin_delegates_.begin(); |
3582 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3610 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
3583 (*plugin_it)->SetContainerVisibility(true); | 3611 (*plugin_it)->SetContainerVisibility(true); |
3584 } | 3612 } |
3585 #endif // OS_MACOSX | 3613 #endif // OS_MACOSX |
3586 #endif // ENABLE_PLUGINS | 3614 #endif // ENABLE_PLUGINS |
3587 } | 3615 } |
3588 | 3616 |
3589 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 3617 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
3590 DCHECK(webview()); | 3618 DCHECK(webview()); |
3591 if (webview()->mainFrame()) | 3619 if (webview()->mainFrame()->isWebLocalFrame()) |
3592 return GURL(webview()->mainFrame()->document().url()); | 3620 return GURL(webview()->mainFrame()->document().url()); |
3593 else | 3621 else |
3594 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 3622 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
3595 } | 3623 } |
3596 | 3624 |
3597 void RenderViewImpl::OnSetFocus(bool enable) { | 3625 void RenderViewImpl::OnSetFocus(bool enable) { |
3598 RenderWidget::OnSetFocus(enable); | 3626 RenderWidget::OnSetFocus(enable); |
3599 | 3627 |
3600 #if defined(ENABLE_PLUGINS) | 3628 #if defined(ENABLE_PLUGINS) |
3601 if (webview() && webview()->isActive()) { | 3629 if (webview() && webview()->isActive()) { |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4276 std::vector<gfx::Size> sizes; | 4304 std::vector<gfx::Size> sizes; |
4277 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4305 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4278 if (!url.isEmpty()) | 4306 if (!url.isEmpty()) |
4279 urls.push_back( | 4307 urls.push_back( |
4280 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4308 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4281 } | 4309 } |
4282 SendUpdateFaviconURL(urls); | 4310 SendUpdateFaviconURL(urls); |
4283 } | 4311 } |
4284 | 4312 |
4285 } // namespace content | 4313 } // namespace content |
OLD | NEW |