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.
5 #ifndef ASH_SHELF_SHELF_DELEGATE_H_
6 #define ASH_SHELF_SHELF_DELEGATE_H_
8 #include "ash/ash_export.h"
9 #include "ash/shelf/shelf_item_types.h"
14 // Delegate for the Shelf.
15 class ASH_EXPORT ShelfDelegate
{
17 // Shelf owns the delegate.
18 virtual ~ShelfDelegate() {}
20 // Callback used to allow delegate to perform initialization actions that
21 // depend on the Shelf being in a known state.
22 virtual void OnShelfCreated(Shelf
* shelf
) = 0;
24 // Callback used to inform the delegate that a specific shelf no longer
26 virtual void OnShelfDestroyed(Shelf
* shelf
) = 0;
28 // Get the shelf ID from an application ID.
29 virtual ShelfID
GetShelfIDForAppID(const std::string
& app_id
) = 0;
31 // Checks whether a mapping exists from the ShelfID |id| to an app id.
32 virtual bool HasShelfIDToAppIDMapping(ShelfID id
) const = 0;
34 // Get the application ID for a given shelf ID.
35 // |HasShelfIDToAppIDMapping(ShelfID)| should be called first to ensure the
36 // ShelfID can be successfully mapped to an app id.
37 virtual const std::string
& GetAppIDForShelfID(ShelfID id
) = 0;
39 // Pins an app with |app_id| to shelf. A running instance will get pinned.
40 // In case there is no running instance a new shelf item is created and
42 virtual void PinAppWithID(const std::string
& app_id
) = 0;
44 // Check if the app with |app_id_| is pinned to the shelf.
45 virtual bool IsAppPinned(const std::string
& app_id
) = 0;
47 // Checks whether the user is allowed to pin/unpin apps. Pinning may be
48 // disallowed by policy in case there is a pre-defined set of pinned apps.
49 virtual bool CanPin() const = 0;
51 // Unpins app item with |app_id|.
52 virtual void UnpinAppWithID(const std::string
& app_id
) = 0;
57 #endif // ASH_SHELF_SHELF_DELEGATE_H_