Switch to using scoped_ptr with UserData

https://codereview.chromium.org/2815913005
This commit is contained in:
Aleksei Kuzmin 2017-08-07 23:30:03 +03:00 committed by Cheng Zhao
parent fe952d5c65
commit 971002a197
2 changed files with 5 additions and 4 deletions

View file

@ -180,12 +180,12 @@ void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
void CommonWebContentsDelegate::SetOwnerWindow(
content::WebContents* web_contents, NativeWindow* owner_window) {
owner_window_ = owner_window ? owner_window->GetWeakPtr() : nullptr;
NativeWindowRelay* relay = new NativeWindowRelay(owner_window_);
auto relay = base::MakeUnique<NativeWindowRelay>(owner_window_);
if (owner_window) {
web_contents->SetUserData(relay->key, relay);
web_contents->SetUserData(relay->key, std::move(relay));
} else {
web_contents->RemoveUserData(relay->key);
delete relay;
relay.reset();
}
}