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

Unified Diff: mash/task_viewer/task_viewer.cc

Issue 2915223002: mash: Fix mash app shelf items; encapsulate ash property setup. (Closed)
Patch Set: Similar changes for other mash apps. Created 3 years, 7 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: mash/task_viewer/task_viewer.cc
diff --git a/mash/task_viewer/task_viewer.cc b/mash/task_viewer/task_viewer.cc
index 13e20f6f7b288cb4193a1210e6c512ae115584c3..21c1cb87ff1fa224dbfb1df0dc4d1e69360ada4e 100644
--- a/mash/task_viewer/task_viewer.cc
+++ b/mash/task_viewer/task_viewer.cc
@@ -7,6 +7,8 @@
#include <stddef.h>
#include <stdint.h>
+#include "ash/public/cpp/shelf_types.h"
+#include "ash/public/cpp/window_properties.h"
#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -22,6 +24,7 @@
#include "services/service_manager/public/cpp/service_context.h"
#include "services/service_manager/public/interfaces/constants.mojom.h"
#include "services/service_manager/public/interfaces/service_manager.mojom.h"
+#include "ui/aura/window.h"
#include "ui/base/models/table_model.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/resources/grit/ui_resources.h"
@@ -297,6 +300,7 @@ void TaskViewer::OnStart() {
aura_init_ = base::MakeUnique<views::AuraInit>(
context()->connector(), context()->identity(), "views_mus_resources.pak",
std::string(), nullptr, views::AuraInit::Mode::AURA_MUS);
+ ash::RegisterWindowPropertiesForTransportAndMirroring();
}
void TaskViewer::OnBindInterface(
@@ -325,10 +329,15 @@ void TaskViewer::Launch(uint32_t what, mojom::LaunchMode how) {
service_manager::mojom::ServiceManagerListenerPtr listener;
TaskViewerContents* task_viewer = new TaskViewerContents(
this, mojo::MakeRequest(&listener), std::move(catalog));
- views::Widget* window = views::Widget::CreateWindowWithContextAndBounds(
+ views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
task_viewer, nullptr, gfx::Rect(10, 10, 500, 500));
- window->Show();
- windows_.push_back(window);
+ aura::Window* window = widget->GetNativeWindow();
+ const ash::ShelfID shelf_id("org.chromium.mash.task_viewer");
msw 2017/06/01 23:35:41 q: I can't actually launch this from chrome --mash
+ window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize()));
+ window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG);
+
+ widget->Show();
+ windows_.push_back(widget);
service_manager->AddListener(std::move(listener));
}

Powered by Google App Engine
This is Rietveld 408576698