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 "aura/desktop.h" | 5 #include "aura/desktop.h" |
6 #include "aura/event.h" | |
7 #include "aura/window.h" | 6 #include "aura/window.h" |
8 #include "aura/window_delegate.h" | 7 #include "aura/window_delegate.h" |
9 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
11 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
12 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
13 #include "third_party/skia/include/core/SkXfermode.h" | 12 #include "third_party/skia/include/core/SkXfermode.h" |
14 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/base/ui_base_paths.h" | 14 #include "ui/base/ui_base_paths.h" |
| 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/canvas_skia.h" | 16 #include "ui/gfx/canvas_skia.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Trivial WindowDelegate implementation that draws a colored background. | 21 // Trivial WindowDelegate implementation that draws a colored background. |
22 class DemoWindowDelegate : public aura::WindowDelegate { | 22 class DemoWindowDelegate : public aura::WindowDelegate { |
23 public: | 23 public: |
24 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 24 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
25 | 25 |
26 virtual bool OnMouseEvent(const aura::MouseEvent& event) OVERRIDE { | |
27 return true; | |
28 } | |
29 | |
30 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 26 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
31 canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode); | 27 canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode); |
32 } | 28 } |
33 | 29 |
34 private: | 30 private: |
35 SkColor color_; | 31 SkColor color_; |
36 | 32 |
37 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); | 33 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); |
38 }; | 34 }; |
39 | 35 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 window3.set_id(3); | 74 window3.set_id(3); |
79 window3.Init(); | 75 window3.Init(); |
80 window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0); | 76 window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0); |
81 window3.SetVisibility(aura::Window::VISIBILITY_SHOWN); | 77 window3.SetVisibility(aura::Window::VISIBILITY_SHOWN); |
82 window3.SetParent(&window2); | 78 window3.SetParent(&window2); |
83 | 79 |
84 aura::Desktop::GetInstance()->Run(); | 80 aura::Desktop::GetInstance()->Run(); |
85 return 0; | 81 return 0; |
86 } | 82 } |
87 | 83 |
OLD | NEW |