| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "ash/shell_delegate.h" | 6 #include "ash/shell_delegate.h" |
| 7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
| 8 #include "ash/shell/example_factory.h" | 8 #include "ash/shell/example_factory.h" |
| 9 #include "ash/tooltips/tooltip_controller.h" | 9 #include "ash/tooltips/tooltip_controller.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 DISALLOW_COPY_AND_ASSIGN(LockView); | 79 DISALLOW_COPY_AND_ASSIGN(LockView); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 void CreateLockScreen() { | 82 void CreateLockScreen() { |
| 83 LockView* lock_view = new LockView; | 83 LockView* lock_view = new LockView; |
| 84 views::Widget* widget = new views::Widget; | 84 views::Widget* widget = new views::Widget; |
| 85 views::Widget::InitParams params( | 85 views::Widget::InitParams params( |
| 86 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 86 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 87 gfx::Size ps = lock_view->GetPreferredSize(); | 87 gfx::Size ps = lock_view->GetPreferredSize(); |
| 88 | 88 |
| 89 gfx::Size root_window_size = Shell::GetRootWindow()->bounds().size(); | 89 gfx::Size root_window_size = Shell::GetPrimaryRootWindow()->bounds().size(); |
| 90 params.bounds = gfx::Rect((root_window_size.width() - ps.width()) / 2, | 90 params.bounds = gfx::Rect((root_window_size.width() - ps.width()) / 2, |
| 91 (root_window_size.height() - ps.height()) / 2, | 91 (root_window_size.height() - ps.height()) / 2, |
| 92 ps.width(), ps.height()); | 92 ps.width(), ps.height()); |
| 93 params.delegate = lock_view; | 93 params.delegate = lock_view; |
| 94 params.parent = | 94 params.parent = |
| 95 Shell::GetInstance()->GetContainer( | 95 Shell::GetInstance()->GetContainer( |
| 96 ash::internal::kShellWindowId_LockScreenContainer); | 96 ash::internal::kShellWindowId_LockScreenContainer); |
| 97 widget->Init(params); | 97 widget->Init(params); |
| 98 widget->SetContentsView(lock_view); | 98 widget->SetContentsView(lock_view); |
| 99 widget->Show(); | 99 widget->Show(); |
| 100 widget->GetNativeView()->SetName("LockView"); | 100 widget->GetNativeView()->SetName("LockView"); |
| 101 widget->GetNativeView()->Focus(); | 101 widget->GetNativeView()->Focus(); |
| 102 | 102 |
| 103 Shell::GetInstance()->tooltip_controller()->UpdateTooltip( | 103 Shell::GetInstance()->tooltip_controller()->UpdateTooltip( |
| 104 widget->GetNativeView()); | 104 widget->GetNativeView()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace shell | 107 } // namespace shell |
| 108 } // namespace ash | 108 } // namespace ash |
| OLD | NEW |