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
3// found in the LICENSE file.
4
5#ifndef ASH_SHELF_SHELF_UTIL_H_
6#define ASH_SHELF_SHELF_UTIL_H_
7
8#include "ash/ash_export.h"
9#include "ash/shelf/shelf_item_types.h"
10#include "base/strings/string16.h"
11#include "ui/aura/window.h"
12
13namespace aura {
14class Window;
15}
16
17namespace ash {
18
19// A property key to store the id of the ShelfItem associated with the window.
20extern const aura::WindowProperty<ShelfID>* const kShelfID;
21
22// A property key to store the resource id and title of the item shown on the
23// shelf for this window.
24extern const aura::WindowProperty<ShelfItemDetails*>* const
25    kShelfItemDetailsKey;
26
27// Associates ShelfItem of |id| with specified |window|.
28ASH_EXPORT void SetShelfIDForWindow(ShelfID id, aura::Window* window);
29
30// Returns the id of the ShelfItem associated with the specified |window|,
31// or 0 if there isn't one.
32// Note: Window of a tabbed browser will return the |ShelfID| of the
33// currently active tab.
34ASH_EXPORT ShelfID GetShelfIDForWindow(const aura::Window* window);
35
36// Creates a new ShelfItemDetails instance from |details| and sets it for
37// |window|.
38ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window,
39                                             const ShelfItemDetails& details);
40
41// Creates a new ShelfItemDetails instance with type DIALOG, image id
42// |image_resource_id|, and title |title|, and sets it for |window|.
43ASH_EXPORT void SetShelfItemDetailsForDialogWindow(aura::Window* window,
44                                                   int image_resource_id,
45                                                   const base::string16& title);
46
47// Clears ShelfItemDetails for |window|.
48// If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will
49// be removed.
50ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window);
51
52// Returns ShelfItemDetails for |window| or NULL if it doesn't have.
53// Returned ShelfItemDetails object is owned by the |window|.
54ASH_EXPORT const ShelfItemDetails* GetShelfItemDetailsForWindow(
55    aura::Window* window);
56
57}  // namespace ash
58
59#endif  // ASH_SHELF_SHELF_UTIL_H_
60