Index: components/offline_pages/core/downloads/download_notifying_observer.cc |
diff --git a/components/offline_pages/core/downloads/download_notifying_observer.cc b/components/offline_pages/core/downloads/download_notifying_observer.cc |
index 00cc67daf40b3a73b6fbb24d2302e1754e4ec842..648f7f7f0a285b6dce5ff716693b696e1dde455e 100644 |
--- a/components/offline_pages/core/downloads/download_notifying_observer.cc |
+++ b/components/offline_pages/core/downloads/download_notifying_observer.cc |
@@ -4,6 +4,7 @@ |
#include "components/offline_pages/core/downloads/download_notifying_observer.h" |
+#include "base/memory/ptr_util.h" |
#include "components/offline_pages/core/background/request_coordinator.h" |
#include "components/offline_pages/core/background/save_page_request.h" |
#include "components/offline_pages/core/client_policy_controller.h" |
@@ -36,11 +37,11 @@ void DownloadNotifyingObserver::CreateAndStartObserving( |
std::unique_ptr<OfflinePageDownloadNotifier> notifier) { |
DCHECK(request_coordinator); |
DCHECK(notifier.get()); |
- DownloadNotifyingObserver* observer = new DownloadNotifyingObserver( |
- std::move(notifier), request_coordinator->GetPolicyController()); |
- request_coordinator->AddObserver(observer); |
- // |request_coordinator| takes ownership of observer here. |
- request_coordinator->SetUserData(&kUserDataKey, observer); |
+ std::unique_ptr<DownloadNotifyingObserver> observer = |
+ base::WrapUnique(new DownloadNotifyingObserver( |
dewittj
2017/04/28 19:02:19
nit: rewrite this as:
auto observer = base::MakeUn
Avi (use Gerrit)
2017/04/28 21:12:51
Sorry, but the constructor isn't public and theref
|
+ std::move(notifier), request_coordinator->GetPolicyController())); |
+ request_coordinator->AddObserver(observer.get()); |
+ request_coordinator->SetUserData(&kUserDataKey, std::move(observer)); |
} |
void DownloadNotifyingObserver::OnAdded(const SavePageRequest& request) { |