Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

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: Rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 IPC::Message* reply_msg) { 1004 IPC::Message* reply_msg) {
1005 // While a JS beforeunload dialog is showing, tabs in the same process 1005 // While a JS beforeunload dialog is showing, tabs in the same process
1006 // shouldn't process input events. 1006 // shouldn't process input events.
1007 GetProcess()->SetIgnoreInputEvents(true); 1007 GetProcess()->SetIgnoreInputEvents(true);
1008 render_view_host_->StopHangMonitorTimeout(); 1008 render_view_host_->StopHangMonitorTimeout();
1009 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); 1009 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg);
1010 } 1010 }
1011 1011
1012 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( 1012 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission(
1013 const GURL& origin, int request_id) { 1013 const GURL& origin, int request_id) {
1014 base::Callback<void(blink::WebNotificationPermission)> done_callback = 1014 base::Callback<void(bool)> done_callback = base::Bind(
1015 base::Bind( 1015 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone,
1016 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, 1016 weak_ptr_factory_.GetWeakPtr(),
1017 weak_ptr_factory_.GetWeakPtr(), 1017 request_id);
1018 request_id);
1019 1018
1020 GetContentClient()->browser()->RequestDesktopNotificationPermission( 1019 if (!delegate()->GetAsWebContents())
1021 origin, this, done_callback); 1020 return;
1021
1022 // TODO(peter): plumb user_gesture and bridge_id.
1023 GetContentClient()->browser()->RequestPermission(
1024 content::PERMISSION_NOTIFICATIONS,
1025 delegate()->GetAsWebContents(),
1026 routing_id_,
1027 origin,
1028 true, // user_gesture,
1029 done_callback);
1022 } 1030 }
1023 1031
1024 void RenderFrameHostImpl::OnShowDesktopNotification( 1032 void RenderFrameHostImpl::OnShowDesktopNotification(
1025 int notification_id, 1033 int notification_id,
1026 const ShowDesktopNotificationHostMsgParams& params) { 1034 const ShowDesktopNotificationHostMsgParams& params) {
1027 scoped_ptr<DesktopNotificationDelegateImpl> delegate( 1035 scoped_ptr<DesktopNotificationDelegateImpl> delegate(
1028 new DesktopNotificationDelegateImpl(this, notification_id)); 1036 new DesktopNotificationDelegateImpl(this, notification_id));
1029 1037
1030 base::Closure cancel_callback; 1038 base::Closure cancel_callback;
1031 GetContentClient()->browser()->ShowDesktopNotification( 1039 GetContentClient()->browser()->ShowDesktopNotification(
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 common_params, commit_params)); 1444 common_params, commit_params));
1437 // TODO(clamy): Check if we should start the throbber for non javascript urls 1445 // TODO(clamy): Check if we should start the throbber for non javascript urls
1438 // here. 1446 // here.
1439 1447
1440 // TODO(clamy): Release the stream handle once the renderer has finished 1448 // TODO(clamy): Release the stream handle once the renderer has finished
1441 // reading it. 1449 // reading it.
1442 stream_handle_ = body.Pass(); 1450 stream_handle_ = body.Pass();
1443 } 1451 }
1444 1452
1445 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( 1453 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone(
1446 int request_id, blink::WebNotificationPermission permission) { 1454 int request_id,
1455 bool granted) {
1456 blink::WebNotificationPermission permission =
1457 granted ? blink::WebNotificationPermissionAllowed
1458 : blink::WebNotificationPermissionDenied;
1459
1447 Send(new PlatformNotificationMsg_PermissionRequestComplete( 1460 Send(new PlatformNotificationMsg_PermissionRequestComplete(
1448 routing_id_, request_id, permission)); 1461 routing_id_, request_id, permission));
1449 } 1462 }
1450 1463
1451 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( 1464 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility(
1452 const std::map<int32, int> node_to_frame_routing_id_map) { 1465 const std::map<int32, int> node_to_frame_routing_id_map) {
1453 std::map<int32, int>::const_iterator iter; 1466 std::map<int32, int>::const_iterator iter;
1454 for (iter = node_to_frame_routing_id_map.begin(); 1467 for (iter = node_to_frame_routing_id_map.begin();
1455 iter != node_to_frame_routing_id_map.end(); 1468 iter != node_to_frame_routing_id_map.end();
1456 ++iter) { 1469 ++iter) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 // Clear any state if a pending navigation is canceled or preempted. 1610 // Clear any state if a pending navigation is canceled or preempted.
1598 if (suspended_nav_params_) 1611 if (suspended_nav_params_)
1599 suspended_nav_params_.reset(); 1612 suspended_nav_params_.reset();
1600 1613
1601 TRACE_EVENT_ASYNC_END0("navigation", 1614 TRACE_EVENT_ASYNC_END0("navigation",
1602 "RenderFrameHostImpl navigation suspended", this); 1615 "RenderFrameHostImpl navigation suspended", this);
1603 navigations_suspended_ = false; 1616 navigations_suspended_ = false;
1604 } 1617 }
1605 1618
1606 } // namespace content 1619 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698