| 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 #include "ash/shelf/shelf_util.h" | 5 #include "ash/shelf/shelf_util.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_constants.h" | 7 #include "ash/common/shelf/shelf_constants.h" |
| 8 #include "ui/aura/window_property.h" | 8 #include "ui/aura/window_property.h" |
| 9 | 9 |
| 10 DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*); | 10 DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*); |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 DEFINE_WINDOW_PROPERTY_KEY(ShelfID, kShelfID, kInvalidShelfID); | 14 DEFINE_WINDOW_PROPERTY_KEY(ShelfID, kShelfID, kInvalidShelfID); |
| 15 | 15 |
| 16 // ShelfItemDetails for kShelfItemDetaildKey is owned by the window | 16 // ShelfItemDetails for kShelfItemDetaildKey is owned by the window |
| 17 // and will be freed automatically. | 17 // and will be freed automatically. |
| 18 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails, | 18 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails, kShelfItemDetailsKey, NULL); |
| 19 kShelfItemDetailsKey, | |
| 20 NULL); | |
| 21 | 19 |
| 22 void SetShelfIDForWindow(ShelfID id, aura::Window* window) { | 20 void SetShelfIDForWindow(ShelfID id, aura::Window* window) { |
| 23 if (!window) | 21 if (!window) |
| 24 return; | 22 return; |
| 25 | 23 |
| 26 window->SetProperty(kShelfID, id); | 24 window->SetProperty(kShelfID, id); |
| 27 } | 25 } |
| 28 | 26 |
| 29 ShelfID GetShelfIDForWindow(const aura::Window* window) { | 27 ShelfID GetShelfIDForWindow(const aura::Window* window) { |
| 30 DCHECK(window); | 28 DCHECK(window); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 46 item_details->type = TYPE_DIALOG; | 44 item_details->type = TYPE_DIALOG; |
| 47 item_details->image_resource_id = image_resource_id; | 45 item_details->image_resource_id = image_resource_id; |
| 48 item_details->title = title; | 46 item_details->title = title; |
| 49 window->SetProperty(kShelfItemDetailsKey, item_details); | 47 window->SetProperty(kShelfItemDetailsKey, item_details); |
| 50 } | 48 } |
| 51 | 49 |
| 52 void ClearShelfItemDetailsForWindow(aura::Window* window) { | 50 void ClearShelfItemDetailsForWindow(aura::Window* window) { |
| 53 window->ClearProperty(kShelfItemDetailsKey); | 51 window->ClearProperty(kShelfItemDetailsKey); |
| 54 } | 52 } |
| 55 | 53 |
| 56 const ShelfItemDetails* GetShelfItemDetailsForWindow( | 54 const ShelfItemDetails* GetShelfItemDetailsForWindow(aura::Window* window) { |
| 57 aura::Window* window) { | |
| 58 return window->GetProperty(kShelfItemDetailsKey); | 55 return window->GetProperty(kShelfItemDetailsKey); |
| 59 } | 56 } |
| 60 | 57 |
| 61 } // namespace ash | 58 } // namespace ash |
| OLD | NEW |