Remove WebContentsUserData::kLocatorKey

1093015
This commit is contained in:
Jeremy Apthorp 2018-10-02 15:14:43 -07:00
parent 2d46164ce0
commit 34e54b93a4
7 changed files with 39 additions and 23 deletions

View file

@ -21,8 +21,6 @@
#include "ui/display/win/screen_win.h"
#endif
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::NativeWindowRelay);
namespace atom {
namespace {
@ -577,8 +575,22 @@ const views::Widget* NativeWindow::GetWidget() const {
return widget();
}
// static
const void* const NativeWindowRelay::kNativeWindowRelayUserDataKey =
&NativeWindowRelay::kNativeWindowRelayUserDataKey;
// static
void NativeWindowRelay::CreateForWebContents(
content::WebContents* web_contents,
base::WeakPtr<NativeWindow> window) {
DCHECK(web_contents);
DCHECK(!web_contents->GetUserData(kNativeWindowRelayUserDataKey));
web_contents->SetUserData(kNativeWindowRelayUserDataKey,
base::WrapUnique(new NativeWindowRelay(window)));
}
NativeWindowRelay::NativeWindowRelay(base::WeakPtr<NativeWindow> window)
: key(UserDataKey()), window(window) {}
: native_window_(window) {}
NativeWindowRelay::~NativeWindowRelay() = default;