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

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

Issue 1857623003: convert //mash to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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/init/init.cc ('k') | mash/quick_launch/quick_launch_application.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/login/login.h" 5 #include "mash/login/login.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory>
8 9
9 #include "base/guid.h" 10 #include "base/guid.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "components/mus/public/cpp/property_type_converters.h" 14 #include "components/mus/public/cpp/property_type_converters.h"
14 #include "components/mus/public/interfaces/user_access_manager.mojom.h" 15 #include "components/mus/public/interfaces/user_access_manager.mojom.h"
15 #include "mash/init/public/interfaces/init.mojom.h" 16 #include "mash/init/public/interfaces/init.mojom.h"
16 #include "mash/login/public/interfaces/login.mojom.h" 17 #include "mash/login/public/interfaces/login.mojom.h"
17 #include "mash/wm/public/interfaces/container.mojom.h" 18 #include "mash/wm/public/interfaces/container.mojom.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 window_manager_connection_->SetConnectionLostClosure( 117 window_manager_connection_->SetConnectionLostClosure(
117 base::Bind(&UI::StartWindowManager, base::Unretained(this))); 118 base::Bind(&UI::StartWindowManager, base::Unretained(this)));
118 } 119 }
119 120
120 Login* login_; 121 Login* login_;
121 mojo::Connector* connector_; 122 mojo::Connector* connector_;
122 const std::string user_id_1_; 123 const std::string user_id_1_;
123 const std::string user_id_2_; 124 const std::string user_id_2_;
124 views::LabelButton* login_button_1_; 125 views::LabelButton* login_button_1_;
125 views::LabelButton* login_button_2_; 126 views::LabelButton* login_button_2_;
126 scoped_ptr<mojo::Connection> window_manager_connection_; 127 std::unique_ptr<mojo::Connection> window_manager_connection_;
127 128
128 DISALLOW_COPY_AND_ASSIGN(UI); 129 DISALLOW_COPY_AND_ASSIGN(UI);
129 }; 130 };
130 131
131 class Login : public mojo::ShellClient, 132 class Login : public mojo::ShellClient,
132 public mojo::InterfaceFactory<mojom::Login>, 133 public mojo::InterfaceFactory<mojom::Login>,
133 public mojom::Login { 134 public mojom::Login {
134 public: 135 public:
135 Login() {} 136 Login() {}
136 ~Login() override {} 137 ~Login() override {}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 UI::Show(connector_, this); 171 UI::Show(connector_, this);
171 } 172 }
172 void SwitchUser() override { 173 void SwitchUser() override {
173 UI::Show(connector_, this); 174 UI::Show(connector_, this);
174 } 175 }
175 176
176 void StartWindowManager(); 177 void StartWindowManager();
177 178
178 mojo::Connector* connector_; 179 mojo::Connector* connector_;
179 mojo::TracingImpl tracing_; 180 mojo::TracingImpl tracing_;
180 scoped_ptr<views::AuraInit> aura_init_; 181 std::unique_ptr<views::AuraInit> aura_init_;
181 mojo::BindingSet<mojom::Login> bindings_; 182 mojo::BindingSet<mojom::Login> bindings_;
182 mus::mojom::UserAccessManagerPtr user_access_manager_; 183 mus::mojom::UserAccessManagerPtr user_access_manager_;
183 scoped_ptr<mojo::Connection> window_manager_connection_; 184 std::unique_ptr<mojo::Connection> window_manager_connection_;
184 185
185 DISALLOW_COPY_AND_ASSIGN(Login); 186 DISALLOW_COPY_AND_ASSIGN(Login);
186 }; 187 };
187 188
188 void UI::ButtonPressed(views::Button* sender, const ui::Event& event) { 189 void UI::ButtonPressed(views::Button* sender, const ui::Event& event) {
189 // Login... 190 // Login...
190 if (sender == login_button_1_) { 191 if (sender == login_button_1_) {
191 login_->LoginAs(user_id_1_); 192 login_->LoginAs(user_id_1_);
192 } else if (sender == login_button_2_) { 193 } else if (sender == login_button_2_) {
193 login_->LoginAs(user_id_2_); 194 login_->LoginAs(user_id_2_);
194 } else { 195 } else {
195 NOTREACHED(); 196 NOTREACHED();
196 } 197 }
197 GetWidget()->Close(); 198 GetWidget()->Close();
198 } 199 }
199 200
200 } // namespace 201 } // namespace
201 202
202 mojo::ShellClient* CreateLogin() { 203 mojo::ShellClient* CreateLogin() {
203 return new Login; 204 return new Login;
204 } 205 }
205 206
206 } // namespace login 207 } // namespace login
207 } // namespace main 208 } // namespace main
OLDNEW
« no previous file with comments | « mash/init/init.cc ('k') | mash/quick_launch/quick_launch_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698