 Chromium Code Reviews
 Chromium Code Reviews Issue 2671923002:
  mash: Cleanup ash shelf application menu code.  (Closed)
    
  
    Issue 2671923002:
  mash: Cleanup ash shelf application menu code.  (Closed) 
  | Index: ash/public/cpp/shelf_application_menu_item.h | 
| diff --git a/ash/public/cpp/shelf_application_menu_item.h b/ash/public/cpp/shelf_application_menu_item.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..8b50599365d700f1a953dc3f79241aebe39dd546 | 
| --- /dev/null | 
| +++ b/ash/public/cpp/shelf_application_menu_item.h | 
| @@ -0,0 +1,44 @@ | 
| +// Copyright 2017 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_PUBLIC_CPP_SHELF_APPLICATION_MENU_ITEM_H_ | 
| +#define ASH_PUBLIC_CPP_SHELF_APPLICATION_MENU_ITEM_H_ | 
| + | 
| +#include <memory> | 
| +#include <vector> | 
| + | 
| +#include "ash/public/cpp/ash_public_export.h" | 
| +#include "base/macros.h" | 
| +#include "base/strings/string16.h" | 
| +#include "ui/gfx/image/image.h" | 
| + | 
| +namespace ash { | 
| + | 
| +// The title, icon, and execute function for shelf application menu items. | 
| +class ASH_PUBLIC_EXPORT ShelfApplicationMenuItem { | 
| + public: | 
| + ShelfApplicationMenuItem(const base::string16 title, const gfx::Image* icon); | 
| 
James Cook
2017/02/06 17:30:21
nit: Note that null icon means empty/no icon.
 
msw
2017/02/07 09:12:01
Done.
 | 
| + virtual ~ShelfApplicationMenuItem(); | 
| + | 
| + // The title and icon for this menu item. | 
| + const base::string16& title() const { return title_; } | 
| + const gfx::Image& icon() const { return icon_; } | 
| + | 
| + // Executes the menu item; |event_flags| can be used to check additional | 
| + // keyboard modifiers from the event that issued this command. | 
| + virtual void Execute(int event_flags); | 
| 
James Cook
2017/02/06 17:30:21
It seems weird to me to have code in ash/public/cp
 
msw
2017/02/07 09:12:01
It is currently implemented by Chrome subclasses,
 | 
| + | 
| + private: | 
| + const base::string16 title_; | 
| + const gfx::Image icon_; | 
| + | 
| + DISALLOW_COPY_AND_ASSIGN(ShelfApplicationMenuItem); | 
| +}; | 
| + | 
| +using ShelfApplicationMenuItems = | 
| + std::vector<std::unique_ptr<ShelfApplicationMenuItem>>; | 
| + | 
| +} // namespace ash | 
| + | 
| +#endif // ASH_PUBLIC_CPP_SHELF_APPLICATION_MENU_ITEM_H_ |