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

Unified Diff: ash/mus/shelf_delegate_mus.cc

Issue 1951523002: Add basic support for launching mash shelf pinned apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only LaunchItem with no windows; otherwise kNoAction (for CreateApplicationMenu). Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/shelf_delegate_mus.cc
diff --git a/ash/mus/shelf_delegate_mus.cc b/ash/mus/shelf_delegate_mus.cc
index 62f1d2c15c16f12b8537784a55b182f7afaa4ce2..c1e1ac5471f18cc1da7555e96be77b06c8f7f3e4 100644
--- a/ash/mus/shelf_delegate_mus.cc
+++ b/ash/mus/shelf_delegate_mus.cc
@@ -42,6 +42,11 @@ class ShelfItemDelegateMus : public ShelfItemDelegate {
: user_window_controller_(user_window_controller) {}
~ShelfItemDelegateMus() override {}
+ void SetDelegate(
+ mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo delegate) {
+ delegate_.Bind(std::move(delegate));
+ }
+
bool pinned() const { return pinned_; }
void set_pinned(bool pinned) { pinned_ = pinned; }
@@ -102,6 +107,10 @@ class ShelfItemDelegateMus : public ShelfItemDelegate {
// ShelfItemDelegate:
ShelfItemDelegate::PerformedAction ItemSelected(
const ui::Event& event) override {
+ if (window_id_to_title_.empty()) {
+ delegate_->LaunchItem();
+ return kNewWindowCreated;
+ }
if (window_id_to_title_.size() == 1) {
user_window_controller_->FocusUserWindow(
window_id_to_title_.begin()->first);
@@ -133,6 +142,7 @@ class ShelfItemDelegateMus : public ShelfItemDelegate {
void Close() override { NOTIMPLEMENTED(); }
+ mash::shelf::mojom::ShelfItemDelegateAssociatedPtr delegate_;
bool pinned_ = false;
std::map<uint32_t, base::string16> window_id_to_title_;
base::string16 title_;
@@ -277,6 +287,7 @@ void ShelfDelegateMus::PinItem(
if (app_id_to_shelf_id_.count(app_id)) {
ShelfID shelf_id = app_id_to_shelf_id_[app_id];
ShelfItemDelegateMus* item_delegate = GetShelfItemDelegate(shelf_id);
+ item_delegate->SetDelegate(std::move(delegate));
item_delegate->set_pinned(true);
return;
}
@@ -293,6 +304,7 @@ void ShelfDelegateMus::PinItem(
std::unique_ptr<ShelfItemDelegateMus> item_delegate(
new ShelfItemDelegateMus(user_window_controller_.get()));
+ item_delegate->SetDelegate(std::move(delegate));
item_delegate->set_pinned(true);
item_delegate->set_title(item->app_title.To<base::string16>());
Shell::GetInstance()->shelf_item_delegate_manager()->SetShelfItemDelegate(
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698