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

Unified Diff: mash/example/views_examples/views_examples.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/example/views_examples/views_examples.cc
diff --git a/mash/example/views_examples/views_examples.cc b/mash/example/views_examples/views_examples.cc
index e559bf998ec8ea814d369494f15a04946a3a58c5..769abd676236e97f37e63a794acbcb22199bf100 100644
--- a/mash/example/views_examples/views_examples.cc
+++ b/mash/example/views_examples/views_examples.cc
@@ -5,6 +5,8 @@
#include <memory>
#include <vector>
+#include "ash/public/cpp/shelf_types.h"
+#include "ash/public/cpp/window_properties.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "mash/public/interfaces/launchable.mojom.h"
@@ -15,9 +17,11 @@
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_context.h"
#include "services/service_manager/public/cpp/service_runner.h"
+#include "ui/aura/window.h"
#include "ui/views/examples/example_base.h"
#include "ui/views/examples/examples_window.h"
#include "ui/views/mus/aura_init.h"
+#include "ui/views/widget/widget.h"
class ViewsExamples : public service_manager::Service,
public mash::mojom::Launchable {
@@ -35,6 +39,7 @@ class ViewsExamples : public service_manager::Service,
context()->connector(), context()->identity(),
"views_mus_resources.pak", std::string(), nullptr,
views::AuraInit::Mode::AURA_MUS);
+ ash::RegisterWindowPropertiesForTransportAndMirroring();
}
void OnBindInterface(const service_manager::BindSourceInfo& source_info,
const std::string& interface_name,
@@ -45,7 +50,13 @@ class ViewsExamples : public service_manager::Service,
// mash::mojom::Launchable:
void Launch(uint32_t what, mash::mojom::LaunchMode how) override {
- views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE);
+ views::Widget* widget =
+ views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE);
+ aura::Window* window = widget->GetNativeWindow();
+ const ash::ShelfID shelf_id("org.chromium.mash.views_examples");
+ window->SetProperty(ash::kShelfIDKey,
+ new std::string(shelf_id.Serialize()));
+ window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG);
}
void Create(const service_manager::BindSourceInfo& source_info,

Powered by Google App Engine
This is Rietveld 408576698