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 <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 | 33 |
34 class Login; | 34 class Login; |
35 | 35 |
36 class UI : public views::WidgetDelegateView, | 36 class UI : public views::WidgetDelegateView, |
37 public views::ButtonListener { | 37 public views::ButtonListener { |
38 public: | 38 public: |
39 static void Show(shell::Connector* connector, | 39 static void Show(shell::Connector* connector, |
40 const shell::Identity& identity, | 40 const shell::Identity& identity, |
41 Login* login) { | 41 Login* login) { |
42 UI* ui = new UI(login, connector); | 42 UI* ui = new UI(login, connector); |
43 ui->StartWindowManager(); | 43 ui->StartWindowManager(identity); |
44 | |
45 views::WindowManagerConnection::Create(connector, identity); | |
46 | 44 |
47 views::Widget* widget = new views::Widget; | 45 views::Widget* widget = new views::Widget; |
48 views::Widget::InitParams params( | 46 views::Widget::InitParams params( |
49 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 47 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
50 params.delegate = ui; | 48 params.delegate = ui; |
51 | 49 |
52 std::map<std::string, std::vector<uint8_t>> properties; | 50 std::map<std::string, std::vector<uint8_t>> properties; |
53 properties[mash::wm::mojom::kWindowContainer_Property] = | 51 properties[mash::wm::mojom::kWindowContainer_Property] = |
54 mojo::ConvertTo<std::vector<uint8_t>>( | 52 mojo::ConvertTo<std::vector<uint8_t>>( |
55 static_cast<int32_t>(mash::wm::mojom::Container::LOGIN_WINDOWS)); | 53 static_cast<int32_t>(mash::wm::mojom::Container::LOGIN_WINDOWS)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 | 105 |
108 login_button_1_->SetBounds(button_box.x(), button_box.y(), ps1.width(), | 106 login_button_1_->SetBounds(button_box.x(), button_box.y(), ps1.width(), |
109 ps1.height()); | 107 ps1.height()); |
110 login_button_2_->SetBounds(login_button_1_->bounds().right() + 10, | 108 login_button_2_->SetBounds(login_button_1_->bounds().right() + 10, |
111 button_box.y(), ps2.width(), ps2.height()); | 109 button_box.y(), ps2.width(), ps2.height()); |
112 } | 110 } |
113 | 111 |
114 // Overridden from views::ButtonListener: | 112 // Overridden from views::ButtonListener: |
115 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 113 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
116 | 114 |
117 void StartWindowManager() { | 115 void StartWindowManager(const shell::Identity& identity) { |
118 window_manager_connection_ = connector_->Connect("mojo:desktop_wm"); | 116 window_manager_connection_ = connector_->Connect("mojo:desktop_wm"); |
119 window_manager_connection_->SetConnectionLostClosure( | 117 window_manager_connection_->SetConnectionLostClosure( |
120 base::Bind(&UI::StartWindowManager, base::Unretained(this))); | 118 base::Bind(&UI::StartWindowManager, base::Unretained(this), identity)); |
119 views_mus_ = views::WindowManagerConnection::Create(connector_, identity); | |
121 } | 120 } |
122 | 121 |
123 Login* login_; | 122 Login* login_; |
124 shell::Connector* connector_; | 123 shell::Connector* connector_; |
125 const std::string user_id_1_; | 124 const std::string user_id_1_; |
126 const std::string user_id_2_; | 125 const std::string user_id_2_; |
127 views::LabelButton* login_button_1_; | 126 views::LabelButton* login_button_1_; |
128 views::LabelButton* login_button_2_; | 127 views::LabelButton* login_button_2_; |
129 std::unique_ptr<shell::Connection> window_manager_connection_; | 128 std::unique_ptr<shell::Connection> window_manager_connection_; |
129 std::unique_ptr<views::WindowManagerConnection> views_mus_; | |
sky
2016/05/31 18:57:24
mooorrrr
| |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(UI); | 131 DISALLOW_COPY_AND_ASSIGN(UI); |
132 }; | 132 }; |
133 | 133 |
134 class Login : public shell::ShellClient, | 134 class Login : public shell::ShellClient, |
135 public shell::InterfaceFactory<mojom::Login>, | 135 public shell::InterfaceFactory<mojom::Login>, |
136 public mojom::Login { | 136 public mojom::Login { |
137 public: | 137 public: |
138 Login() {} | 138 Login() {} |
139 ~Login() override {} | 139 ~Login() override {} |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 } | 200 } |
201 | 201 |
202 } // namespace | 202 } // namespace |
203 | 203 |
204 shell::ShellClient* CreateLogin() { | 204 shell::ShellClient* CreateLogin() { |
205 return new Login; | 205 return new Login; |
206 } | 206 } |
207 | 207 |
208 } // namespace login | 208 } // namespace login |
209 } // namespace main | 209 } // namespace main |
OLD | NEW |