OLD | NEW |
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 "components/subresource_filter/content/renderer/subresource_filter_agen
t.h" | 5 #include "components/subresource_filter/content/renderer/subresource_filter_agen
t.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 void SubresourceFilterAgent::SendDocumentLoadStatistics( | 56 void SubresourceFilterAgent::SendDocumentLoadStatistics( |
57 const DocumentLoadStatistics& statistics) { | 57 const DocumentLoadStatistics& statistics) { |
58 render_frame()->Send(new SubresourceFilterHostMsg_DocumentLoadStatistics( | 58 render_frame()->Send(new SubresourceFilterHostMsg_DocumentLoadStatistics( |
59 render_frame()->GetRoutingID(), statistics)); | 59 render_frame()->GetRoutingID(), statistics)); |
60 } | 60 } |
61 | 61 |
62 void SubresourceFilterAgent::OnActivateForNextCommittedLoad( | 62 void SubresourceFilterAgent::OnActivateForNextCommittedLoad( |
63 ActivationState activation_state) { | 63 ActivationState activation_state) { |
| 64 LOG(ERROR) << "OnActivateForNextCommittedLoad"; |
64 activation_state_for_next_commit_ = activation_state; | 65 activation_state_for_next_commit_ = activation_state; |
65 } | 66 } |
66 | 67 |
67 void SubresourceFilterAgent::RecordHistogramsOnLoadCommitted() { | 68 void SubresourceFilterAgent::RecordHistogramsOnLoadCommitted() { |
68 // Note: ActivationLevel used to be called ActivationState, the legacy name is | 69 // Note: ActivationLevel used to be called ActivationState, the legacy name is |
69 // kept for the histogram. | 70 // kept for the histogram. |
70 ActivationLevel activation_level = | 71 ActivationLevel activation_level = |
71 activation_state_for_next_commit_.activation_level; | 72 activation_state_for_next_commit_.activation_level; |
72 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.DocumentLoad.ActivationState", | 73 UMA_HISTOGRAM_ENUMERATION("SubresourceFilter.DocumentLoad.ActivationState", |
73 static_cast<int>(activation_level), | 74 static_cast<int>(activation_level), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool is_new_navigation, | 136 bool is_new_navigation, |
136 bool is_same_document_navigation) { | 137 bool is_same_document_navigation) { |
137 if (is_same_document_navigation) | 138 if (is_same_document_navigation) |
138 return; | 139 return; |
139 | 140 |
140 filter_for_last_committed_load_.reset(); | 141 filter_for_last_committed_load_.reset(); |
141 | 142 |
142 // TODO(csharrison): Use WebURL and WebSecurityOrigin for efficiency here, | 143 // TODO(csharrison): Use WebURL and WebSecurityOrigin for efficiency here, |
143 // which require changes to the unit tests. | 144 // which require changes to the unit tests. |
144 const GURL& url = GetDocumentURL(); | 145 const GURL& url = GetDocumentURL(); |
| 146 |
145 if (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsFile()) { | 147 if (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsFile()) { |
146 RecordHistogramsOnLoadCommitted(); | 148 RecordHistogramsOnLoadCommitted(); |
| 149 LOG(ERROR) << "Commiting " |
| 150 << activation_state_for_next_commit_.activation_level << " " |
| 151 << url; |
| 152 |
147 if (activation_state_for_next_commit_.activation_level != | 153 if (activation_state_for_next_commit_.activation_level != |
148 ActivationLevel::DISABLED && | 154 ActivationLevel::DISABLED && |
149 ruleset_dealer_->IsRulesetFileAvailable()) { | 155 ruleset_dealer_->IsRulesetFileAvailable()) { |
150 base::OnceClosure first_disallowed_load_callback( | 156 base::OnceClosure first_disallowed_load_callback( |
151 base::BindOnce(&SubresourceFilterAgent:: | 157 base::BindOnce(&SubresourceFilterAgent:: |
152 SignalFirstSubresourceDisallowedForCommittedLoad, | 158 SignalFirstSubresourceDisallowedForCommittedLoad, |
153 AsWeakPtr())); | 159 AsWeakPtr())); |
154 | 160 |
155 auto ruleset = ruleset_dealer_->GetRuleset(); | 161 auto ruleset = ruleset_dealer_->GetRuleset(); |
156 DCHECK(ruleset); | 162 DCHECK(ruleset); |
(...skipping 25 matching lines...) Expand all Loading... |
182 bool handled = true; | 188 bool handled = true; |
183 IPC_BEGIN_MESSAGE_MAP(SubresourceFilterAgent, message) | 189 IPC_BEGIN_MESSAGE_MAP(SubresourceFilterAgent, message) |
184 IPC_MESSAGE_HANDLER(SubresourceFilterMsg_ActivateForNextCommittedLoad, | 190 IPC_MESSAGE_HANDLER(SubresourceFilterMsg_ActivateForNextCommittedLoad, |
185 OnActivateForNextCommittedLoad) | 191 OnActivateForNextCommittedLoad) |
186 IPC_MESSAGE_UNHANDLED(handled = false) | 192 IPC_MESSAGE_UNHANDLED(handled = false) |
187 IPC_END_MESSAGE_MAP() | 193 IPC_END_MESSAGE_MAP() |
188 return handled; | 194 return handled; |
189 } | 195 } |
190 | 196 |
191 } // namespace subresource_filter | 197 } // namespace subresource_filter |
OLD | NEW |