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

Side by Side Diff: chrome/browser/permissions/delegation_tracker.cc

Issue 2676203002: Convert DelegationTracker::DelegatedForChild to use the new navigation callbacks. (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/permissions/delegation_tracker.h" 5 #include "chrome/browser/permissions/delegation_tracker.h"
6 6
7 #include <unordered_set> 7 #include <unordered_set>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "chrome/browser/permissions/permission_util.h" 10 #include "chrome/browser/permissions/permission_util.h"
11 #include "content/public/browser/navigation_handle.h"
11 #include "content/public/browser/permission_type.h" 12 #include "content/public/browser/permission_type.h"
12 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
15 16
16 class DelegationTracker::DelegatedForChild : content::WebContentsObserver { 17 class DelegationTracker::DelegatedForChild : content::WebContentsObserver {
17 public: 18 public:
18 DelegatedForChild(content::RenderFrameHost* child_rfh, 19 DelegatedForChild(content::RenderFrameHost* child_rfh,
19 const std::vector<content::PermissionType>& permissions, 20 const std::vector<content::PermissionType>& permissions,
20 const base::Callback<void(content::RenderFrameHost*)>& 21 const base::Callback<void(content::RenderFrameHost*)>&
(...skipping 21 matching lines...) Expand all
42 // WebContentsObserver 43 // WebContentsObserver
43 void RenderFrameHostChanged(content::RenderFrameHost* old_host, 44 void RenderFrameHostChanged(content::RenderFrameHost* old_host,
44 content::RenderFrameHost* new_host) override { 45 content::RenderFrameHost* new_host) override {
45 ClearPermissions(old_host); 46 ClearPermissions(old_host);
46 } 47 }
47 48
48 void FrameDeleted(content::RenderFrameHost* render_frame_host) override { 49 void FrameDeleted(content::RenderFrameHost* render_frame_host) override {
49 ClearPermissions(render_frame_host); 50 ClearPermissions(render_frame_host);
50 } 51 }
51 52
52 void DidNavigateAnyFrame( 53 void DidFinishNavigation(
53 content::RenderFrameHost* render_frame_host, 54 content::NavigationHandle* navigation_handle) override {
54 const content::LoadCommittedDetails& details, 55 if (navigation_handle->HasCommitted())
55 const content::FrameNavigateParams& params) override { 56 ClearPermissions(navigation_handle->GetRenderFrameHost());
56 ClearPermissions(render_frame_host);
57 } 57 }
58 58
59 content::RenderFrameHost* child_rfh_; 59 content::RenderFrameHost* child_rfh_;
60 60
61 std::unordered_set<content::PermissionType, PermissionTypeHash> permissions_; 61 std::unordered_set<content::PermissionType, PermissionTypeHash> permissions_;
62 62
63 base::Callback<void(content::RenderFrameHost*)> rfh_destroyed_callback_; 63 base::Callback<void(content::RenderFrameHost*)> rfh_destroyed_callback_;
64 }; 64 };
65 65
66 DelegationTracker::DelegationTracker() {} 66 DelegationTracker::DelegationTracker() {}
(...skipping 28 matching lines...) Expand all
95 return false; 95 return false;
96 } 96 }
97 child_rfh = child_rfh->GetParent(); 97 child_rfh = child_rfh->GetParent();
98 } 98 }
99 return true; 99 return true;
100 } 100 }
101 101
102 void DelegationTracker::RenderFrameHostChanged(content::RenderFrameHost* rfh) { 102 void DelegationTracker::RenderFrameHostChanged(content::RenderFrameHost* rfh) {
103 delegated_permissions_.erase(rfh); 103 delegated_permissions_.erase(rfh);
104 } 104 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698