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/login/login.h" | 5 #include "mash/login/login.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/mus/public/cpp/property_type_converters.h" | 10 #include "components/mus/public/cpp/property_type_converters.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 views::LabelButton* login_button_2_; | 86 views::LabelButton* login_button_2_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(LoginView); | 88 DISALLOW_COPY_AND_ASSIGN(LoginView); |
89 }; | 89 }; |
90 | 90 |
91 } // namespace | 91 } // namespace |
92 | 92 |
93 Login::Login() {} | 93 Login::Login() {} |
94 Login::~Login() {} | 94 Login::~Login() {} |
95 | 95 |
96 void Login::Initialize(mojo::Connector* connector, const std::string& url, | 96 void Login::Initialize(mojo::Connector* connector, |
97 const std::string& user_id, uint32_t id) { | 97 const mojo::Identity& identity, |
98 tracing_.Initialize(connector, url); | 98 uint32_t id) { |
| 99 tracing_.Initialize(connector, identity.name()); |
99 | 100 |
100 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); | 101 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); |
101 views::WindowManagerConnection::Create(connector); | 102 views::WindowManagerConnection::Create(connector); |
102 | 103 |
103 views::Widget* widget = new views::Widget; | 104 views::Widget* widget = new views::Widget; |
104 views::Widget::InitParams params( | 105 views::Widget::InitParams params( |
105 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 106 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
106 params.delegate = new LoginView(this); | 107 params.delegate = new LoginView(this); |
107 | 108 |
108 std::map<std::string, std::vector<uint8_t>> properties; | 109 std::map<std::string, std::vector<uint8_t>> properties; |
109 properties[mash::wm::mojom::kWindowContainer_Property] = | 110 properties[mash::wm::mojom::kWindowContainer_Property] = |
110 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( | 111 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
111 static_cast<int32_t>(mash::wm::mojom::Container::LOGIN_WINDOWS)); | 112 static_cast<int32_t>(mash::wm::mojom::Container::LOGIN_WINDOWS)); |
112 mus::Window* window = | 113 mus::Window* window = |
113 views::WindowManagerConnection::Get()->NewWindow(properties); | 114 views::WindowManagerConnection::Get()->NewWindow(properties); |
114 params.native_widget = new views::NativeWidgetMus( | 115 params.native_widget = new views::NativeWidgetMus( |
115 widget, connector, window, mus::mojom::SurfaceType::DEFAULT); | 116 widget, connector, window, mus::mojom::SurfaceType::DEFAULT); |
116 widget->Init(params); | 117 widget->Init(params); |
117 widget->Show(); | 118 widget->Show(); |
118 } | 119 } |
119 | 120 |
120 bool Login::AcceptConnection(mojo::Connection* connection) { | 121 bool Login::AcceptConnection(mojo::Connection* connection) { |
121 if (connection->GetRemoteApplicationName() == "mojo:mash_init") { | 122 if (connection->GetRemoteIdentity().name() == "mojo:mash_init") { |
122 connection->GetInterface(&login_); | 123 connection->GetInterface(&login_); |
123 return true; | 124 return true; |
124 } | 125 } |
125 return false; | 126 return false; |
126 } | 127 } |
127 | 128 |
128 } // namespace login | 129 } // namespace login |
129 } // namespace main | 130 } // namespace main |
OLD | NEW |