| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 
| 6 #define ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 6 #define ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" | 
| 11 #include "ash/public/cpp/shelf_types.h" | 11 #include "ash/public/cpp/shelf_types.h" | 
| 12 | 12 | 
| 13 namespace ash { | 13 namespace ash { | 
| 14 | 14 | 
| 15 // Delegate shared by all shelf instances. | 15 // Delegate shared by all shelf instances. | 
| 16 class ASH_EXPORT ShelfDelegate { | 16 class ASH_EXPORT ShelfDelegate { | 
| 17  public: | 17  public: | 
| 18   virtual ~ShelfDelegate() {} | 18   virtual ~ShelfDelegate() {} | 
| 19 | 19 | 
| 20   // Get the shelf ID from an application ID. | 20   // Get the shelf ID from an application ID. Returns kInvalidShelfID if the | 
|  | 21   // app id is unknown, or has no associated ShelfID. | 
| 21   virtual ShelfID GetShelfIDForAppID(const std::string& app_id) = 0; | 22   virtual ShelfID GetShelfIDForAppID(const std::string& app_id) = 0; | 
| 22 | 23 | 
| 23   // Get the shelf ID from an application ID and a launch ID. | 24   // Get the shelf ID from an application ID and a launch ID. | 
| 24   // The launch ID can be passed to an app when launched in order to support | 25   // The launch ID can be passed to an app when launched in order to support | 
| 25   // multiple shelf items per app. This id is used together with the app_id to | 26   // multiple shelf items per app. This id is used together with the app_id to | 
| 26   // uniquely identify each shelf item that has the same app_id. | 27   // uniquely identify each shelf item that has the same app_id. | 
| 27   // For example, a single virtualization app might want to show different | 28   // For example, a single virtualization app might want to show different | 
| 28   // shelf icons for different remote apps. | 29   // shelf icons for different remote apps. Returns kInvalidShelfID if the app | 
|  | 30   // id is unknown or has no associated ShelfID. | 
| 29   virtual ShelfID GetShelfIDForAppIDAndLaunchID( | 31   virtual ShelfID GetShelfIDForAppIDAndLaunchID( | 
| 30       const std::string& app_id, | 32       const std::string& app_id, | 
| 31       const std::string& launch_id) = 0; | 33       const std::string& launch_id) = 0; | 
| 32 | 34 | 
| 33   // Checks whether a mapping exists from the ShelfID |id| to an app id. | 35   // Get the application ID for a given shelf ID. Returns an empty string for | 
| 34   virtual bool HasShelfIDToAppIDMapping(ShelfID id) const = 0; | 36   // an unknown or invalid ShelfID. | 
| 35 |  | 
| 36   // Get the application ID for a given shelf ID. |  | 
| 37   // |HasShelfIDToAppIDMapping(ShelfID)| should be called first to ensure the |  | 
| 38   // ShelfID can be successfully mapped to an app id. |  | 
| 39   virtual const std::string& GetAppIDForShelfID(ShelfID id) = 0; | 37   virtual const std::string& GetAppIDForShelfID(ShelfID id) = 0; | 
| 40 | 38 | 
| 41   // Pins an app with |app_id| to shelf. A running instance will get pinned. | 39   // Pins an app with |app_id| to shelf. A running instance will get pinned. | 
| 42   // In case there is no running instance a new shelf item is created and | 40   // In case there is no running instance a new shelf item is created and | 
| 43   // pinned. | 41   // pinned. | 
| 44   virtual void PinAppWithID(const std::string& app_id) = 0; | 42   virtual void PinAppWithID(const std::string& app_id) = 0; | 
| 45 | 43 | 
| 46   // Check if the app with |app_id_| is pinned to the shelf. | 44   // Check if the app with |app_id_| is pinned to the shelf. | 
| 47   virtual bool IsAppPinned(const std::string& app_id) = 0; | 45   virtual bool IsAppPinned(const std::string& app_id) = 0; | 
| 48 | 46 | 
| 49   // Unpins app item with |app_id|. | 47   // Unpins app item with |app_id|. | 
| 50   virtual void UnpinAppWithID(const std::string& app_id) = 0; | 48   virtual void UnpinAppWithID(const std::string& app_id) = 0; | 
| 51 }; | 49 }; | 
| 52 | 50 | 
| 53 }  // namespace ash | 51 }  // namespace ash | 
| 54 | 52 | 
| 55 #endif  // ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 53 #endif  // ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 
| OLD | NEW | 
|---|