Index: content/public/test/test_navigation_observer.cc |
diff --git a/content/public/test/test_navigation_observer.cc b/content/public/test/test_navigation_observer.cc |
index b8a57a20c2a9a50b4c8014b27669c274170424a4..684c66f91e9f5894967aa76c8f236f59b0a76e4a 100644 |
--- a/content/public/test/test_navigation_observer.cc |
+++ b/content/public/test/test_navigation_observer.cc |
@@ -6,9 +6,9 @@ |
#include "base/bind.h" |
#include "base/macros.h" |
+#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
-#include "base/stl_util.h" |
#include "content/browser/web_contents/web_contents_impl.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -109,9 +109,6 @@ TestNavigationObserver::TestNavigationObserver( |
TestNavigationObserver::~TestNavigationObserver() { |
StopWatchingNewWebContents(); |
- |
- base::STLDeleteContainerPointers(web_contents_observers_.begin(), |
- web_contents_observers_.end()); |
} |
void TestNavigationObserver::Wait() { |
@@ -130,7 +127,7 @@ void TestNavigationObserver::StopWatchingNewWebContents() { |
void TestNavigationObserver::RegisterAsObserver(WebContents* web_contents) { |
web_contents_observers_.insert( |
- new TestWebContentsObserver(this, web_contents)); |
+ base::MakeUnique<TestWebContentsObserver>(this, web_contents)); |
} |
void TestNavigationObserver::OnWebContentsCreated(WebContents* web_contents) { |
@@ -140,8 +137,11 @@ void TestNavigationObserver::OnWebContentsCreated(WebContents* web_contents) { |
void TestNavigationObserver::OnWebContentsDestroyed( |
TestWebContentsObserver* observer, |
WebContents* web_contents) { |
- web_contents_observers_.erase(observer); |
- delete observer; |
+ web_contents_observers_.erase(std::find_if( |
+ web_contents_observers_.begin(), web_contents_observers_.end(), |
+ [observer](const std::unique_ptr<TestWebContentsObserver>& ptr) { |
+ return ptr.get() == observer; |
+ })); |
} |
void TestNavigationObserver::OnNavigationEntryCommitted( |