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

Unified Diff: ash/touch_hud/mus/touch_hud_application.cc

Issue 2576533003: Converts some services to use aura-mus (Closed)
Patch Set: remove log Created 4 years 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 | « ash/touch_hud/mus/touch_hud_application.h ('k') | mash/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/touch_hud/mus/touch_hud_application.cc
diff --git a/ash/touch_hud/mus/touch_hud_application.cc b/ash/touch_hud/mus/touch_hud_application.cc
index e508065e4ca1ad7deb6f342b2806fb37141d3df6..37d1b4818aae6e9baab326483020c7629e8f6346 100644
--- a/ash/touch_hud/mus/touch_hud_application.cc
+++ b/ash/touch_hud/mus/touch_hud_application.cc
@@ -16,9 +16,9 @@
#include "services/ui/public/interfaces/window_manager_constants.mojom.h"
#include "ui/aura/mus/property_converter.h"
#include "ui/views/mus/aura_init.h"
+#include "ui/views/mus/mus_client.h"
#include "ui/views/mus/native_widget_mus.h"
-#include "ui/views/mus/pointer_watcher_event_router.h"
-#include "ui/views/mus/window_manager_connection.h"
+#include "ui/views/mus/pointer_watcher_event_router2.h"
#include "ui/views/pointer_watcher.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
@@ -27,20 +27,19 @@ namespace ash {
namespace touch_hud {
// TouchHudUI handles events on the widget of the touch-hud app. After
-// receiving touch events from ui::WindowManagerConnection, it calls
-// ash::TouchHudRenderer to draw out touch points.
+// receiving touch events from PointerWatcher, it calls ash::TouchHudRenderer to
+// draw the touch points.
class TouchHudUI : public views::WidgetDelegateView,
public views::PointerWatcher {
public:
- TouchHudUI(views::WindowManagerConnection* window_manager_connection,
- views::Widget* widget)
- : window_manager_connection_(window_manager_connection),
- touch_hud_renderer_(new TouchHudRenderer(widget)) {
- window_manager_connection_->pointer_watcher_event_router()
- ->AddPointerWatcher(this, true /* want_moves */);
+ explicit TouchHudUI(views::Widget* widget)
+ : touch_hud_renderer_(new TouchHudRenderer(widget)) {
+ views::MusClient::Get()->pointer_watcher_event_router()->AddPointerWatcher(
+ this, true /* want_moves */);
}
~TouchHudUI() override {
- window_manager_connection_->pointer_watcher_event_router()
+ views::MusClient::Get()
+ ->pointer_watcher_event_router()
->RemovePointerWatcher(this);
}
@@ -59,7 +58,6 @@ class TouchHudUI : public views::WidgetDelegateView,
touch_hud_renderer_->HandleTouchEvent(event);
}
- views::WindowManagerConnection* window_manager_connection_;
TouchHudRenderer* touch_hud_renderer_;
DISALLOW_COPY_AND_ASSIGN(TouchHudUI);
@@ -70,9 +68,8 @@ TouchHudApplication::~TouchHudApplication() {}
void TouchHudApplication::OnStart() {
aura_init_ = base::MakeUnique<views::AuraInit>(
- context()->connector(), context()->identity(), "views_mus_resources.pak");
- window_manager_connection_ = views::WindowManagerConnection::Create(
- context()->connector(), context()->identity());
+ context()->connector(), context()->identity(), "views_mus_resources.pak",
+ std::string(), nullptr, views::AuraInit::Mode::AURA_MUS);
}
bool TouchHudApplication::OnConnect(
@@ -90,20 +87,11 @@ void TouchHudApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) {
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
params.accept_events = false;
- params.delegate = new TouchHudUI(window_manager_connection_.get(), widget_);
-
- std::map<std::string, std::vector<uint8_t>> properties;
- properties[ui::mojom::WindowManager::kContainerId_InitProperty] =
+ params.delegate = new TouchHudUI(widget_);
+ params.mus_properties[ui::mojom::WindowManager::kContainerId_InitProperty] =
mojo::ConvertTo<std::vector<uint8_t>>(
ash::kShellWindowId_OverlayContainer);
- properties[ui::mojom::WindowManager::kShowState_Property] =
- mojo::ConvertTo<std::vector<uint8_t>>(
- static_cast<aura::PropertyConverter::PrimitiveType>(
- ui::mojom::ShowState::FULLSCREEN));
- ui::Window* window =
- window_manager_connection_.get()->NewTopLevelWindow(properties);
- params.native_widget = new views::NativeWidgetMus(
- widget_, window, ui::mojom::CompositorFrameSinkType::DEFAULT);
+ params.show_state = ui::SHOW_STATE_FULLSCREEN;
widget_->Init(params);
widget_->Show();
} else {
« no previous file with comments | « ash/touch_hud/mus/touch_hud_application.h ('k') | mash/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698