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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 int32 next_page_id) | 390 int32 next_page_id) |
391 : RenderWidget(WebKit::WebPopupTypeNone), | 391 : RenderWidget(WebKit::WebPopupTypeNone), |
392 webkit_preferences_(webkit_prefs), | 392 webkit_preferences_(webkit_prefs), |
393 send_content_state_immediately_(false), | 393 send_content_state_immediately_(false), |
394 enabled_bindings_(0), | 394 enabled_bindings_(0), |
395 send_preferred_size_changes_(false), | 395 send_preferred_size_changes_(false), |
396 is_loading_(false), | 396 is_loading_(false), |
397 navigation_gesture_(NavigationGestureUnknown), | 397 navigation_gesture_(NavigationGestureUnknown), |
398 opened_by_user_gesture_(true), | 398 opened_by_user_gesture_(true), |
399 opener_suppressed_(false), | 399 opener_suppressed_(false), |
400 new_window_navigation_policy_(WebKit::WebNavigationPolicyIgnore), | |
400 page_id_(-1), | 401 page_id_(-1), |
401 last_page_id_sent_to_browser_(-1), | 402 last_page_id_sent_to_browser_(-1), |
402 next_page_id_(next_page_id), | 403 next_page_id_(next_page_id), |
403 history_list_offset_(-1), | 404 history_list_offset_(-1), |
404 history_list_length_(0), | 405 history_list_length_(0), |
405 target_url_status_(TARGET_NONE), | 406 target_url_status_(TARGET_NONE), |
406 selection_text_offset_(0), | 407 selection_text_offset_(0), |
407 cached_is_main_frame_pinned_to_left_(false), | 408 cached_is_main_frame_pinned_to_left_(false), |
408 cached_is_main_frame_pinned_to_right_(false), | 409 cached_is_main_frame_pinned_to_right_(false), |
409 cached_has_main_frame_horizontal_scrollbar_(false), | 410 cached_has_main_frame_horizontal_scrollbar_(false), |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1377 // that would defer resource loads for the dialog itself. | 1378 // that would defer resource loads for the dialog itself. |
1378 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1379 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
1379 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | 1380 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); |
1380 | 1381 |
1381 message->EnableMessagePumping(); // Runs a nested message loop. | 1382 message->EnableMessagePumping(); // Runs a nested message loop. |
1382 return Send(message); | 1383 return Send(message); |
1383 } | 1384 } |
1384 | 1385 |
1385 // WebKit::WebViewClient ------------------------------------------------------ | 1386 // WebKit::WebViewClient ------------------------------------------------------ |
1386 | 1387 |
1388 // TODO(creis): Should this be on WebViewClient or WebFrameClient? | |
darin (slow to review)
2012/02/14 00:15:56
navigation related callbacks typically live on Web
| |
1389 void RenderViewImpl::didSetNextNavigationPolicy( | |
1390 WebKit::WebNavigationPolicy policy) { | |
1391 new_window_navigation_policy_ = policy; | |
Charlie Reis
2012/02/07 02:19:55
I'm not thrilled about this, but I haven't found a
| |
1392 } | |
1393 | |
1387 WebView* RenderViewImpl::createView( | 1394 WebView* RenderViewImpl::createView( |
1388 WebFrame* creator, | 1395 WebFrame* creator, |
1389 const WebURLRequest& request, | 1396 const WebURLRequest& request, |
1390 const WebWindowFeatures& features, | 1397 const WebWindowFeatures& features, |
1391 const WebString& frame_name) { | 1398 const WebString& frame_name) { |
1392 // Check to make sure we aren't overloading on popups. | 1399 // Check to make sure we aren't overloading on popups. |
1393 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) | 1400 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) |
1394 return NULL; | 1401 return NULL; |
1395 | 1402 |
1396 ViewHostMsg_CreateWindow_Params params; | 1403 ViewHostMsg_CreateWindow_Params params; |
1397 params.opener_id = routing_id_; | 1404 params.opener_id = routing_id_; |
1398 params.user_gesture = creator->isProcessingUserGesture(); | 1405 params.user_gesture = creator->isProcessingUserGesture(); |
1399 params.window_container_type = WindowFeaturesToContainerType(features); | 1406 params.window_container_type = WindowFeaturesToContainerType(features); |
1400 params.session_storage_namespace_id = session_storage_namespace_id_; | 1407 params.session_storage_namespace_id = session_storage_namespace_id_; |
1401 params.frame_name = frame_name; | 1408 params.frame_name = frame_name; |
1402 params.opener_frame_id = creator->identifier(); | 1409 params.opener_frame_id = creator->identifier(); |
1403 params.opener_url = creator->document().url(); | 1410 params.opener_url = creator->document().url(); |
1404 params.opener_security_origin = | 1411 params.opener_security_origin = |
1405 creator->document().securityOrigin().toString().utf8(); | 1412 creator->document().securityOrigin().toString().utf8(); |
1413 params.opener_suppressed = creator->willSuppressOpenerInNewFrame(); | |
1414 params.disposition = | |
1415 NavigationPolicyToDisposition(new_window_navigation_policy_); | |
1406 if (!request.isNull()) | 1416 if (!request.isNull()) |
1407 params.target_url = request.url(); | 1417 params.target_url = request.url(); |
1408 | 1418 |
1419 // Clear the disposition before the next navigation. | |
1420 new_window_navigation_policy_ = WebKit::WebNavigationPolicyIgnore; | |
1421 | |
1409 int32 routing_id = MSG_ROUTING_NONE; | 1422 int32 routing_id = MSG_ROUTING_NONE; |
1410 int32 surface_id = 0; | 1423 int32 surface_id = 0; |
1411 int64 cloned_session_storage_namespace_id; | 1424 int64 cloned_session_storage_namespace_id; |
1412 bool opener_suppressed = creator->willSuppressOpenerInNewFrame(); | |
1413 | 1425 |
1414 RenderThread::Get()->Send( | 1426 RenderThread::Get()->Send( |
1415 new ViewHostMsg_CreateWindow(params, | 1427 new ViewHostMsg_CreateWindow(params, |
1416 &routing_id, | 1428 &routing_id, |
1417 &surface_id, | 1429 &surface_id, |
1418 &cloned_session_storage_namespace_id)); | 1430 &cloned_session_storage_namespace_id)); |
1419 if (routing_id == MSG_ROUTING_NONE) | 1431 if (routing_id == MSG_ROUTING_NONE) |
1420 return NULL; | 1432 return NULL; |
1421 | 1433 |
1422 RenderViewImpl* view = RenderViewImpl::Create( | 1434 RenderViewImpl* view = RenderViewImpl::Create( |
1423 0, | 1435 0, |
1424 routing_id_, | 1436 routing_id_, |
1425 renderer_preferences_, | 1437 renderer_preferences_, |
1426 webkit_preferences_, | 1438 webkit_preferences_, |
1427 shared_popup_counter_, | 1439 shared_popup_counter_, |
1428 routing_id, | 1440 routing_id, |
1429 surface_id, | 1441 surface_id, |
1430 cloned_session_storage_namespace_id, | 1442 cloned_session_storage_namespace_id, |
1431 frame_name, | 1443 frame_name, |
1432 1); | 1444 1); |
1433 view->opened_by_user_gesture_ = params.user_gesture; | 1445 view->opened_by_user_gesture_ = params.user_gesture; |
1434 | 1446 |
1435 // Record whether the creator frame is trying to suppress the opener field. | 1447 // Record whether the creator frame is trying to suppress the opener field. |
1436 view->opener_suppressed_ = opener_suppressed; | 1448 view->opener_suppressed_ = params.opener_suppressed; |
1437 | 1449 |
1438 // Record the security origin of the creator. | 1450 // Record the security origin of the creator. |
1439 GURL creator_url(creator->document().securityOrigin().toString().utf8()); | 1451 GURL creator_url(creator->document().securityOrigin().toString().utf8()); |
1440 if (!creator_url.is_valid() || !creator_url.IsStandard()) | 1452 if (!creator_url.is_valid() || !creator_url.IsStandard()) |
1441 creator_url = GURL(); | 1453 creator_url = GURL(); |
1442 view->creator_url_ = creator_url; | 1454 view->creator_url_ = creator_url; |
1443 | 1455 |
1444 // Copy over the alternate error page URL so we can have alt error pages in | 1456 // Copy over the alternate error page URL so we can have alt error pages in |
1445 // the new render view (we don't need the browser to send the URL back down). | 1457 // the new render view (we don't need the browser to send the URL back down). |
1446 view->alternate_error_page_url_ = alternate_error_page_url_; | 1458 view->alternate_error_page_url_ = alternate_error_page_url_; |
(...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4975 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4987 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
4976 return !!RenderThreadImpl::current()->compositor_thread(); | 4988 return !!RenderThreadImpl::current()->compositor_thread(); |
4977 } | 4989 } |
4978 | 4990 |
4979 void RenderViewImpl::OnJavaBridgeInit() { | 4991 void RenderViewImpl::OnJavaBridgeInit() { |
4980 DCHECK(!java_bridge_dispatcher_.get()); | 4992 DCHECK(!java_bridge_dispatcher_.get()); |
4981 #if defined(ENABLE_JAVA_BRIDGE) | 4993 #if defined(ENABLE_JAVA_BRIDGE) |
4982 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 4994 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
4983 #endif | 4995 #endif |
4984 } | 4996 } |
OLD | NEW |