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

Side by Side Diff: mash/screenlock/screenlock.cc

Issue 2487573002: Service Manager: Remove ServiceContext* arg from Service::OnStart() (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « mash/screenlock/screenlock.h ('k') | mash/session/session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "mash/screenlock/screenlock.h" 5 #include "mash/screenlock/screenlock.h"
6 6
7 #include "ash/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 views::MdTextButton* unlock_button_; 68 views::MdTextButton* unlock_button_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(ScreenlockView); 70 DISALLOW_COPY_AND_ASSIGN(ScreenlockView);
71 }; 71 };
72 72
73 } // namespace 73 } // namespace
74 74
75 Screenlock::Screenlock() {} 75 Screenlock::Screenlock() {}
76 Screenlock::~Screenlock() {} 76 Screenlock::~Screenlock() {}
77 77
78 void Screenlock::OnStart(service_manager::ServiceContext* context) { 78 void Screenlock::OnStart() {
79 tracing_.Initialize(context->connector(), context->identity().name()); 79 tracing_.Initialize(context()->connector(), context()->identity().name());
80 80
81 mash::session::mojom::SessionPtr session; 81 mash::session::mojom::SessionPtr session;
82 context->connector()->ConnectToInterface("service:mash_session", &session); 82 context()->connector()->ConnectToInterface("service:mash_session", &session);
83 session->AddScreenlockStateListener( 83 session->AddScreenlockStateListener(
84 bindings_.CreateInterfacePtrAndBind(this)); 84 bindings_.CreateInterfacePtrAndBind(this));
85 85
86 aura_init_ = base::MakeUnique<views::AuraInit>( 86 aura_init_ = base::MakeUnique<views::AuraInit>(
87 context->connector(), context->identity(), "views_mus_resources.pak"); 87 context()->connector(), context()->identity(), "views_mus_resources.pak");
88 window_manager_connection_ = views::WindowManagerConnection::Create( 88 window_manager_connection_ = views::WindowManagerConnection::Create(
89 context->connector(), context->identity()); 89 context()->connector(), context()->identity());
90 90
91 views::Widget* widget = new views::Widget; 91 views::Widget* widget = new views::Widget;
92 views::Widget::InitParams params( 92 views::Widget::InitParams params(
93 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 93 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
94 params.delegate = new ScreenlockView(context->connector()); 94 params.delegate = new ScreenlockView(context()->connector());
95 95
96 std::map<std::string, std::vector<uint8_t>> properties; 96 std::map<std::string, std::vector<uint8_t>> properties;
97 properties[ui::mojom::WindowManager::kInitialContainerId_Property] = 97 properties[ui::mojom::WindowManager::kInitialContainerId_Property] =
98 mojo::ConvertTo<std::vector<uint8_t>>( 98 mojo::ConvertTo<std::vector<uint8_t>>(
99 ash::kShellWindowId_LockScreenContainer); 99 ash::kShellWindowId_LockScreenContainer);
100 ui::Window* window = 100 ui::Window* window =
101 views::WindowManagerConnection::Get()->NewTopLevelWindow(properties); 101 views::WindowManagerConnection::Get()->NewTopLevelWindow(properties);
102 params.native_widget = new views::NativeWidgetMus( 102 params.native_widget = new views::NativeWidgetMus(
103 widget, window, ui::mojom::CompositorFrameSinkType::DEFAULT); 103 widget, window, ui::mojom::CompositorFrameSinkType::DEFAULT);
104 widget->Init(params); 104 widget->Init(params);
105 widget->Show(); 105 widget->Show();
106 } 106 }
107 107
108 bool Screenlock::OnConnect( 108 bool Screenlock::OnConnect(
109 const service_manager::ServiceInfo& remote_info, 109 const service_manager::ServiceInfo& remote_info,
110 service_manager::InterfaceRegistry* registry) { 110 service_manager::InterfaceRegistry* registry) {
111 return false; 111 return false;
112 } 112 }
113 113
114 void Screenlock::ScreenlockStateChanged(bool screen_locked) { 114 void Screenlock::ScreenlockStateChanged(bool screen_locked) {
115 if (!screen_locked) 115 if (!screen_locked)
116 base::MessageLoop::current()->QuitWhenIdle(); 116 base::MessageLoop::current()->QuitWhenIdle();
117 } 117 }
118 118
119 } // namespace screenlock 119 } // namespace screenlock
120 } // namespace mash 120 } // namespace mash
OLDNEW
« 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