Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: ui/aura_shell/examples/lock_view.cc

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/font.h" 12 #include "ui/gfx/font.h"
13 #include "views/widget/widget.h" 13 #include "views/widget/widget.h"
14 #include "views/widget/widget_delegate.h" 14 #include "views/widget/widget_delegate.h"
15 15
16 namespace aura_shell { 16 namespace aura_shell {
17 namespace examples { 17 namespace examples {
18 18
19 class LockView : public views::WidgetDelegateView { 19 class LockView : public views::WidgetDelegateView {
20 public: 20 public:
21 LockView() { 21 LockView() {}
22 }
23 virtual ~LockView() {} 22 virtual ~LockView() {}
24 23
25 // Overridden from View: 24 // Overridden from View:
26 virtual gfx::Size GetPreferredSize() OVERRIDE { 25 virtual gfx::Size GetPreferredSize() OVERRIDE {
27 return gfx::Size(500, 400); 26 return gfx::Size(500, 400);
28 } 27 }
29 28
30 private: 29 private:
31 // Overridden from View: 30 // Overridden from View:
32 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 31 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
33 canvas->FillRectInt(SK_ColorYELLOW, 0, 0, width(), height()); 32 canvas->FillRect(SK_ColorYELLOW, GetLocalBounds());
34 string16 text = ASCIIToUTF16("LOCKED!"); 33 string16 text = ASCIIToUTF16("LOCKED!");
35 int string_width = font_.GetStringWidth(text); 34 int string_width = font_.GetStringWidth(text);
36 canvas->DrawStringInt(text, font_, SK_ColorRED, (width() - string_width)/ 2, 35 canvas->DrawStringInt(text, font_, SK_ColorRED, (width() - string_width)/ 2,
37 (height() - font_.GetHeight()) / 2, 36 (height() - font_.GetHeight()) / 2,
38 string_width, font_.GetHeight()); 37 string_width, font_.GetHeight());
39 } 38 }
40 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE { 39 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE {
41 return true; 40 return true;
42 } 41 }
43 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { 42 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE {
(...skipping 19 matching lines...) Expand all
63 params.parent = Shell::GetInstance()->GetContainer( 62 params.parent = Shell::GetInstance()->GetContainer(
64 aura_shell::internal::kShellWindowId_LockScreenContainer); 63 aura_shell::internal::kShellWindowId_LockScreenContainer);
65 widget->Init(params); 64 widget->Init(params);
66 widget->SetContentsView(lock_view); 65 widget->SetContentsView(lock_view);
67 widget->Show(); 66 widget->Show();
68 widget->GetNativeView()->set_name("LockView"); 67 widget->GetNativeView()->set_name("LockView");
69 } 68 }
70 69
71 } // namespace examples 70 } // namespace examples
72 } // namespace aura_shell 71 } // namespace aura_shell
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | ui/aura_shell/examples/toplevel_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698