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

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

Issue 2435153004: Change Service contract to pass ServiceInfo instead of Identity (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 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/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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 views::MdTextButton* unlock_button_; 66 views::MdTextButton* unlock_button_;
67 67
68 DISALLOW_COPY_AND_ASSIGN(ScreenlockView); 68 DISALLOW_COPY_AND_ASSIGN(ScreenlockView);
69 }; 69 };
70 70
71 } // namespace 71 } // namespace
72 72
73 Screenlock::Screenlock() {} 73 Screenlock::Screenlock() {}
74 Screenlock::~Screenlock() {} 74 Screenlock::~Screenlock() {}
75 75
76 void Screenlock::OnStart(const service_manager::Identity& identity) { 76 void Screenlock::OnStart(const service_manager::ServiceInfo& info) {
77 tracing_.Initialize(connector(), identity.name()); 77 tracing_.Initialize(connector(), info.identity.name());
78 78
79 mash::session::mojom::SessionPtr session; 79 mash::session::mojom::SessionPtr session;
80 connector()->ConnectToInterface("service:mash_session", &session); 80 connector()->ConnectToInterface("service:mash_session", &session);
81 session->AddScreenlockStateListener( 81 session->AddScreenlockStateListener(
82 bindings_.CreateInterfacePtrAndBind(this)); 82 bindings_.CreateInterfacePtrAndBind(this));
83 83
84 aura_init_.reset( 84 aura_init_.reset(
85 new views::AuraInit(connector(), "views_mus_resources.pak")); 85 new views::AuraInit(connector(), "views_mus_resources.pak"));
86 window_manager_connection_ = 86 window_manager_connection_ =
87 views::WindowManagerConnection::Create(connector(), identity); 87 views::WindowManagerConnection::Create(connector(), info.identity);
88 88
89 views::Widget* widget = new views::Widget; 89 views::Widget* widget = new views::Widget;
90 views::Widget::InitParams params( 90 views::Widget::InitParams params(
91 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 91 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
92 params.delegate = new ScreenlockView(connector()); 92 params.delegate = new ScreenlockView(connector());
93 93
94 std::map<std::string, std::vector<uint8_t>> properties; 94 std::map<std::string, std::vector<uint8_t>> properties;
95 properties[ui::mojom::WindowManager::kInitialContainerId_Property] = 95 properties[ui::mojom::WindowManager::kInitialContainerId_Property] =
96 mojo::ConvertTo<std::vector<uint8_t>>( 96 mojo::ConvertTo<std::vector<uint8_t>>(
97 ash::kShellWindowId_LockScreenContainer); 97 ash::kShellWindowId_LockScreenContainer);
98 ui::Window* window = 98 ui::Window* window =
99 views::WindowManagerConnection::Get()->NewTopLevelWindow(properties); 99 views::WindowManagerConnection::Get()->NewTopLevelWindow(properties);
100 params.native_widget = new views::NativeWidgetMus( 100 params.native_widget = new views::NativeWidgetMus(
101 widget, window, ui::mojom::CompositorFrameSinkType::DEFAULT); 101 widget, window, ui::mojom::CompositorFrameSinkType::DEFAULT);
102 widget->Init(params); 102 widget->Init(params);
103 widget->Show(); 103 widget->Show();
104 } 104 }
105 105
106 void Screenlock::ScreenlockStateChanged(bool screen_locked) { 106 void Screenlock::ScreenlockStateChanged(bool screen_locked) {
107 if (!screen_locked) 107 if (!screen_locked)
108 base::MessageLoop::current()->QuitWhenIdle(); 108 base::MessageLoop::current()->QuitWhenIdle();
109 } 109 }
110 110
111 } // namespace screenlock 111 } // namespace screenlock
112 } // namespace mash 112 } // 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