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

Unified Diff: mash/screenlock/screenlock.cc

Issue 2476063002: Service Manager: Rework Service and ServiceContext lifetime (Closed)
Patch Set: . Created 4 years, 1 month 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 | « mash/screenlock/screenlock.h ('k') | mash/session/session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/screenlock/screenlock.cc
diff --git a/mash/screenlock/screenlock.cc b/mash/screenlock/screenlock.cc
index a488f56969175cc87df11a472c922a1c41b9247a..895c32a6b8f6c918e7e2d7b2a47252fa677355e2 100644
--- a/mash/screenlock/screenlock.cc
+++ b/mash/screenlock/screenlock.cc
@@ -11,6 +11,7 @@
#include "mash/session/public/interfaces/session.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service_context.h"
#include "services/ui/public/cpp/property_type_converters.h"
#include "ui/views/background.h"
#include "ui/views/controls/button/md_text_button.h"
@@ -74,23 +75,23 @@ class ScreenlockView : public views::WidgetDelegateView,
Screenlock::Screenlock() {}
Screenlock::~Screenlock() {}
-void Screenlock::OnStart(const service_manager::ServiceInfo& info) {
- tracing_.Initialize(connector(), info.identity.name());
+void Screenlock::OnStart(service_manager::ServiceContext* context) {
+ tracing_.Initialize(context->connector(), context->identity().name());
mash::session::mojom::SessionPtr session;
- connector()->ConnectToInterface("service:mash_session", &session);
+ context->connector()->ConnectToInterface("service:mash_session", &session);
session->AddScreenlockStateListener(
bindings_.CreateInterfacePtrAndBind(this));
- aura_init_ = base::MakeUnique<views::AuraInit>(connector(), info.identity,
- "views_mus_resources.pak");
- window_manager_connection_ =
- views::WindowManagerConnection::Create(connector(), info.identity);
+ aura_init_ = base::MakeUnique<views::AuraInit>(
+ context->connector(), context->identity(), "views_mus_resources.pak");
+ window_manager_connection_ = views::WindowManagerConnection::Create(
+ context->connector(), context->identity());
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- params.delegate = new ScreenlockView(connector());
+ params.delegate = new ScreenlockView(context->connector());
std::map<std::string, std::vector<uint8_t>> properties;
properties[ui::mojom::WindowManager::kInitialContainerId_Property] =
@@ -104,6 +105,12 @@ void Screenlock::OnStart(const service_manager::ServiceInfo& info) {
widget->Show();
}
+bool Screenlock::OnConnect(
+ const service_manager::ServiceInfo& remote_info,
+ service_manager::InterfaceRegistry* registry) {
+ return false;
+}
+
void Screenlock::ScreenlockStateChanged(bool screen_locked) {
if (!screen_locked)
base::MessageLoop::current()->QuitWhenIdle();
« no previous file with comments | « mash/screenlock/screenlock.h ('k') | mash/session/session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698