Track child web contents
This commit is contained in:
parent
659722924d
commit
34ed1a9ef8
8 changed files with 55 additions and 55 deletions
28
atom/browser/child_web_contents_tracker.cc
Normal file
28
atom/browser/child_web_contents_tracker.cc
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include "child_web_contents_tracker.h"
|
||||
#include <unordered_set>
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
|
||||
std::unordered_set<content::WebContents*> g_child_web_contents;
|
||||
|
||||
} // namespace
|
||||
|
||||
ChildWebContentsTracker::ChildWebContentsTracker(
|
||||
content::WebContents* web_contents)
|
||||
: content::WebContentsObserver(web_contents) {
|
||||
g_child_web_contents.insert(web_contents);
|
||||
}
|
||||
|
||||
bool ChildWebContentsTracker::IsChildWebContents(
|
||||
content::WebContents* web_contents) {
|
||||
return g_child_web_contents.find(web_contents) != g_child_web_contents.end();
|
||||
}
|
||||
|
||||
void ChildWebContentsTracker::WebContentsDestroyed() {
|
||||
g_child_web_contents.erase(web_contents());
|
||||
delete this;
|
||||
}
|
||||
|
||||
} // namespace atom
|
Loading…
Add table
Add a link
Reference in a new issue