| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 unlock_button_->SetBounds(bounds.width() - ps.width(), | 53 unlock_button_->SetBounds(bounds.width() - ps.width(), |
| 54 bounds.bottom() + 10, | 54 bounds.bottom() + 10, |
| 55 ps.width(), ps.height()); | 55 ps.width(), ps.height()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Overridden from views::ButtonListener: | 58 // Overridden from views::ButtonListener: |
| 59 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | 59 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
| 60 DCHECK_EQ(sender, unlock_button_); | 60 DCHECK_EQ(sender, unlock_button_); |
| 61 mash::session::mojom::SessionPtr session; | 61 mash::session::mojom::SessionPtr session; |
| 62 connector_->ConnectToInterface("mojo:mash_session", &session); | 62 connector_->ConnectToInterface("service:mash_session", &session); |
| 63 session->UnlockScreen(); | 63 session->UnlockScreen(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 shell::Connector* connector_; | 66 shell::Connector* connector_; |
| 67 views::MdTextButton* unlock_button_; | 67 views::MdTextButton* unlock_button_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(ScreenlockView); | 69 DISALLOW_COPY_AND_ASSIGN(ScreenlockView); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 Screenlock::Screenlock() {} | 74 Screenlock::Screenlock() {} |
| 75 Screenlock::~Screenlock() {} | 75 Screenlock::~Screenlock() {} |
| 76 | 76 |
| 77 void Screenlock::OnStart(const shell::Identity& identity) { | 77 void Screenlock::OnStart(const shell::Identity& identity) { |
| 78 tracing_.Initialize(connector(), identity.name()); | 78 tracing_.Initialize(connector(), identity.name()); |
| 79 | 79 |
| 80 mash::session::mojom::SessionPtr session; | 80 mash::session::mojom::SessionPtr session; |
| 81 connector()->ConnectToInterface("mojo:mash_session", &session); | 81 connector()->ConnectToInterface("service:mash_session", &session); |
| 82 session->AddScreenlockStateListener( | 82 session->AddScreenlockStateListener( |
| 83 bindings_.CreateInterfacePtrAndBind(this)); | 83 bindings_.CreateInterfacePtrAndBind(this)); |
| 84 | 84 |
| 85 aura_init_.reset( | 85 aura_init_.reset( |
| 86 new views::AuraInit(connector(), "views_mus_resources.pak")); | 86 new views::AuraInit(connector(), "views_mus_resources.pak")); |
| 87 window_manager_connection_ = | 87 window_manager_connection_ = |
| 88 views::WindowManagerConnection::Create(connector(), identity); | 88 views::WindowManagerConnection::Create(connector(), identity); |
| 89 | 89 |
| 90 views::Widget* widget = new views::Widget; | 90 views::Widget* widget = new views::Widget; |
| 91 views::Widget::InitParams params( | 91 views::Widget::InitParams params( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 104 widget->Show(); | 104 widget->Show(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void Screenlock::ScreenlockStateChanged(bool screen_locked) { | 107 void Screenlock::ScreenlockStateChanged(bool screen_locked) { |
| 108 if (!screen_locked) | 108 if (!screen_locked) |
| 109 base::MessageLoop::current()->QuitWhenIdle(); | 109 base::MessageLoop::current()->QuitWhenIdle(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace screenlock | 112 } // namespace screenlock |
| 113 } // namespace mash | 113 } // namespace mash |
| OLD | NEW |