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 = |
996 base::Bind( | 996 base::Bind( |
997 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, | 997 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, |
998 weak_ptr_factory_.GetWeakPtr(), | 998 weak_ptr_factory_.GetWeakPtr(), |
999 request_id); | 999 request_id); |
1000 | 1000 |
1001 GetContentClient()->browser()->RequestDesktopNotificationPermission( | 1001 if (!delegate()->GetAsWebContents()) |
1002 origin, this, done_callback); | 1002 return; |
1003 | |
1004 // TODO(peter) plumb user_gesture and bridge_id. | |
Bernhard Bauer
2014/10/20 14:57:24
Nit: Standard syntax for TODOs has a colon after t
Peter Beverloo
2014/10/20 17:32:16
What is a |bridge_id|? The renderer part of notifi
Miguel Garcia
2014/10/21 17:17:12
I asked Takashi about it a while ago as well. Quot
| |
1005 GetContentClient()->browser()->RequestPermission( | |
1006 content::PERMISSION_NOTIFICATIONS, | |
1007 delegate()->GetAsWebContents(), | |
1008 -1 /* bridge id */, | |
1009 origin, 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1406 common_params, commit_params)); | 1414 common_params, commit_params)); |
1407 // TODO(clamy): Check if we should start the throbber for non javascript urls | 1415 // TODO(clamy): Check if we should start the throbber for non javascript urls |
1408 // here. | 1416 // here. |
1409 | 1417 |
1410 // TODO(clamy): Release the stream handle once the renderer has finished | 1418 // TODO(clamy): Release the stream handle once the renderer has finished |
1411 // reading it. | 1419 // reading it. |
1412 stream_handle_ = body.Pass(); | 1420 stream_handle_ = body.Pass(); |
1413 } | 1421 } |
1414 | 1422 |
1415 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( | 1423 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( |
1416 int request_id, blink::WebNotificationPermission permission) { | 1424 int request_id, bool granted) { |
1425 blink::WebNotificationPermission permission = granted ? | |
1426 blink::WebNotificationPermissionAllowed : | |
1427 blink::WebNotificationPermissionDenied; | |
1428 | |
1417 Send(new PlatformNotificationMsg_PermissionRequestComplete( | 1429 Send(new PlatformNotificationMsg_PermissionRequestComplete( |
1418 routing_id_, request_id, permission)); | 1430 routing_id_, request_id, permission)); |
1419 } | 1431 } |
1420 | 1432 |
1421 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( | 1433 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( |
1422 const std::map<int32, int> node_to_frame_routing_id_map) { | 1434 const std::map<int32, int> node_to_frame_routing_id_map) { |
1423 std::map<int32, int>::const_iterator iter; | 1435 std::map<int32, int>::const_iterator iter; |
1424 for (iter = node_to_frame_routing_id_map.begin(); | 1436 for (iter = node_to_frame_routing_id_map.begin(); |
1425 iter != node_to_frame_routing_id_map.end(); | 1437 iter != node_to_frame_routing_id_map.end(); |
1426 ++iter) { | 1438 ++iter) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1562 // Clear any state if a pending navigation is canceled or preempted. | 1574 // Clear any state if a pending navigation is canceled or preempted. |
1563 if (suspended_nav_params_) | 1575 if (suspended_nav_params_) |
1564 suspended_nav_params_.reset(); | 1576 suspended_nav_params_.reset(); |
1565 | 1577 |
1566 TRACE_EVENT_ASYNC_END0("navigation", | 1578 TRACE_EVENT_ASYNC_END0("navigation", |
1567 "RenderFrameHostImpl navigation suspended", this); | 1579 "RenderFrameHostImpl navigation suspended", this); |
1568 navigations_suspended_ = false; | 1580 navigations_suspended_ = false; |
1569 } | 1581 } |
1570 | 1582 |
1571 } // namespace content | 1583 } // namespace content |
OLD | NEW |