Index: views/widget/native_widget_aura.cc |
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc |
index b3673a03239e1ee0ae28d61bb5232068a3c8bdea..1158e7bbc4db511f7c263ad23c85935282117315 100644 |
--- a/views/widget/native_widget_aura.cc |
+++ b/views/widget/native_widget_aura.cc |
@@ -9,6 +9,7 @@ |
#include "ui/aura/event.h" |
#include "ui/aura/window.h" |
#include "ui/aura/window_types.h" |
+#include "ui/base/view_prop.h" |
#include "ui/base/ui_base_types.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/compositor/layer.h" |
@@ -28,6 +29,8 @@ |
#include "views/ime/mock_input_method.h" |
#endif |
+using ui::ViewProp; |
+ |
namespace views { |
namespace { |
@@ -173,15 +176,24 @@ void NativeWidgetAura::ViewRemoved(View* view) { |
} |
void NativeWidgetAura::SetNativeWindowProperty(const char* name, void* value) { |
- if (!value) |
- props_map_.erase(name); |
- else |
- props_map_[name] = value; |
+ // TODO(sky): push this to Widget when we get rid of NativeWidgetGtk. |
+ if (!window_) |
+ return; |
+ |
+ // Remove the existing property (if any). |
+ for (ViewProps::iterator i = props_.begin(); i != props_.end(); ++i) { |
+ if ((*i)->Key() == name) { |
+ props_.erase(i); |
+ break; |
+ } |
+ } |
+ |
+ if (value) |
+ props_.push_back(new ViewProp(window_, name, value)); |
} |
void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { |
- PropsMap::const_iterator i = props_map_.find(name); |
- return i == props_map_.end() ? NULL : i->second; |
+ return window_ ? ViewProp::GetValue(window_, name) : NULL; |
} |
TooltipManager* NativeWidgetAura::GetTooltipManager() const { |
@@ -538,6 +550,7 @@ void NativeWidgetAura::OnWindowDestroying() { |
} |
void NativeWidgetAura::OnWindowDestroyed() { |
+ props_.reset(); |
window_ = NULL; |
delegate_->OnNativeWidgetDestroyed(); |
if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |