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/interfaces/container.mojom.h" | 7 #include "ash/public/interfaces/container.mojom.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "mash/session/public/interfaces/session.mojom.h" | 10 #include "mash/session/public/interfaces/session.mojom.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 views::LabelButton* unlock_button_; | 68 views::LabelButton* 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(shell::Connector* connector, | 78 void Screenlock::OnStart(const shell::Identity& identity) { |
79 const shell::Identity& identity, | 79 tracing_.Initialize(connector(), identity.name()); |
80 uint32_t id) { | |
81 tracing_.Initialize(connector, identity.name()); | |
82 | 80 |
83 mash::session::mojom::SessionPtr session; | 81 mash::session::mojom::SessionPtr session; |
84 connector->ConnectToInterface("mojo:mash_session", &session); | 82 connector()->ConnectToInterface("mojo:mash_session", &session); |
85 session->AddScreenlockStateListener( | 83 session->AddScreenlockStateListener( |
86 bindings_.CreateInterfacePtrAndBind(this)); | 84 bindings_.CreateInterfacePtrAndBind(this)); |
87 | 85 |
88 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); | 86 aura_init_.reset( |
| 87 new views::AuraInit(connector(), "views_mus_resources.pak")); |
89 window_manager_connection_ = | 88 window_manager_connection_ = |
90 views::WindowManagerConnection::Create(connector, identity); | 89 views::WindowManagerConnection::Create(connector(), identity); |
91 | 90 |
92 views::Widget* widget = new views::Widget; | 91 views::Widget* widget = new views::Widget; |
93 views::Widget::InitParams params( | 92 views::Widget::InitParams params( |
94 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 93 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
95 params.delegate = new ScreenlockView(connector); | 94 params.delegate = new ScreenlockView(connector()); |
96 | 95 |
97 std::map<std::string, std::vector<uint8_t>> properties; | 96 std::map<std::string, std::vector<uint8_t>> properties; |
98 properties[ash::mojom::kWindowContainer_Property] = | 97 properties[ash::mojom::kWindowContainer_Property] = |
99 mojo::ConvertTo<std::vector<uint8_t>>( | 98 mojo::ConvertTo<std::vector<uint8_t>>( |
100 static_cast<int32_t>(ash::mojom::Container::LOGIN_WINDOWS)); | 99 static_cast<int32_t>(ash::mojom::Container::LOGIN_WINDOWS)); |
101 ui::Window* window = | 100 ui::Window* window = |
102 views::WindowManagerConnection::Get()->NewWindow(properties); | 101 views::WindowManagerConnection::Get()->NewWindow(properties); |
103 params.native_widget = new views::NativeWidgetMus( | 102 params.native_widget = new views::NativeWidgetMus( |
104 widget, connector, window, ui::mojom::SurfaceType::DEFAULT); | 103 widget, connector(), window, ui::mojom::SurfaceType::DEFAULT); |
105 widget->Init(params); | 104 widget->Init(params); |
106 widget->Show(); | 105 widget->Show(); |
107 } | 106 } |
108 | 107 |
109 void Screenlock::ScreenlockStateChanged(bool screen_locked) { | 108 void Screenlock::ScreenlockStateChanged(bool screen_locked) { |
110 if (!screen_locked) | 109 if (!screen_locked) |
111 base::MessageLoop::current()->QuitWhenIdle(); | 110 base::MessageLoop::current()->QuitWhenIdle(); |
112 } | 111 } |
113 | 112 |
114 } // namespace screenlock | 113 } // namespace screenlock |
115 } // namespace mash | 114 } // namespace mash |
OLD | NEW |