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

Unified Diff: mash/catalog_viewer/catalog_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/catalog_viewer/catalog_viewer.cc
diff --git a/mash/catalog_viewer/catalog_viewer.cc b/mash/catalog_viewer/catalog_viewer.cc
index 75abf03a15032293ca67ccc37c2dc5b644b2c6a2..92f7c6470b14c13356a57663f08950a089b23095 100644
--- a/mash/catalog_viewer/catalog_viewer.cc
+++ b/mash/catalog_viewer/catalog_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"
@@ -18,6 +20,7 @@
#include "services/catalog/public/interfaces/constants.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/service_context.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"
@@ -225,6 +228,7 @@ void CatalogViewer::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 CatalogViewer::OnBindInterface(
@@ -245,11 +249,16 @@ void CatalogViewer::Launch(uint32_t what, mojom::LaunchMode how) {
catalog::mojom::CatalogPtr catalog;
context()->connector()->BindInterface(catalog::mojom::kServiceName, &catalog);
- views::Widget* window = views::Widget::CreateWindowWithContextAndBounds(
+ views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
new CatalogViewerContents(this, std::move(catalog)), nullptr,
gfx::Rect(25, 25, 500, 600));
- window->Show();
- windows_.push_back(window);
+ aura::Window* window = widget->GetNativeWindow();
+ const ash::ShelfID shelf_id("org.chromium.mash.catalog_viewer");
+ window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize()));
+ window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG);
+
+ widget->Show();
+ windows_.push_back(widget);
}
void CatalogViewer::Create(const service_manager::BindSourceInfo& source_info,

Powered by Google App Engine
This is Rietveld 408576698