1// Copyright (c) 2012 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/lock_window_aura.h"
6
7#include "ash/shell.h"
8#include "ash/shell_window_ids.h"
9#include "ash/wm/window_animations.h"
10#include "base/command_line.h"
11#include "ui/aura/root_window.h"
12#include "ui/aura/window.h"
13
14namespace chromeos {
15
16LockWindow* LockWindow::Create() {
17  return new LockWindowAura();
18}
19
20////////////////////////////////////////////////////////////////////////////////
21// LockWindow implementation:
22void LockWindowAura::Grab() {
23  // We already have grab from the lock screen container, just call the ready
24  // callback immediately.
25  if (observer_)
26    observer_->OnLockWindowReady();
27}
28
29views::Widget* LockWindowAura::GetWidget() {
30  return this;
31}
32
33////////////////////////////////////////////////////////////////////////////////
34// LockWindowAura private:
35LockWindowAura::LockWindowAura() {
36  Init();
37}
38
39LockWindowAura::~LockWindowAura() {
40}
41
42void LockWindowAura::Init() {
43  views::Widget::InitParams params(
44      views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
45  params.show_state = ui::SHOW_STATE_FULLSCREEN;
46  params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
47  // TODO(oshima): move the lock screen harness to ash.
48  params.parent =
49      ash::Shell::GetContainer(
50          ash::Shell::GetPrimaryRootWindow(),
51          ash::internal::kShellWindowId_LockScreenContainer);
52  views::Widget::Init(params);
53  views::corewm::SetWindowVisibilityAnimationTransition(
54      GetNativeView(), views::corewm::ANIMATE_NONE);
55}
56
57}  // namespace chromeos
58