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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/shell_window_ids.h" | 6 #include "ash/shell_window_ids.h" |
7 #include "ash/shell/example_factory.h" | 7 #include "ash/shell/example_factory.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 virtual ~LockView() {} | 24 virtual ~LockView() {} |
25 | 25 |
26 // Overridden from View: | 26 // Overridden from View: |
27 virtual gfx::Size GetPreferredSize() OVERRIDE { | 27 virtual gfx::Size GetPreferredSize() OVERRIDE { |
28 return gfx::Size(500, 400); | 28 return gfx::Size(500, 400); |
29 } | 29 } |
30 | 30 |
31 private: | 31 private: |
32 // Overridden from View: | 32 // Overridden from View: |
33 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 33 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
34 canvas->FillRect(SK_ColorYELLOW, GetLocalBounds()); | 34 canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW); |
35 string16 text = ASCIIToUTF16("LOCKED!"); | 35 string16 text = ASCIIToUTF16("LOCKED!"); |
36 int string_width = font_.GetStringWidth(text); | 36 int string_width = font_.GetStringWidth(text); |
37 canvas->DrawStringInt(text, font_, SK_ColorRED, (width() - string_width)/ 2, | 37 canvas->DrawStringInt(text, font_, SK_ColorRED, (width() - string_width)/ 2, |
38 (height() - font_.GetHeight()) / 2, | 38 (height() - font_.GetHeight()) / 2, |
39 string_width, font_.GetHeight()); | 39 string_width, font_.GetHeight()); |
40 } | 40 } |
41 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE { | 41 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE { |
42 return true; | 42 return true; |
43 } | 43 } |
44 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { | 44 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { |
(...skipping 20 matching lines...) Expand all Loading... |
65 Shell::GetInstance()->GetContainer( | 65 Shell::GetInstance()->GetContainer( |
66 ash::internal::kShellWindowId_LockScreenContainer)-> | 66 ash::internal::kShellWindowId_LockScreenContainer)-> |
67 AddChild(widget->GetNativeView()); | 67 AddChild(widget->GetNativeView()); |
68 widget->SetContentsView(lock_view); | 68 widget->SetContentsView(lock_view); |
69 widget->Show(); | 69 widget->Show(); |
70 widget->GetNativeView()->SetName("LockView"); | 70 widget->GetNativeView()->SetName("LockView"); |
71 } | 71 } |
72 | 72 |
73 } // namespace shell | 73 } // namespace shell |
74 } // namespace ash | 74 } // namespace ash |
OLD | NEW |