OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 ASH_SHELF_SHELF_UTIL_H_ | 5 #ifndef ASH_SHELF_SHELF_UTIL_H_ |
6 #define ASH_SHELF_SHELF_UTIL_H_ | 6 #define ASH_SHELF_SHELF_UTIL_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/shelf_item_types.h" | 9 #include "ash/shelf/shelf_item_types.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
11 | 11 |
12 namespace aura { | 12 namespace aura { |
13 class Window; | 13 class Window; |
14 } | 14 } |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 | 17 |
| 18 // A property key to store the id of the ShelfItem associated with the window. |
| 19 extern const aura::WindowProperty<ShelfID>* const kShelfID; |
| 20 |
| 21 // A property key to store the resource id and title of the item shown on the |
| 22 // shelf for this window. |
18 extern const aura::WindowProperty<ShelfItemDetails*>* const | 23 extern const aura::WindowProperty<ShelfItemDetails*>* const |
19 kShelfItemDetailsKey; | 24 kShelfItemDetailsKey; |
20 | 25 |
21 // Associates ShelfItem of |id| with specified |window|. | 26 // Associates ShelfItem of |id| with specified |window|. |
22 ASH_EXPORT void SetShelfIDForWindow(ShelfID id, aura::Window* window); | 27 ASH_EXPORT void SetShelfIDForWindow(ShelfID id, aura::Window* window); |
23 | 28 |
24 // Returns the id of the ShelfItem associated with the specified |window|, | 29 // Returns the id of the ShelfItem associated with the specified |window|, |
25 // or 0 if there isn't one. | 30 // or 0 if there isn't one. |
26 // Note: Window of a tabbed browser will return the |ShelfID| of the | 31 // Note: Window of a tabbed browser will return the |ShelfID| of the |
27 // currently active tab. | 32 // currently active tab. |
28 ASH_EXPORT ShelfID GetShelfIDForWindow(aura::Window* window); | 33 ASH_EXPORT ShelfID GetShelfIDForWindow(aura::Window* window); |
29 | 34 |
30 // Sets ShelfItemDetails for |window|. | 35 // Sets ShelfItemDetails for |window|. |
31 ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window, | 36 ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window, |
32 const ShelfItemDetails& details); | 37 const ShelfItemDetails& details); |
33 | 38 |
34 // Clears ShelfItemDetails for |window|. | 39 // Clears ShelfItemDetails for |window|. |
35 // If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will | 40 // If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will |
36 // be removed. | 41 // be removed. |
37 ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window); | 42 ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window); |
38 | 43 |
39 // Returns ShelfItemDetails for |window| or NULL if it doesn't have. | 44 // Returns ShelfItemDetails for |window| or NULL if it doesn't have. |
40 // Returned ShelfItemDetails object is owned by the |window|. | 45 // Returned ShelfItemDetails object is owned by the |window|. |
41 ASH_EXPORT const ShelfItemDetails* GetShelfItemDetailsForWindow( | 46 ASH_EXPORT const ShelfItemDetails* GetShelfItemDetailsForWindow( |
42 aura::Window* window); | 47 aura::Window* window); |
43 | 48 |
44 } // namespace ash | 49 } // namespace ash |
45 | 50 |
46 #endif // ASH_SHELF_SHELF_UTIL_H_ | 51 #endif // ASH_SHELF_SHELF_UTIL_H_ |
OLD | NEW |