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

Unified Diff: mash/example/window_type_launcher/window_type_launcher.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/window_type_launcher/window_type_launcher.cc
diff --git a/mash/example/window_type_launcher/window_type_launcher.cc b/mash/example/window_type_launcher/window_type_launcher.cc
index 558a42c13d2f75c7c016f439470e8f4ae393d505..3614221b0716605861b725c389869ff29ef07101 100644
--- a/mash/example/window_type_launcher/window_type_launcher.cc
+++ b/mash/example/window_type_launcher/window_type_launcher.cc
@@ -6,6 +6,8 @@
#include <stdint.h>
+#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 "base/message_loop/message_loop.h"
@@ -456,6 +458,7 @@ void WindowTypeLauncher::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 WindowTypeLauncher::OnBindInterface(
@@ -473,12 +476,17 @@ void WindowTypeLauncher::Launch(uint32_t what, mash::mojom::LaunchMode how) {
windows_.back()->Activate();
return;
}
- views::Widget* window = new views::Widget;
+ views::Widget* widget = new views::Widget;
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
params.delegate = new WindowTypeLauncherView(this, context()->connector());
- window->Init(params);
- window->Show();
- windows_.push_back(window);
+ widget->Init(params);
+ aura::Window* window = widget->GetNativeWindow();
+ const ash::ShelfID shelf_id("org.chromium.mash.window_type_launcher");
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);
}
void WindowTypeLauncher::Create(

Powered by Google App Engine
This is Rietveld 408576698