This source file includes following definitions.
- SetShelfIDForWindow
- GetShelfIDForWindow
- SetShelfItemDetailsForWindow
- ClearShelfItemDetailsForWindow
- GetShelfItemDetailsForWindow
#include "ash/shelf/shelf_util.h"
#include "ash/shelf/shelf_constants.h"
#include "ui/aura/window_property.h"
DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfID);
DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*);
namespace ash {
DEFINE_LOCAL_WINDOW_PROPERTY_KEY(ShelfID, kShelfID, kInvalidShelfID);
DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails,
kShelfItemDetailsKey,
NULL);
void SetShelfIDForWindow(ShelfID id, aura::Window* window) {
if (!window)
return;
window->SetProperty(kShelfID, id);
}
ShelfID GetShelfIDForWindow(aura::Window* window) {
DCHECK(window);
return window->GetProperty(kShelfID);
}
void SetShelfItemDetailsForWindow(aura::Window* window,
const ShelfItemDetails& details) {
ShelfItemDetails* item_details = new ShelfItemDetails(details);
window->SetProperty(kShelfItemDetailsKey, item_details);
}
void ClearShelfItemDetailsForWindow(aura::Window* window) {
window->ClearProperty(kShelfItemDetailsKey);
}
const ShelfItemDetails* GetShelfItemDetailsForWindow(
aura::Window* window) {
return window->GetProperty(kShelfItemDetailsKey);
}
}