 Chromium Code Reviews
 Chromium Code Reviews Issue 2771663002:
  mash: Refactor ChromeLauncherController's ShelfDelegate code.  (Closed)
    
  
    Issue 2771663002:
  mash: Refactor ChromeLauncherController's ShelfDelegate code.  (Closed) 
  | 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. | 
| 
James Cook
2017/03/23 16:43:49
nit: Maybe document that it returns kInvalidShelfI
 
msw
2017/03/23 18:08:10
Done.
 | |
| 21 virtual ShelfID GetShelfIDForAppID(const std::string& app_id) = 0; | 21 virtual ShelfID GetShelfIDForAppID(const std::string& app_id) = 0; | 
| 22 | 22 | 
| 23 // Get the shelf ID from an application ID and a launch ID. | 23 // 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 | 24 // 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 | 25 // 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. | 26 // uniquely identify each shelf item that has the same app_id. | 
| 27 // For example, a single virtualization app might want to show different | 27 // For example, a single virtualization app might want to show different | 
| 28 // shelf icons for different remote apps. | 28 // shelf icons for different remote apps. | 
| 29 virtual ShelfID GetShelfIDForAppIDAndLaunchID( | 29 virtual ShelfID GetShelfIDForAppIDAndLaunchID( | 
| 30 const std::string& app_id, | 30 const std::string& app_id, | 
| 31 const std::string& launch_id) = 0; | 31 const std::string& launch_id) = 0; | 
| 32 | 32 | 
| 33 // Checks whether a mapping exists from the ShelfID |id| to an app id. | |
| 34 virtual bool HasShelfIDToAppIDMapping(ShelfID id) const = 0; | |
| 35 | |
| 36 // Get the application ID for a given shelf ID. | 33 // Get the application ID for a given shelf ID. | 
| 
James Cook
2017/03/23 16:43:49
nit: What does it return for a bogus/invalid shelf
 
msw
2017/03/23 18:08:10
Documented that this should return an empty string
 | |
| 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; | 34 virtual const std::string& GetAppIDForShelfID(ShelfID id) = 0; | 
| 40 | 35 | 
| 41 // Pins an app with |app_id| to shelf. A running instance will get pinned. | 36 // 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 | 37 // In case there is no running instance a new shelf item is created and | 
| 43 // pinned. | 38 // pinned. | 
| 44 virtual void PinAppWithID(const std::string& app_id) = 0; | 39 virtual void PinAppWithID(const std::string& app_id) = 0; | 
| 45 | 40 | 
| 46 // Check if the app with |app_id_| is pinned to the shelf. | 41 // Check if the app with |app_id_| is pinned to the shelf. | 
| 47 virtual bool IsAppPinned(const std::string& app_id) = 0; | 42 virtual bool IsAppPinned(const std::string& app_id) = 0; | 
| 48 | 43 | 
| 49 // Unpins app item with |app_id|. | 44 // Unpins app item with |app_id|. | 
| 50 virtual void UnpinAppWithID(const std::string& app_id) = 0; | 45 virtual void UnpinAppWithID(const std::string& app_id) = 0; | 
| 51 }; | 46 }; | 
| 52 | 47 | 
| 53 } // namespace ash | 48 } // namespace ash | 
| 54 | 49 | 
| 55 #endif // ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 50 #endif // ASH_COMMON_SHELF_SHELF_DELEGATE_H_ | 
| OLD | NEW |