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