1a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#ifndef ASH_SHELF_SHELF_DELEGATE_H_
6a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#define ASH_SHELF_SHELF_DELEGATE_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ash/ash_export.h"
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/shelf/shelf_item_types.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash {
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class Shelf;
13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Delegate for the Shelf.
15a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ASH_EXPORT ShelfDelegate {
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Shelf owns the delegate.
18a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual ~ShelfDelegate() {}
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
20c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Callback used to allow delegate to perform initialization actions that
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // depend on the Shelf being in a known state.
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnShelfCreated(Shelf* shelf) = 0;
23c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Callback used to inform the delegate that a specific shelf no longer
25c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // exists.
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnShelfDestroyed(Shelf* shelf) = 0;
27c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Get the shelf ID from an application ID.
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual ShelfID GetShelfIDForAppID(const std::string& app_id) = 0;
30b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Get the application ID for a given shelf ID.
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual const std::string& GetAppIDForShelfID(ShelfID id) = 0;
33424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Pins an app with |app_id| to shelf. A running instance will get pinned.
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // In case there is no running instance a new shelf item is created and
36b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  // pinned.
37b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void PinAppWithID(const std::string& app_id) = 0;
38b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Check if the app with |app_id_| is pinned to the shelf.
407d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  virtual bool IsAppPinned(const std::string& app_id) = 0;
417d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
4258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Checks whether the user is allowed to pin/unpin apps. Pinning may be
4358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // disallowed by policy in case there is a pre-defined set of pinned apps.
4458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual bool CanPin() const = 0;
4558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
46424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // Unpins app item with |app_id|.
47424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual void UnpinAppWithID(const std::string& app_id) = 0;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace ash
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
52a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif  // ASH_SHELF_SHELF_DELEGATE_H_
53