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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/i18n/icu_util.h" | 7 #include "base/i18n/icu_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "third_party/skia/include/core/SkXfermode.h" | 10 #include "third_party/skia/include/core/SkXfermode.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #endif | 32 #endif |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 // Trivial WindowDelegate implementation that draws a colored background. | 36 // Trivial WindowDelegate implementation that draws a colored background. |
37 class DemoWindowDelegate : public aura::WindowDelegate { | 37 class DemoWindowDelegate : public aura::WindowDelegate { |
38 public: | 38 public: |
39 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 39 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
40 | 40 |
41 // Overridden from WindowDelegate: | 41 // Overridden from WindowDelegate: |
42 virtual gfx::Size GetMinimumSize() const override { | 42 gfx::Size GetMinimumSize() const override { return gfx::Size(); } |
43 return gfx::Size(); | |
44 } | |
45 | 43 |
46 virtual gfx::Size GetMaximumSize() const override { | 44 gfx::Size GetMaximumSize() const override { return gfx::Size(); } |
47 return gfx::Size(); | |
48 } | |
49 | 45 |
50 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 46 void OnBoundsChanged(const gfx::Rect& old_bounds, |
51 const gfx::Rect& new_bounds) override {} | 47 const gfx::Rect& new_bounds) override {} |
52 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { | 48 gfx::NativeCursor GetCursor(const gfx::Point& point) override { |
53 return gfx::kNullCursor; | 49 return gfx::kNullCursor; |
54 } | 50 } |
55 virtual int GetNonClientComponent(const gfx::Point& point) const override { | 51 int GetNonClientComponent(const gfx::Point& point) const override { |
56 return HTCAPTION; | 52 return HTCAPTION; |
57 } | 53 } |
58 virtual bool ShouldDescendIntoChildForEventHandling( | 54 bool ShouldDescendIntoChildForEventHandling( |
59 aura::Window* child, | 55 aura::Window* child, |
60 const gfx::Point& location) override { | 56 const gfx::Point& location) override { |
61 return true; | 57 return true; |
62 } | 58 } |
63 virtual bool CanFocus() override { return true; } | 59 bool CanFocus() override { return true; } |
64 virtual void OnCaptureLost() override {} | 60 void OnCaptureLost() override {} |
65 virtual void OnPaint(gfx::Canvas* canvas) override { | 61 void OnPaint(gfx::Canvas* canvas) override { |
66 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); | 62 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); |
67 } | 63 } |
68 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} | 64 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
69 virtual void OnWindowDestroying(aura::Window* window) override {} | 65 void OnWindowDestroying(aura::Window* window) override {} |
70 virtual void OnWindowDestroyed(aura::Window* window) override {} | 66 void OnWindowDestroyed(aura::Window* window) override {} |
71 virtual void OnWindowTargetVisibilityChanged(bool visible) override {} | 67 void OnWindowTargetVisibilityChanged(bool visible) override {} |
72 virtual bool HasHitTestMask() const override { return false; } | 68 bool HasHitTestMask() const override { return false; } |
73 virtual void GetHitTestMask(gfx::Path* mask) const override {} | 69 void GetHitTestMask(gfx::Path* mask) const override {} |
74 | 70 |
75 private: | 71 private: |
76 SkColor color_; | 72 SkColor color_; |
77 | 73 |
78 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); |
79 }; | 75 }; |
80 | 76 |
81 class DemoWindowTreeClient : public aura::client::WindowTreeClient { | 77 class DemoWindowTreeClient : public aura::client::WindowTreeClient { |
82 public: | 78 public: |
83 explicit DemoWindowTreeClient(aura::Window* window) : window_(window) { | 79 explicit DemoWindowTreeClient(aura::Window* window) : window_(window) { |
84 aura::client::SetWindowTreeClient(window_, this); | 80 aura::client::SetWindowTreeClient(window_, this); |
85 } | 81 } |
86 | 82 |
87 virtual ~DemoWindowTreeClient() { | 83 ~DemoWindowTreeClient() override { |
88 aura::client::SetWindowTreeClient(window_, NULL); | 84 aura::client::SetWindowTreeClient(window_, NULL); |
89 } | 85 } |
90 | 86 |
91 // Overridden from aura::client::WindowTreeClient: | 87 // Overridden from aura::client::WindowTreeClient: |
92 virtual aura::Window* GetDefaultParent(aura::Window* context, | 88 aura::Window* GetDefaultParent(aura::Window* context, |
93 aura::Window* window, | 89 aura::Window* window, |
94 const gfx::Rect& bounds) override { | 90 const gfx::Rect& bounds) override { |
95 if (!capture_client_) { | 91 if (!capture_client_) { |
96 capture_client_.reset( | 92 capture_client_.reset( |
97 new aura::client::DefaultCaptureClient(window_->GetRootWindow())); | 93 new aura::client::DefaultCaptureClient(window_->GetRootWindow())); |
98 } | 94 } |
99 return window_; | 95 return window_; |
100 } | 96 } |
101 | 97 |
102 private: | 98 private: |
103 aura::Window* window_; | 99 aura::Window* window_; |
104 | 100 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 int main(int argc, char** argv) { | 171 int main(int argc, char** argv) { |
176 CommandLine::Init(argc, argv); | 172 CommandLine::Init(argc, argv); |
177 | 173 |
178 // The exit manager is in charge of calling the dtors of singleton objects. | 174 // The exit manager is in charge of calling the dtors of singleton objects. |
179 base::AtExitManager exit_manager; | 175 base::AtExitManager exit_manager; |
180 | 176 |
181 base::i18n::InitializeICU(); | 177 base::i18n::InitializeICU(); |
182 | 178 |
183 return DemoMain(); | 179 return DemoMain(); |
184 } | 180 } |
OLD | NEW |