| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/touch_hud/mus/touch_hud_application.h" | 5 #include "ash/touch_hud/mus/touch_hud_application.h" |
| 6 | 6 |
| 7 #include "ash/public/interfaces/container.mojom.h" | 7 #include "ash/public/interfaces/container.mojom.h" |
| 8 #include "ash/touch_hud/touch_hud_renderer.h" | 8 #include "ash/touch_hud/touch_hud_renderer.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 views::WindowManagerConnection* window_manager_connection_; | 58 views::WindowManagerConnection* window_manager_connection_; |
| 59 TouchHudRenderer* touch_hud_renderer_; | 59 TouchHudRenderer* touch_hud_renderer_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(TouchHudUI); | 61 DISALLOW_COPY_AND_ASSIGN(TouchHudUI); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 TouchHudApplication::TouchHudApplication() : binding_(this) {} | 64 TouchHudApplication::TouchHudApplication() : binding_(this) {} |
| 65 TouchHudApplication::~TouchHudApplication() {} | 65 TouchHudApplication::~TouchHudApplication() {} |
| 66 | 66 |
| 67 void TouchHudApplication::OnStart(const shell::Identity& identity) { | 67 void TouchHudApplication::OnStart(const service_manager::Identity& identity) { |
| 68 aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak")); | 68 aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak")); |
| 69 window_manager_connection_ = | 69 window_manager_connection_ = |
| 70 views::WindowManagerConnection::Create(connector(), identity); | 70 views::WindowManagerConnection::Create(connector(), identity); |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool TouchHudApplication::OnConnect(const shell::Identity& remote_identity, | 73 bool TouchHudApplication::OnConnect( |
| 74 shell::InterfaceRegistry* registry) { | 74 const service_manager::Identity& remote_identity, |
| 75 service_manager::InterfaceRegistry* registry) { |
| 75 registry->AddInterface<mash::mojom::Launchable>(this); | 76 registry->AddInterface<mash::mojom::Launchable>(this); |
| 76 return true; | 77 return true; |
| 77 } | 78 } |
| 78 | 79 |
| 79 void TouchHudApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { | 80 void TouchHudApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { |
| 80 if (!widget_) { | 81 if (!widget_) { |
| 81 widget_ = new views::Widget; | 82 widget_ = new views::Widget; |
| 82 views::Widget::InitParams params( | 83 views::Widget::InitParams params( |
| 83 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 84 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 84 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 85 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 98 params.native_widget = new views::NativeWidgetMus( | 99 params.native_widget = new views::NativeWidgetMus( |
| 99 widget_, window, ui::mojom::SurfaceType::DEFAULT); | 100 widget_, window, ui::mojom::SurfaceType::DEFAULT); |
| 100 widget_->Init(params); | 101 widget_->Init(params); |
| 101 widget_->Show(); | 102 widget_->Show(); |
| 102 } else { | 103 } else { |
| 103 widget_->Close(); | 104 widget_->Close(); |
| 104 base::MessageLoop::current()->QuitWhenIdle(); | 105 base::MessageLoop::current()->QuitWhenIdle(); |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 | 108 |
| 108 void TouchHudApplication::Create(const shell::Identity& remote_identity, | 109 void TouchHudApplication::Create( |
| 109 mash::mojom::LaunchableRequest request) { | 110 const service_manager::Identity& remote_identity, |
| 111 mash::mojom::LaunchableRequest request) { |
| 110 binding_.Close(); | 112 binding_.Close(); |
| 111 binding_.Bind(std::move(request)); | 113 binding_.Bind(std::move(request)); |
| 112 } | 114 } |
| 113 | 115 |
| 114 } // namespace touch_hud | 116 } // namespace touch_hud |
| 115 } // namespace ash | 117 } // namespace ash |
| OLD | NEW |