OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AURA_WINDOW_PROPERTY_H_ | 5 #ifndef UI_AURA_WINDOW_PROPERTY_H_ |
6 #define UI_AURA_WINDOW_PROPERTY_H_ | 6 #define UI_AURA_WINDOW_PROPERTY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "ui/aura/aura_export.h" | 10 #include "ui/aura/aura_export.h" |
11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
12 | 12 |
13 // This header should be included by code that defines WindowProperties. | 13 // This header should be included by code that defines WindowProperties. |
14 // | 14 // |
15 // To define a new WindowProperty: | 15 // To define a new WindowProperty: |
16 // | 16 // |
17 // #include "foo/foo_export.h" | 17 // #include "foo/foo_export.h" |
18 // #include "ui/aura/window_property.h" | 18 // #include "ui/aura/window_property.h" |
19 // | 19 // |
20 // DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(FOO_EXPORT, MyType); | 20 // DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(FOO_EXPORT, MyType); |
21 // namespace foo { | 21 // namespace foo { |
22 // // Use this to define an exported property that is premitive, | 22 // // Use this to define an exported property that is primitive, |
23 // // or a pointer you don't want automatically deleted. | 23 // // or a pointer you don't want automatically deleted. |
24 // DEFINE_WINDOW_PROPERTY_KEY(MyType, kMyKey, MyDefault); | 24 // DEFINE_WINDOW_PROPERTY_KEY(MyType, kMyKey, MyDefault); |
25 // | 25 // |
26 // // Use this to define an exported property whose value is a heap | 26 // // Use this to define an exported property whose value is a heap |
27 // // allocated object, and has to be owned and freed by the window. | 27 // // allocated object, and has to be owned and freed by the window. |
28 // DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::Rect, kRestoreBoundsKey, NULL); | 28 // DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::Rect, kRestoreBoundsKey, NULL); |
29 // | 29 // |
30 // // Use this to define a non exported property that is primitive, | 30 // // Use this to define a non exported property that is primitive, |
31 // // or a pointer you don't want to automatically deleted, and is used | 31 // // or a pointer you don't want to automatically deleted, and is used |
32 // // only in a specific file. This will define the property in an unnamed | 32 // // only in a specific file. This will define the property in an unnamed |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void Deallocator##NAME(int64_t p) { \ | 147 void Deallocator##NAME(int64_t p) { \ |
148 enum { type_must_be_complete = sizeof(TYPE) }; \ | 148 enum { type_must_be_complete = sizeof(TYPE) }; \ |
149 delete aura::WindowPropertyCaster<TYPE*>::FromInt64(p); \ | 149 delete aura::WindowPropertyCaster<TYPE*>::FromInt64(p); \ |
150 } \ | 150 } \ |
151 const aura::WindowProperty<TYPE*> NAME##_Value = {DEFAULT, #NAME, \ | 151 const aura::WindowProperty<TYPE*> NAME##_Value = {DEFAULT, #NAME, \ |
152 &Deallocator##NAME}; \ | 152 &Deallocator##NAME}; \ |
153 } \ | 153 } \ |
154 const aura::WindowProperty<TYPE*>* const NAME = &NAME##_Value; | 154 const aura::WindowProperty<TYPE*>* const NAME = &NAME##_Value; |
155 | 155 |
156 #endif // UI_AURA_WINDOW_PROPERTY_H_ | 156 #endif // UI_AURA_WINDOW_PROPERTY_H_ |
OLD | NEW |