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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ps1.height()); | 65 ps1.height()); |
66 login_button_2_->SetBounds(login_button_1_->bounds().right() + 10, | 66 login_button_2_->SetBounds(login_button_1_->bounds().right() + 10, |
67 button_box.y(), ps2.width(), ps2.height()); | 67 button_box.y(), ps2.width(), ps2.height()); |
68 } | 68 } |
69 | 69 |
70 // Overridden from views::ButtonListener: | 70 // Overridden from views::ButtonListener: |
71 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | 71 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
72 // Login... | 72 // Login... |
73 mojo::Connector::ConnectParams params("mojo:mash_shell"); | 73 mojo::Connector::ConnectParams params("mojo:mash_shell"); |
74 if (sender == login_button_1_) { | 74 if (sender == login_button_1_) { |
75 login_->login()->LoginAs(3); | 75 login_->login()->LoginAs("3"); |
76 } else if (sender == login_button_2_) { | 76 } else if (sender == login_button_2_) { |
77 login_->login()->LoginAs(4); | 77 login_->login()->LoginAs("4"); |
78 } else { | 78 } else { |
79 NOTREACHED(); | 79 NOTREACHED(); |
80 } | 80 } |
81 base::MessageLoop::current()->QuitWhenIdle(); | 81 base::MessageLoop::current()->QuitWhenIdle(); |
82 } | 82 } |
83 | 83 |
84 Login* login_; | 84 Login* login_; |
85 views::LabelButton* login_button_1_; | 85 views::LabelButton* login_button_1_; |
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, const std::string& url, |
97 uint32_t id, uint32_t user_id) { | 97 const std::string& user_id, uint32_t id) { |
98 tracing_.Initialize(connector, url); | 98 tracing_.Initialize(connector, url); |
99 | 99 |
100 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); | 100 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); |
101 views::WindowManagerConnection::Create(connector); | 101 views::WindowManagerConnection::Create(connector); |
102 | 102 |
103 views::Widget* widget = new views::Widget; | 103 views::Widget* widget = new views::Widget; |
104 views::Widget::InitParams params( | 104 views::Widget::InitParams params( |
105 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 105 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
106 params.delegate = new LoginView(this); | 106 params.delegate = new LoginView(this); |
107 | 107 |
(...skipping 12 matching lines...) Expand all Loading... |
120 bool Login::AcceptConnection(mojo::Connection* connection) { | 120 bool Login::AcceptConnection(mojo::Connection* connection) { |
121 if (connection->GetRemoteApplicationName() == "mojo:mash_init") { | 121 if (connection->GetRemoteApplicationName() == "mojo:mash_init") { |
122 connection->GetInterface(&login_); | 122 connection->GetInterface(&login_); |
123 return true; | 123 return true; |
124 } | 124 } |
125 return false; | 125 return false; |
126 } | 126 } |
127 | 127 |
128 } // namespace login | 128 } // namespace login |
129 } // namespace main | 129 } // namespace main |
OLD | NEW |