Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Cleanup; fix ash_shell compile and a couple tests. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc
index 0136890fec78d8b26fa6c17d35077f4484901176..6460e2ef35f9a9fde50aeb758bbdfd448ee5e040 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc
@@ -15,38 +15,29 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/event_constants.h"
-class ChromeShelfItemDelegate : public ash::mojom::ShelfItemDelegate {
+class ChromeShelfItemDelegate : public ash::ShelfItemDelegate {
James Cook 2017/03/09 01:09:47 drive-by: docs?
msw 2017/03/10 06:17:57 It's unused at the moment, and the wrong pattern f
public:
explicit ChromeShelfItemDelegate(const std::string& app_id,
James Cook 2017/03/09 01:09:47 drive-by: explicit not needed
msw 2017/03/10 06:17:57 Removed.
ChromeLauncherController* controller)
- : app_id_(app_id),
- item_delegate_binding_(this),
- controller_(controller) {}
+ : app_id_(app_id), controller_(controller) {}
~ChromeShelfItemDelegate() override {}
- ash::mojom::ShelfItemDelegateAssociatedPtrInfo
- CreateInterfacePtrInfoAndBind() {
- DCHECK(!item_delegate_binding_.is_bound());
- ash::mojom::ShelfItemDelegateAssociatedPtrInfo ptr_info;
- item_delegate_binding_.Bind(&ptr_info);
- return ptr_info;
- }
-
private:
- // ash::mojom::ShelfItemDelegate:
- void LaunchItem() override {
+ // ash::ShelfItemDelegate:
+ void ItemSelected(std::unique_ptr<ui::Event> event,
+ int64_t display_id,
+ ash::ShelfLaunchSource source,
+ const ItemSelectedCallback& callback) override {
controller_->LaunchApp(ash::AppLauncherId(app_id_),
ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE);
+ callback.Run(ash::SHELF_ACTION_NEW_WINDOW_CREATED, MenuItemList());
James Cook 2017/03/09 01:09:47 Does this actually create a new window for all ite
msw 2017/03/10 06:17:57 Unused; removed.
}
- void ExecuteCommand(uint32_t command_id, int event_flags) override {
+ void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {
NOTIMPLEMENTED();
}
- void ItemPinned() override { NOTIMPLEMENTED(); }
- void ItemUnpinned() override { NOTIMPLEMENTED(); }
- void ItemReordered(uint32_t order) override { NOTIMPLEMENTED(); }
+ void Close() override { NOTIMPLEMENTED(); }
std::string app_id_;
- mojo::AssociatedBinding<ash::mojom::ShelfItemDelegate> item_delegate_binding_;
// Not owned.
ChromeLauncherController* controller_;
@@ -182,11 +173,11 @@ void ChromeLauncherControllerMus::AdditionalUserAddedToSession(
NOTIMPLEMENTED();
}
-ash::ShelfAppMenuItemList
+ash::ShelfItemDelegate::MenuItemList
ChromeLauncherControllerMus::GetAppMenuItemsForTesting(
const ash::ShelfItem& item) {
NOTIMPLEMENTED();
- return ash::ShelfAppMenuItemList();
+ return ash::ShelfItemDelegate::MenuItemList();
}
std::vector<content::WebContents*>
@@ -290,10 +281,10 @@ void ChromeLauncherControllerMus::PinAppsFromPrefs() {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Image& image = rb.GetImageNamed(IDR_APP_DEFAULT_ICON);
item->image = *image.ToSkBitmap();
+ // TOOD(msw): Actually pin the item and install its delegate; this code is
+ // unused at the moment. See http://crbug.com/647879
std::unique_ptr<ChromeShelfItemDelegate> delegate(
new ChromeShelfItemDelegate(app_id, this));
- shelf_controller()->PinItem(std::move(item),
- delegate->CreateInterfacePtrInfoAndBind());
app_id_to_item_delegate_.insert(
std::make_pair(app_id, std::move(delegate)));

Powered by Google App Engine
This is Rietveld 408576698