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

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

Issue 2430593002: mash: Use ash shell window container ids instead of ash::mojom::Container (Closed)
Patch Set: rebase Created 4 years, 2 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/login/BUILD.gn ('k') | mash/screenlock/BUILD.gn » ('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 #include <memory>
9 9
10 #include "ash/public/interfaces/container.mojom.h" 10 #include "ash/public/cpp/shell_window_ids.h"
11 #include "base/guid.h" 11 #include "base/guid.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "mash/init/public/interfaces/init.mojom.h" 15 #include "mash/init/public/interfaces/init.mojom.h"
16 #include "mash/login/public/interfaces/login.mojom.h" 16 #include "mash/login/public/interfaces/login.mojom.h"
17 #include "mojo/public/cpp/bindings/binding_set.h" 17 #include "mojo/public/cpp/bindings/binding_set.h"
18 #include "services/service_manager/public/cpp/connector.h" 18 #include "services/service_manager/public/cpp/connector.h"
19 #include "services/service_manager/public/cpp/service.h" 19 #include "services/service_manager/public/cpp/service.h"
20 #include "services/tracing/public/cpp/provider.h" 20 #include "services/tracing/public/cpp/provider.h"
21 #include "services/ui/public/cpp/property_type_converters.h" 21 #include "services/ui/public/cpp/property_type_converters.h"
22 #include "services/ui/public/interfaces/user_access_manager.mojom.h" 22 #include "services/ui/public/interfaces/user_access_manager.mojom.h"
23 #include "services/ui/public/interfaces/window_manager.mojom.h"
23 #include "ui/views/background.h" 24 #include "ui/views/background.h"
24 #include "ui/views/controls/button/md_text_button.h" 25 #include "ui/views/controls/button/md_text_button.h"
25 #include "ui/views/mus/aura_init.h" 26 #include "ui/views/mus/aura_init.h"
26 #include "ui/views/mus/native_widget_mus.h" 27 #include "ui/views/mus/native_widget_mus.h"
27 #include "ui/views/mus/window_manager_connection.h" 28 #include "ui/views/mus/window_manager_connection.h"
28 #include "ui/views/widget/widget_delegate.h" 29 #include "ui/views/widget/widget_delegate.h"
29 30
30 namespace mash { 31 namespace mash {
31 namespace login { 32 namespace login {
32 namespace { 33 namespace {
33 34
34 class Login; 35 class Login;
35 36
36 class UI : public views::WidgetDelegateView, 37 class UI : public views::WidgetDelegateView,
37 public views::ButtonListener { 38 public views::ButtonListener {
38 public: 39 public:
39 static void Show(service_manager::Connector* connector, 40 static void Show(service_manager::Connector* connector,
40 const service_manager::Identity& identity, 41 const service_manager::Identity& identity,
41 Login* login) { 42 Login* login) {
42 UI* ui = new UI(login, connector); 43 UI* ui = new UI(login, connector);
43 ui->StartWindowManager(identity); 44 ui->StartWindowManager(identity);
44 45
45 views::Widget* widget = new views::Widget; 46 views::Widget* widget = new views::Widget;
46 views::Widget::InitParams params( 47 views::Widget::InitParams params(
47 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 48 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
48 params.delegate = ui; 49 params.delegate = ui;
49 50
50 std::map<std::string, std::vector<uint8_t>> properties; 51 std::map<std::string, std::vector<uint8_t>> properties;
51 properties[ash::mojom::kWindowContainer_Property] = 52 properties[ui::mojom::WindowManager::kInitialContainerId_Property] =
52 mojo::ConvertTo<std::vector<uint8_t>>( 53 mojo::ConvertTo<std::vector<uint8_t>>(
53 static_cast<int32_t>(ash::mojom::Container::LOGIN_WINDOWS)); 54 ash::kShellWindowId_LockScreenContainer);
54 ui::Window* window = 55 ui::Window* window =
55 views::WindowManagerConnection::Get()->NewTopLevelWindow(properties); 56 views::WindowManagerConnection::Get()->NewTopLevelWindow(properties);
56 params.native_widget = new views::NativeWidgetMus( 57 params.native_widget = new views::NativeWidgetMus(
57 widget, window, ui::mojom::SurfaceType::DEFAULT); 58 widget, window, ui::mojom::SurfaceType::DEFAULT);
58 widget->Init(params); 59 widget->Init(params);
59 widget->Show(); 60 widget->Show();
60 } 61 }
61 62
62 private: 63 private:
63 UI(Login* login, service_manager::Connector* connector) 64 UI(Login* login, service_manager::Connector* connector)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 200 }
200 201
201 } // namespace 202 } // namespace
202 203
203 service_manager::Service* CreateLogin() { 204 service_manager::Service* CreateLogin() {
204 return new Login; 205 return new Login;
205 } 206 }
206 207
207 } // namespace login 208 } // namespace login
208 } // namespace main 209 } // namespace main
OLDNEW
« no previous file with comments | « mash/login/BUILD.gn ('k') | mash/screenlock/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698