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 "ui/aura/test/test_window_delegate.h" | 5 #include "ui/aura/test/test_window_delegate.h" |
6 | 6 |
7 #include "ui/aura/event.h" | 7 #include "ui/aura/event.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/base/hit_test.h" | 9 #include "ui/base/hit_test.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| 11 #include "ui/gfx/path.h" |
| 12 #include "ui/gfx/skia_util.h" |
11 | 13 |
12 namespace aura { | 14 namespace aura { |
13 namespace test { | 15 namespace test { |
14 | 16 |
15 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
16 // TestWindowDelegate | 18 // TestWindowDelegate |
17 | 19 |
18 TestWindowDelegate::TestWindowDelegate() : window_component_(HTCLIENT) { | 20 TestWindowDelegate::TestWindowDelegate() : window_component_(HTCLIENT) { |
19 } | 21 } |
20 | 22 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 77 |
76 void TestWindowDelegate::OnWindowDestroying() { | 78 void TestWindowDelegate::OnWindowDestroying() { |
77 } | 79 } |
78 | 80 |
79 void TestWindowDelegate::OnWindowDestroyed() { | 81 void TestWindowDelegate::OnWindowDestroyed() { |
80 } | 82 } |
81 | 83 |
82 void TestWindowDelegate::OnWindowVisibilityChanged(bool visible) { | 84 void TestWindowDelegate::OnWindowVisibilityChanged(bool visible) { |
83 } | 85 } |
84 | 86 |
| 87 bool TestWindowDelegate::HasHitTestMask() const { |
| 88 return false; |
| 89 } |
| 90 |
| 91 void TestWindowDelegate::GetHitTestMask(gfx::Path* mask) const { |
| 92 } |
85 | 93 |
86 //////////////////////////////////////////////////////////////////////////////// | 94 //////////////////////////////////////////////////////////////////////////////// |
87 // ColorTestWindowDelegate | 95 // ColorTestWindowDelegate |
88 | 96 |
89 ColorTestWindowDelegate::ColorTestWindowDelegate(SkColor color) | 97 ColorTestWindowDelegate::ColorTestWindowDelegate(SkColor color) |
90 : color_(color), | 98 : color_(color), |
91 last_key_code_(ui::VKEY_UNKNOWN) { | 99 last_key_code_(ui::VKEY_UNKNOWN) { |
92 } | 100 } |
93 ColorTestWindowDelegate::~ColorTestWindowDelegate() { | 101 ColorTestWindowDelegate::~ColorTestWindowDelegate() { |
94 } | 102 } |
95 | 103 |
96 bool ColorTestWindowDelegate::OnKeyEvent(KeyEvent* event) { | 104 bool ColorTestWindowDelegate::OnKeyEvent(KeyEvent* event) { |
97 last_key_code_ = event->key_code(); | 105 last_key_code_ = event->key_code(); |
98 return true; | 106 return true; |
99 } | 107 } |
100 void ColorTestWindowDelegate::OnWindowDestroyed() { | 108 void ColorTestWindowDelegate::OnWindowDestroyed() { |
101 delete this; | 109 delete this; |
102 } | 110 } |
103 void ColorTestWindowDelegate::OnPaint(gfx::Canvas* canvas) { | 111 void ColorTestWindowDelegate::OnPaint(gfx::Canvas* canvas) { |
104 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); | 112 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); |
105 } | 113 } |
106 | 114 |
| 115 //////////////////////////////////////////////////////////////////////////////// |
| 116 // MaskedWindowDelegate |
| 117 |
| 118 MaskedWindowDelegate::MaskedWindowDelegate(const gfx::Rect mask_rect) |
| 119 : mask_rect_(mask_rect) { |
| 120 } |
| 121 |
| 122 bool MaskedWindowDelegate::HasHitTestMask() const { |
| 123 return true; |
| 124 } |
| 125 |
| 126 void MaskedWindowDelegate::GetHitTestMask(gfx::Path* mask) const { |
| 127 mask->addRect(RectToSkRect(mask_rect_)); |
| 128 } |
| 129 |
107 } // namespace test | 130 } // namespace test |
108 } // namespace aura | 131 } // namespace aura |
OLD | NEW |