OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/chromeos/login/ui/lock_window.h" | |
6 | |
7 #include "ash/public/cpp/shell_window_ids.h" | |
8 #include "ash/shell.h" | |
9 #include "chrome/browser/ui/ash/ash_util.h" | |
10 #include "services/ui/public/cpp/property_type_converters.h" | |
11 #include "services/ui/public/interfaces/window_manager.mojom.h" | |
12 #include "ui/aura/window.h" | |
13 #include "ui/events/gestures/gesture_recognizer.h" | |
14 | |
15 namespace chromeos { | |
16 | |
17 LockWindow::LockWindow() { | |
18 ui::GestureRecognizer::Get()->CancelActiveTouchesExcept(nullptr); | |
19 | |
20 views::Widget::InitParams params( | |
21 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | |
22 params.delegate = this; | |
23 params.show_state = ui::SHOW_STATE_FULLSCREEN; | |
24 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | |
25 const int kLockContainer = ash::kShellWindowId_LockScreenContainer; | |
26 if (ash_util::IsRunningInMash()) { | |
27 using ui::mojom::WindowManager; | |
28 params.mus_properties[WindowManager::kContainerId_InitProperty] = | |
29 mojo::ConvertTo<std::vector<uint8_t>>(kLockContainer); | |
30 } else { | |
31 params.parent = ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | |
32 kLockContainer); | |
33 } | |
34 Init(params); | |
35 SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); | |
36 } | |
37 | |
38 LockWindow::~LockWindow() {} | |
39 | |
40 views::Widget* LockWindow::GetWidget() { | |
41 return this; | |
42 } | |
43 | |
44 const views::Widget* LockWindow::GetWidget() const { | |
45 return this; | |
46 } | |
47 | |
48 views::View* LockWindow::GetInitiallyFocusedView() { | |
49 // There are multiple GetContentsView definitions; use the views::Widget one. | |
50 return views::Widget::GetContentsView(); | |
51 } | |
52 | |
53 } // namespace chromeos | |
OLD | NEW |