Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Unified Diff: ui/views/widget/native_widget_aura.cc

Issue 2610203002: Removes aura::Window::set_user_data() (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 80be94f24d3eb643353ca43b68cb41440182b8d1..d5aa74b40c2afccec1ab6a7de3afcd4666b652b6 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -25,6 +25,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_observer.h"
+#include "ui/aura/window_property.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/ui_base_types.h"
@@ -69,10 +70,16 @@
#include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
#endif
+DECLARE_WINDOW_PROPERTY_TYPE(views::internal::NativeWidgetPrivate*)
+
namespace views {
namespace {
+DEFINE_WINDOW_PROPERTY_KEY(internal::NativeWidgetPrivate*,
+ kNativeWidgetPrivateKey,
+ nullptr);
+
void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) {
window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds));
}
@@ -110,7 +117,7 @@ NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate,
void NativeWidgetAura::RegisterNativeWidgetForWindow(
internal::NativeWidgetPrivate* native_widget,
aura::Window* window) {
- window->set_user_data(native_widget);
+ window->SetProperty(kNativeWidgetPrivateKey, native_widget);
}
// static
@@ -1101,15 +1108,13 @@ NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget(
// static
NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView(
gfx::NativeView native_view) {
- // Cast must match type supplied to RegisterNativeWidgetForWindow().
- return reinterpret_cast<NativeWidgetPrivate*>(native_view->user_data());
+ return native_view->GetProperty(kNativeWidgetPrivateKey);
}
// static
NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow(
gfx::NativeWindow native_window) {
- // Cast must match type supplied to RegisterNativeWidgetForWindow().
- return reinterpret_cast<NativeWidgetPrivate*>(native_window->user_data());
+ return native_window->GetProperty(kNativeWidgetPrivateKey);
}
// static
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698