| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_VIEW_PROP_H_ | 5 #ifndef UI_BASE_VIEW_PROP_H_ |
| 6 #define UI_BASE_VIEW_PROP_H_ | 6 #define UI_BASE_VIEW_PROP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "ui/base/ui_export.h" | 11 #include "ui/base/ui_export.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 | 13 |
| 14 #if defined(USE_AURA) || defined(OS_LINUX) || defined(OS_MACOSX) | 14 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(USE_AURA)) |
| 15 #error view_prop.h is only for win, non aura build | 15 #error view_prop.h is only for windows and aura builds. |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 // ViewProp maintains a key/value pair for a particular view. ViewProp is | 20 // ViewProp maintains a key/value pair for a particular view. ViewProp is |
| 21 // designed as a replacement for the Win32's SetProp, but does not make use of | 21 // designed as a replacement for the Win32's SetProp, but does not make use of |
| 22 // window manager memory. ViewProp shares similar semantics as SetProp, the | 22 // window manager memory. ViewProp shares similar semantics as SetProp, the |
| 23 // value for a particular view/key pair comes from the last ViewProp created. | 23 // value for a particular view/key pair comes from the last ViewProp created. |
| 24 class UI_EXPORT ViewProp { | 24 class UI_EXPORT ViewProp { |
| 25 public: | 25 public: |
| 26 // Associates data with a view/key pair. If a ViewProp has already been | 26 // Associates data with a view/key pair. If a ViewProp has already been |
| 27 // created for the specified pair |data| replaces the current value. | 27 // created for the specified pair |data| replaces the current value. |
| 28 // | 28 // |
| 29 // ViewProp does *not* make a copy of the char*, the pointer is used for | 29 // ViewProp does *not* make a copy of the char*, the pointer is used for |
| 30 // sorting. | 30 // sorting. |
| 31 ViewProp(gfx::NativeView view, const char* key, void* data); | 31 ViewProp(gfx::AcceleratedWidget view, const char* key, void* data); |
| 32 ~ViewProp(); | 32 ~ViewProp(); |
| 33 | 33 |
| 34 // Returns the value associated with the view/key pair, or NULL if there is | 34 // Returns the value associated with the view/key pair, or NULL if there is |
| 35 // none. | 35 // none. |
| 36 static void* GetValue(gfx::NativeView view, const char* key); | 36 static void* GetValue(gfx::AcceleratedWidget view, const char* key); |
| 37 | 37 |
| 38 // Returns the key. | 38 // Returns the key. |
| 39 const char* Key() const; | 39 const char* Key() const; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 class Data; | 42 class Data; |
| 43 | 43 |
| 44 // Stores the actual data. | 44 // Stores the actual data. |
| 45 scoped_refptr<Data> data_; | 45 scoped_refptr<Data> data_; |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(ViewProp); | 47 DISALLOW_COPY_AND_ASSIGN(ViewProp); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace ui | 50 } // namespace ui |
| 51 | 51 |
| 52 #endif // UI_BASE_VIEW_PROP_H_ | 52 #endif // UI_BASE_VIEW_PROP_H_ |
| OLD | NEW |