summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc11
-rw-r--r--ui/aura/window.cc12
-rw-r--r--ui/aura/window.h3
-rw-r--r--ui/aura/window_unittest.cc8
-rw-r--r--ui/aura_shell/default_container_layout_manager.cc1
-rw-r--r--ui/aura_shell/default_container_layout_manager_unittest.cc1
-rw-r--r--ui/aura_shell/shell.cc1
-rw-r--r--ui/base/view_prop.h4
-rw-r--r--ui/ui.gyp8
-rw-r--r--ui/ui_unittests.gypi1
10 files changed, 19 insertions, 31 deletions
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 81a4684..3c4efd5 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -111,7 +111,6 @@
#include "ui/aura_shell/launcher/launcher.h"
#include "ui/aura_shell/launcher/launcher_model.h"
#include "ui/aura_shell/shell.h"
-#include "ui/base/view_prop.h"
#elif defined(OS_WIN)
#include "chrome/browser/aeropeek_manager.h"
#include "chrome/browser/jumplist_win.h"
@@ -132,10 +131,6 @@
#include "chrome/browser/ui/views/download/download_shelf_view.h"
#endif
-#if defined(OS_WIN) && !defined(USE_AURA)
-#include "ui/base/view_prop.h"
-#endif
-
#if defined(TOUCH_UI)
#include "chrome/browser/ui/touch/status_bubble_touch.h"
#endif
@@ -382,8 +377,10 @@ BrowserView::~BrowserView() {
// static
BrowserView* BrowserView::GetBrowserViewForNativeWindow(
gfx::NativeWindow window) {
- return reinterpret_cast<BrowserView*>(
- ui::ViewProp::GetValue(window, kBrowserViewKey));
+ views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
+ return widget ?
+ reinterpret_cast<BrowserView*>(widget->GetNativeWindowProperty(
+ kBrowserViewKey)) : NULL;
}
#endif
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index ec76fc7..a244ac4 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -17,7 +17,6 @@
#include "ui/aura/window_observer.h"
#include "ui/aura/window_types.h"
#include "ui/base/animation/multi_animation.h"
-#include "ui/base/view_prop.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/screen.h"
@@ -70,8 +69,6 @@ Window::~Window() {
parent_->RemoveChild(this);
FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this));
-
- STLDeleteValues(&prop_map_);
}
void Window::Init(ui::Layer::LayerType layer_type) {
@@ -422,16 +419,17 @@ bool Window::IsOrContainsFullscreenWindow() const {
}
void Window::SetProperty(const char* name, void* value) {
- ui::ViewProp* prop = prop_map_[name];
- delete prop;
if (value)
- prop_map_[name] = new ui::ViewProp(this, name, value);
+ prop_map_[name] = value;
else
prop_map_.erase(name);
}
void* Window::GetProperty(const char* name) const {
- return ui::ViewProp::GetValue(const_cast<gfx::NativeView>(this), name);
+ std::map<const char*, void*>::const_iterator iter = prop_map_.find(name);
+ if (iter == prop_map_.end())
+ return NULL;
+ return iter->second;
}
Desktop* Window::GetDesktop() {
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 33b4ae5..8e53aad 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -31,7 +31,6 @@ class Compositor;
class Layer;
class LayerAnimationSequence;
class Transform;
-class ViewProp;
}
namespace aura {
@@ -360,7 +359,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
// to create and access property.
// TODO(oshima): Consolidcate ViewProp and aura::window property
// implementation.
- std::map<const char*, ui::ViewProp*> prop_map_;
+ std::map<const char*, void*> prop_map_;
DISALLOW_COPY_AND_ASSIGN(Window);
};
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 79a6e18..80b25c2 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -20,7 +20,6 @@
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
#include "ui/base/keycodes/keyboard_codes.h"
-#include "ui/base/view_prop.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/screen.h"
@@ -1139,32 +1138,25 @@ TEST_F(ToplevelWindowTest, FullscreenAfterDesktopResize) {
TEST_F(WindowTest, Property) {
scoped_ptr<Window> w(CreateTestWindowWithId(0, NULL));
- const gfx::NativeView target = const_cast<const gfx::NativeView>(w.get());
const char* key = "test";
EXPECT_EQ(NULL, w->GetProperty(key));
- EXPECT_EQ(NULL, ui::ViewProp::GetValue(target, key));
void* value = reinterpret_cast<void*>(static_cast<intptr_t>(1));
w->SetProperty(key, value);
EXPECT_EQ(value, w->GetProperty(key));
- EXPECT_EQ(value, ui::ViewProp::GetValue(target, key));
// Overwrite the property with different value type.
w->SetProperty(key, static_cast<void*>(const_cast<char*>("string")));
std::string expected("string");
EXPECT_EQ(expected,
static_cast<const char*>(w->GetProperty(key)));
- EXPECT_EQ(expected,
- static_cast<const char*>(ui::ViewProp::GetValue(target, key)));
// Non-existent property.
EXPECT_EQ(NULL, w->GetProperty("foo"));
- EXPECT_EQ(NULL, ui::ViewProp::GetValue(target, "foo"));
// Set NULL and make sure the property is gone.
w->SetProperty(key, NULL);
EXPECT_EQ(NULL, w->GetProperty(key));
- EXPECT_EQ(NULL, ui::ViewProp::GetValue(target, key));
}
class WindowObserverTest : public WindowTest,
diff --git a/ui/aura_shell/default_container_layout_manager.cc b/ui/aura_shell/default_container_layout_manager.cc
index 11a6b1b..54b6f53 100644
--- a/ui/aura_shell/default_container_layout_manager.cc
+++ b/ui/aura_shell/default_container_layout_manager.cc
@@ -12,7 +12,6 @@
#include "ui/aura/window_types.h"
#include "ui/aura_shell/workspace/workspace.h"
#include "ui/aura_shell/workspace/workspace_manager.h"
-#include "ui/base/view_prop.h"
#include "ui/gfx/rect.h"
#include "views/widget/native_widget_aura.h"
diff --git a/ui/aura_shell/default_container_layout_manager_unittest.cc b/ui/aura_shell/default_container_layout_manager_unittest.cc
index b1c2b48..f96ea3f 100644
--- a/ui/aura_shell/default_container_layout_manager_unittest.cc
+++ b/ui/aura_shell/default_container_layout_manager_unittest.cc
@@ -12,7 +12,6 @@
#include "ui/aura/screen_aura.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/workspace/workspace_controller.h"
-#include "ui/base/view_prop.h"
#include "views/widget/native_widget_aura.h"
namespace aura_shell {
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc
index 872ea61..81f5a09 100644
--- a/ui/aura_shell/shell.cc
+++ b/ui/aura_shell/shell.cc
@@ -17,7 +17,6 @@
#include "ui/aura_shell/shell_factory.h"
#include "ui/aura_shell/shell_window_ids.h"
#include "ui/aura_shell/workspace/workspace_controller.h"
-#include "ui/base/view_prop.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animator.h"
#include "views/widget/native_widget_aura.h"
diff --git a/ui/base/view_prop.h b/ui/base/view_prop.h
index b85cce4..b2f151c 100644
--- a/ui/base/view_prop.h
+++ b/ui/base/view_prop.h
@@ -11,6 +11,10 @@
#include "ui/base/ui_export.h"
#include "ui/gfx/native_widget_types.h"
+#if defined(USE_AURA) || defined(OS_LINUX) || defined(OS_MAC)
+#error view_prop.h is only for win, non aura build
+#endif
+
namespace ui {
// ViewProp maintains a key/value pair for a particular view. ViewProp is
diff --git a/ui/ui.gyp b/ui/ui.gyp
index 7fbe5d0..43763f7 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -321,6 +321,8 @@
['exclude', 'gfx/native_theme_chromeos.cc'],
['exclude', 'gfx/native_theme_chromeos.h'],
['exclude', 'gfx/screen_win.cc'],
+ ['exclude', 'base/view_prop.cc'],
+ ['exclude', 'base/view_prop.h'],
['exclude', 'base/win/mouse_wheel_util.cc'],
['exclude', 'base/win/mouse_wheel_util.h'],
['exclude', 'base/x/active_window_watcher_x.cc'],
@@ -406,8 +408,6 @@
['include', 'base/dragdrop/os_exchange_data_provider_gtk.h'],
['include', 'base/keycodes/keyboard_code_conversion_x.cc'],
['include', 'base/keycodes/keyboard_code_conversion_x.h'],
- ['include', 'base/view_prop.cc'],
- ['include', 'base/view_prop.h'],
['include', 'gfx/gtk_util.cc'],
['include', 'gfx/gtk_util.h'],
['include', 'gfx/path_gtk.cc'],
@@ -469,6 +469,8 @@
'base/dragdrop/drop_target.cc',
'base/dragdrop/drop_target.h',
'base/dragdrop/os_exchange_data.cc',
+ 'base/view_prop.cc',
+ 'base/view_prop.h',
'gfx/native_theme_win.cc',
'gfx/native_theme_win.h',
],
@@ -529,8 +531,6 @@
}],
['toolkit_views==0', {
'sources!': [
- 'base/view_prop.cc',
- 'base/view_prop.h',
'gfx/render_text.cc',
'gfx/render_text.h',
'gfx/render_text_linux.cc',
diff --git a/ui/ui_unittests.gypi b/ui/ui_unittests.gypi
index c1aa006..6bef7e8 100644
--- a/ui/ui_unittests.gypi
+++ b/ui/ui_unittests.gypi
@@ -161,6 +161,7 @@
}],
['use_aura==1', {
'sources!': [
+ 'base/view_prop_unittest.cc',
'gfx/screen_unittest.cc',
],
}],