OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "ui/aura/desktop.h" | 6 #include "ui/aura/desktop.h" |
7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
8 #include "ui/aura_shell/examples/example_factory.h" | 8 #include "ui/aura_shell/examples/example_factory.h" |
9 #include "ui/aura_shell/shell.h" | 9 #include "ui/aura_shell/shell.h" |
10 #include "ui/aura_shell/shell_window_ids.h" | 10 #include "ui/aura_shell/shell_window_ids.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { | 42 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { |
43 GetWidget()->Close(); | 43 GetWidget()->Close(); |
44 } | 44 } |
45 | 45 |
46 gfx::Font font_; | 46 gfx::Font font_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(LockView); | 48 DISALLOW_COPY_AND_ASSIGN(LockView); |
49 }; | 49 }; |
50 | 50 |
51 void CreateLock() { | 51 void CreateLockScreen() { |
52 LockView* lock_view = new LockView; | 52 LockView* lock_view = new LockView; |
53 views::Widget* widget = new views::Widget; | 53 views::Widget* widget = new views::Widget; |
54 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 54 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
55 gfx::Size ps = lock_view->GetPreferredSize(); | 55 gfx::Size ps = lock_view->GetPreferredSize(); |
56 | 56 |
57 gfx::Size desktop_size = aura::Desktop::GetInstance()->GetHostSize(); | 57 gfx::Size desktop_size = aura::Desktop::GetInstance()->GetHostSize(); |
58 params.bounds = gfx::Rect((desktop_size.width() - ps.width()) / 2, | 58 params.bounds = gfx::Rect((desktop_size.width() - ps.width()) / 2, |
59 (desktop_size.height() - ps.height()) / 2, | 59 (desktop_size.height() - ps.height()) / 2, |
60 ps.width(), ps.height()); | 60 ps.width(), ps.height()); |
61 params.delegate = lock_view; | 61 params.delegate = lock_view; |
62 widget->Init(params); | 62 widget->Init(params); |
63 Shell::GetInstance()->GetContainer( | 63 Shell::GetInstance()->GetContainer( |
64 aura_shell::internal::kShellWindowId_LockScreenContainer)-> | 64 aura_shell::internal::kShellWindowId_LockScreenContainer)-> |
65 AddChild(widget->GetNativeView()); | 65 AddChild(widget->GetNativeView()); |
66 widget->SetContentsView(lock_view); | 66 widget->SetContentsView(lock_view); |
67 widget->Show(); | 67 widget->Show(); |
68 widget->GetNativeView()->set_name("LockView"); | 68 widget->GetNativeView()->set_name("LockView"); |
69 } | 69 } |
70 | 70 |
71 } // namespace examples | 71 } // namespace examples |
72 } // namespace aura_shell | 72 } // namespace aura_shell |
OLD | NEW |