OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 void Quit() { | 62 void Quit() { |
63 StopAnimation(); | 63 StopAnimation(); |
64 base::MessageLoop::current()->PostTask( | 64 base::MessageLoop::current()->PostTask( |
65 FROM_HERE, base::Bind(&base::DeletePointer<DemoWindow>, this)); | 65 FROM_HERE, base::Bind(&base::DeletePointer<DemoWindow>, this)); |
66 } | 66 } |
67 | 67 |
68 // PlatformWindowDelegate: | 68 // PlatformWindowDelegate: |
69 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE {} | 69 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) override {} |
70 virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE {} | 70 virtual void OnDamageRect(const gfx::Rect& damaged_region) override {} |
71 virtual void DispatchEvent(ui::Event* event) OVERRIDE {} | 71 virtual void DispatchEvent(ui::Event* event) override {} |
72 virtual void OnCloseRequest() OVERRIDE { | 72 virtual void OnCloseRequest() override { |
73 Quit(); | 73 Quit(); |
74 } | 74 } |
75 virtual void OnClosed() OVERRIDE {} | 75 virtual void OnClosed() override {} |
76 virtual void OnWindowStateChanged( | 76 virtual void OnWindowStateChanged( |
77 ui::PlatformWindowState new_state) OVERRIDE {} | 77 ui::PlatformWindowState new_state) override {} |
78 virtual void OnLostCapture() OVERRIDE {} | 78 virtual void OnLostCapture() override {} |
79 virtual void OnAcceleratedWidgetAvailable( | 79 virtual void OnAcceleratedWidgetAvailable( |
80 gfx::AcceleratedWidget widget) OVERRIDE { | 80 gfx::AcceleratedWidget widget) override { |
81 DCHECK_NE(widget, gfx::kNullAcceleratedWidget); | 81 DCHECK_NE(widget, gfx::kNullAcceleratedWidget); |
82 widget_ = widget; | 82 widget_ = widget; |
83 } | 83 } |
84 virtual void OnActivationChanged(bool active) OVERRIDE {} | 84 virtual void OnActivationChanged(bool active) override {} |
85 | 85 |
86 private: | 86 private: |
87 bool InitializeGLSurface() { | 87 bool InitializeGLSurface() { |
88 surface_ = gfx::GLSurface::CreateViewGLSurface(GetAcceleratedWidget()); | 88 surface_ = gfx::GLSurface::CreateViewGLSurface(GetAcceleratedWidget()); |
89 if (!surface_.get()) { | 89 if (!surface_.get()) { |
90 LOG(ERROR) << "Failed to create GL surface"; | 90 LOG(ERROR) << "Failed to create GL surface"; |
91 return false; | 91 return false; |
92 } | 92 } |
93 | 93 |
94 context_ = gfx::GLContext::CreateGLContext( | 94 context_ = gfx::GLContext::CreateGLContext( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 DemoWindow* window = new DemoWindow; | 213 DemoWindow* window = new DemoWindow; |
214 window->Start(); | 214 window->Start(); |
215 | 215 |
216 // Run the message loop until there's nothing left to do. | 216 // Run the message loop until there's nothing left to do. |
217 // TODO(spang): Should we use QuitClosure instead? | 217 // TODO(spang): Should we use QuitClosure instead? |
218 base::RunLoop run_loop; | 218 base::RunLoop run_loop; |
219 run_loop.RunUntilIdle(); | 219 run_loop.RunUntilIdle(); |
220 | 220 |
221 return 0; | 221 return 0; |
222 } | 222 } |
OLD | NEW |