1f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// found in the LICENSE file. 4f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 5f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#ifndef ASH_SHELF_SHELF_UTIL_H_ 6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#define ASH_SHELF_SHELF_UTIL_H_ 7f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 8f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ash/ash_export.h" 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/shelf/shelf_item_types.h" 101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "base/strings/string16.h" 11a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ui/aura/window.h" 12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 13f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace aura { 14f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class Window; 15f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)} 16f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace ash { 18f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 195c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// A property key to store the id of the ShelfItem associated with the window. 205c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liuextern const aura::WindowProperty<ShelfID>* const kShelfID; 215c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu 225c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// A property key to store the resource id and title of the item shown on the 235c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// shelf for this window. 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)extern const aura::WindowProperty<ShelfItemDetails*>* const 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) kShelfItemDetailsKey; 26a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Associates ShelfItem of |id| with specified |window|. 285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)ASH_EXPORT void SetShelfIDForWindow(ShelfID id, aura::Window* window); 29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Returns the id of the ShelfItem associated with the specified |window|, 31f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// or 0 if there isn't one. 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Note: Window of a tabbed browser will return the |ShelfID| of the 33f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// currently active tab. 34f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)ASH_EXPORT ShelfID GetShelfIDForWindow(const aura::Window* window); 35f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 366d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// Creates a new ShelfItemDetails instance from |details| and sets it for 376d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// |window|. 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window, 395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const ShelfItemDetails& details); 40a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// Creates a new ShelfItemDetails instance with type DIALOG, image id 421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// |image_resource_id|, and title |title|, and sets it for |window|. 436d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)ASH_EXPORT void SetShelfItemDetailsForDialogWindow(aura::Window* window, 441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci int image_resource_id, 451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const base::string16& title); 466d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Clears ShelfItemDetails for |window|. 485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will 49a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// be removed. 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window); 51a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Returns ShelfItemDetails for |window| or NULL if it doesn't have. 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Returned ShelfItemDetails object is owned by the |window|. 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)ASH_EXPORT const ShelfItemDetails* GetShelfItemDetailsForWindow( 55a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) aura::Window* window); 56a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 57f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)} // namespace ash 58f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 59f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#endif // ASH_SHELF_SHELF_UTIL_H_ 60