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