OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 IPC::Message* reply_msg) { | 985 IPC::Message* reply_msg) { |
986 // While a JS beforeunload dialog is showing, tabs in the same process | 986 // While a JS beforeunload dialog is showing, tabs in the same process |
987 // shouldn't process input events. | 987 // shouldn't process input events. |
988 GetProcess()->SetIgnoreInputEvents(true); | 988 GetProcess()->SetIgnoreInputEvents(true); |
989 render_view_host_->StopHangMonitorTimeout(); | 989 render_view_host_->StopHangMonitorTimeout(); |
990 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); | 990 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); |
991 } | 991 } |
992 | 992 |
993 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( | 993 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( |
994 const GURL& origin, int request_id) { | 994 const GURL& origin, int request_id) { |
995 base::Callback<void(blink::WebNotificationPermission)> done_callback = | 995 base::Callback<void(bool)> done_callback = base::Bind( |
996 base::Bind( | 996 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, |
997 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, | 997 weak_ptr_factory_.GetWeakPtr(), |
998 weak_ptr_factory_.GetWeakPtr(), | 998 request_id); |
999 request_id); | |
1000 | 999 |
1001 GetContentClient()->browser()->RequestDesktopNotificationPermission( | 1000 if (!delegate()->GetAsWebContents()) |
1002 origin, this, done_callback); | 1001 return; |
| 1002 |
| 1003 // TODO(peter): plumb user_gesture and bridge_id. |
| 1004 GetContentClient()->browser()->RequestPermission( |
| 1005 content::PERMISSION_NOTIFICATIONS, |
| 1006 delegate()->GetAsWebContents(), |
| 1007 -1 /* bridge id */, |
| 1008 origin, |
| 1009 true /* user_gesture */, |
| 1010 done_callback); |
1003 } | 1011 } |
1004 | 1012 |
1005 void RenderFrameHostImpl::OnShowDesktopNotification( | 1013 void RenderFrameHostImpl::OnShowDesktopNotification( |
1006 int notification_id, | 1014 int notification_id, |
1007 const ShowDesktopNotificationHostMsgParams& params) { | 1015 const ShowDesktopNotificationHostMsgParams& params) { |
1008 scoped_ptr<DesktopNotificationDelegateImpl> delegate( | 1016 scoped_ptr<DesktopNotificationDelegateImpl> delegate( |
1009 new DesktopNotificationDelegateImpl(this, notification_id)); | 1017 new DesktopNotificationDelegateImpl(this, notification_id)); |
1010 | 1018 |
1011 base::Closure cancel_callback; | 1019 base::Closure cancel_callback; |
1012 GetContentClient()->browser()->ShowDesktopNotification( | 1020 GetContentClient()->browser()->ShowDesktopNotification( |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 common_params, commit_params)); | 1415 common_params, commit_params)); |
1408 // TODO(clamy): Check if we should start the throbber for non javascript urls | 1416 // TODO(clamy): Check if we should start the throbber for non javascript urls |
1409 // here. | 1417 // here. |
1410 | 1418 |
1411 // TODO(clamy): Release the stream handle once the renderer has finished | 1419 // TODO(clamy): Release the stream handle once the renderer has finished |
1412 // reading it. | 1420 // reading it. |
1413 stream_handle_ = body.Pass(); | 1421 stream_handle_ = body.Pass(); |
1414 } | 1422 } |
1415 | 1423 |
1416 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( | 1424 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( |
1417 int request_id, blink::WebNotificationPermission permission) { | 1425 int request_id, |
| 1426 bool granted) { |
| 1427 blink::WebNotificationPermission permission = |
| 1428 granted ? blink::WebNotificationPermissionAllowed |
| 1429 : blink::WebNotificationPermissionDenied; |
| 1430 |
1418 Send(new PlatformNotificationMsg_PermissionRequestComplete( | 1431 Send(new PlatformNotificationMsg_PermissionRequestComplete( |
1419 routing_id_, request_id, permission)); | 1432 routing_id_, request_id, permission)); |
1420 } | 1433 } |
1421 | 1434 |
1422 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( | 1435 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( |
1423 const std::map<int32, int> node_to_frame_routing_id_map) { | 1436 const std::map<int32, int> node_to_frame_routing_id_map) { |
1424 std::map<int32, int>::const_iterator iter; | 1437 std::map<int32, int>::const_iterator iter; |
1425 for (iter = node_to_frame_routing_id_map.begin(); | 1438 for (iter = node_to_frame_routing_id_map.begin(); |
1426 iter != node_to_frame_routing_id_map.end(); | 1439 iter != node_to_frame_routing_id_map.end(); |
1427 ++iter) { | 1440 ++iter) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 // Clear any state if a pending navigation is canceled or preempted. | 1576 // Clear any state if a pending navigation is canceled or preempted. |
1564 if (suspended_nav_params_) | 1577 if (suspended_nav_params_) |
1565 suspended_nav_params_.reset(); | 1578 suspended_nav_params_.reset(); |
1566 | 1579 |
1567 TRACE_EVENT_ASYNC_END0("navigation", | 1580 TRACE_EVENT_ASYNC_END0("navigation", |
1568 "RenderFrameHostImpl navigation suspended", this); | 1581 "RenderFrameHostImpl navigation suspended", this); |
1569 navigations_suspended_ = false; | 1582 navigations_suspended_ = false; |
1570 } | 1583 } |
1571 | 1584 |
1572 } // namespace content | 1585 } // namespace content |
OLD | NEW |