Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 "content/public/test/content_browser_sanity_checker.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | |
| 9 #include "content/public/test/web_contents_observer_sanity_checker.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 namespace { | |
| 14 bool g_consistency_checks_already_enabled = false; | |
| 15 } | |
| 16 | |
| 17 ContentBrowserSanityChecker::ContentBrowserSanityChecker() { | |
| 18 CHECK(!g_consistency_checks_already_enabled) | |
| 19 << "There's no point in enabling this twice."; | |
|
Avi (use Gerrit)
2014/12/22 22:53:50
Don't use "this" here; make the error message self
ncarter (slow)
2014/12/23 00:17:03
Done.
| |
| 20 g_consistency_checks_already_enabled = true; | |
| 21 | |
| 22 creation_hook_ = | |
| 23 base::Bind(&ContentBrowserSanityChecker::OnWebContentsCreated, | |
| 24 base::Unretained(this)); | |
| 25 WebContentsImpl::FriendZone::AddCreatedCallbackForTesting(creation_hook_); | |
| 26 } | |
| 27 | |
| 28 ContentBrowserSanityChecker::~ContentBrowserSanityChecker() { | |
| 29 WebContentsImpl::FriendZone::RemoveCreatedCallbackForTesting(creation_hook_); | |
| 30 g_consistency_checks_already_enabled = false; | |
| 31 } | |
| 32 | |
| 33 void ContentBrowserSanityChecker::OnWebContentsCreated( | |
| 34 WebContents* web_contents) { | |
| 35 WebContentsObserverSanityChecker::Enable(web_contents); | |
| 36 } | |
| 37 | |
| 38 } // namespace content | |
| OLD | NEW |