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

Side by Side Diff: chrome/browser/subresource_filter/subresource_filter_activation_tracker.cc

Issue 2838063002: [on-hold][subresource_filter] Add ActivationTracker to track all activated contents (Closed)
Patch Set: fix incognito Created 3 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/subresource_filter/subresource_filter_activation_tracke r.h"
6
7 #include <algorithm>
8
9 #include "base/logging.h"
10
11 SubresourceFilterActivationTracker::SubresourceFilterActivationTracker() {}
12 SubresourceFilterActivationTracker::~SubresourceFilterActivationTracker() {}
13
14 void SubresourceFilterActivationTracker::OnWebContentsActivated(
15 content::WebContents* web_contents,
16 bool activated) {
17 DCHECK(web_contents);
18 if (activated) {
19 activated_contents_.insert(web_contents);
20 } else {
21 activated_contents_.erase(web_contents);
22 }
23 }
24
25 void SubresourceFilterActivationTracker::OnWebContentsDestroyed(
26 content::WebContents* web_contents) {
27 OnWebContentsActivated(web_contents, false /* activated */);
28 }
29
30 bool SubresourceFilterActivationTracker::HasActivatedWebContents() const {
31 return !activated_contents_.empty();
32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698