summaryrefslogtreecommitdiffstats
path: root/ash/shelf/shelf_util.h
blob: 7e5dae17ab7363946b14344af2621001e97c7954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SHELF_SHELF_UTIL_H_
#define ASH_SHELF_SHELF_UTIL_H_

#include "ash/ash_export.h"
#include "ash/shelf/shelf_item_types.h"
#include "ui/aura/window.h"

namespace aura {
class Window;
}

namespace ash {

// A property key to store the id of the ShelfItem associated with the window.
extern const aura::WindowProperty<ShelfID>* const kShelfID;

// A property key to store the resource id and title of the item shown on the
// shelf for this window.
extern const aura::WindowProperty<ShelfItemDetails*>* const
    kShelfItemDetailsKey;

// Associates ShelfItem of |id| with specified |window|.
ASH_EXPORT void SetShelfIDForWindow(ShelfID id, aura::Window* window);

// Returns the id of the ShelfItem associated with the specified |window|,
// or 0 if there isn't one.
// Note: Window of a tabbed browser will return the |ShelfID| of the
// currently active tab.
ASH_EXPORT ShelfID GetShelfIDForWindow(aura::Window* window);

// Sets ShelfItemDetails for |window|.
ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window,
                                             const ShelfItemDetails& details);

// Clears ShelfItemDetails for |window|.
// If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will
// be removed.
ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window);

// Returns ShelfItemDetails for |window| or NULL if it doesn't have.
// Returned ShelfItemDetails object is owned by the |window|.
ASH_EXPORT const ShelfItemDetails* GetShelfItemDetailsForWindow(
    aura::Window* window);

}  // namespace ash

#endif  // ASH_SHELF_SHELF_UTIL_H_