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 "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 Loading... |
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 |
OLD | NEW |