Chromium Code Reviews

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 622793002: Group the different permission related methods in the content api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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 976 matching lines...)
987 IPC::Message* reply_msg) { 987 IPC::Message* reply_msg) {
988 // While a JS beforeunload dialog is showing, tabs in the same process 988 // While a JS beforeunload dialog is showing, tabs in the same process
989 // shouldn't process input events. 989 // shouldn't process input events.
990 GetProcess()->SetIgnoreInputEvents(true); 990 GetProcess()->SetIgnoreInputEvents(true);
991 render_view_host_->StopHangMonitorTimeout(); 991 render_view_host_->StopHangMonitorTimeout();
992 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); 992 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg);
993 } 993 }
994 994
995 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( 995 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission(
996 const GURL& origin, int request_id) { 996 const GURL& origin, int request_id) {
997 base::Callback<void(blink::WebNotificationPermission)> done_callback = 997 base::Callback<void(bool)> done_callback = base::Bind(
998 base::Bind( 998 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone,
999 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, 999 weak_ptr_factory_.GetWeakPtr(),
1000 weak_ptr_factory_.GetWeakPtr(), 1000 request_id);
1001 request_id);
1002 1001
1003 GetContentClient()->browser()->RequestDesktopNotificationPermission( 1002 if (!delegate()->GetAsWebContents())
1004 origin, this, done_callback); 1003 return;
1004
1005 // TODO(peter): plumb user_gesture and bridge_id.
1006 GetContentClient()->browser()->RequestPermission(
1007 content::PERMISSION_NOTIFICATIONS,
1008 delegate()->GetAsWebContents(),
1009 -1 /* bridge id */,
Peter Beverloo 2014/10/24 14:37:28 If all consumers indeed use the routing Id, change
Miguel Garcia 2014/10/24 16:05:32 Done.
1010 origin,
1011 true /* user_gesture */,
Peter Beverloo 2014/10/24 14:37:28 Please use C++-style comments: true, // user_ges
Miguel Garcia 2014/10/24 16:05:32 Done.
1012 done_callback);
1005 } 1013 }
1006 1014
1007 void RenderFrameHostImpl::OnShowDesktopNotification( 1015 void RenderFrameHostImpl::OnShowDesktopNotification(
1008 int notification_id, 1016 int notification_id,
1009 const ShowDesktopNotificationHostMsgParams& params) { 1017 const ShowDesktopNotificationHostMsgParams& params) {
1010 scoped_ptr<DesktopNotificationDelegateImpl> delegate( 1018 scoped_ptr<DesktopNotificationDelegateImpl> delegate(
1011 new DesktopNotificationDelegateImpl(this, notification_id)); 1019 new DesktopNotificationDelegateImpl(this, notification_id));
1012 1020
1013 base::Closure cancel_callback; 1021 base::Closure cancel_callback;
1014 GetContentClient()->browser()->ShowDesktopNotification( 1022 GetContentClient()->browser()->ShowDesktopNotification(
(...skipping 393 matching lines...)
1408 common_params, commit_params)); 1416 common_params, commit_params));
1409 // TODO(clamy): Check if we should start the throbber for non javascript urls 1417 // TODO(clamy): Check if we should start the throbber for non javascript urls
1410 // here. 1418 // here.
1411 1419
1412 // TODO(clamy): Release the stream handle once the renderer has finished 1420 // TODO(clamy): Release the stream handle once the renderer has finished
1413 // reading it. 1421 // reading it.
1414 stream_handle_ = body.Pass(); 1422 stream_handle_ = body.Pass();
1415 } 1423 }
1416 1424
1417 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( 1425 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone(
1418 int request_id, blink::WebNotificationPermission permission) { 1426 int request_id,
1427 bool granted) {
1428 blink::WebNotificationPermission permission =
1429 granted ? blink::WebNotificationPermissionAllowed
1430 : blink::WebNotificationPermissionDenied;
1431
1419 Send(new PlatformNotificationMsg_PermissionRequestComplete( 1432 Send(new PlatformNotificationMsg_PermissionRequestComplete(
1420 routing_id_, request_id, permission)); 1433 routing_id_, request_id, permission));
1421 } 1434 }
1422 1435
1423 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( 1436 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility(
1424 const std::map<int32, int> node_to_frame_routing_id_map) { 1437 const std::map<int32, int> node_to_frame_routing_id_map) {
1425 std::map<int32, int>::const_iterator iter; 1438 std::map<int32, int>::const_iterator iter;
1426 for (iter = node_to_frame_routing_id_map.begin(); 1439 for (iter = node_to_frame_routing_id_map.begin();
1427 iter != node_to_frame_routing_id_map.end(); 1440 iter != node_to_frame_routing_id_map.end();
1428 ++iter) { 1441 ++iter) {
(...skipping 135 matching lines...)
1564 // Clear any state if a pending navigation is canceled or preempted. 1577 // Clear any state if a pending navigation is canceled or preempted.
1565 if (suspended_nav_params_) 1578 if (suspended_nav_params_)
1566 suspended_nav_params_.reset(); 1579 suspended_nav_params_.reset();
1567 1580
1568 TRACE_EVENT_ASYNC_END0("navigation", 1581 TRACE_EVENT_ASYNC_END0("navigation",
1569 "RenderFrameHostImpl navigation suspended", this); 1582 "RenderFrameHostImpl navigation suspended", this);
1570 navigations_suspended_ = false; 1583 navigations_suspended_ = false;
1571 } 1584 }
1572 1585
1573 } // namespace content 1586 } // namespace content
OLDNEW

Powered by Google App Engine