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 { Quit(); } |
73 Quit(); | 73 virtual void OnClosed() override {} |
74 } | 74 virtual void OnWindowStateChanged( |
75 virtual void OnClosed() override {} | 75 ui::PlatformWindowState new_state) override {} |
76 virtual void OnWindowStateChanged( | 76 virtual void OnLostCapture() override {} |
77 ui::PlatformWindowState new_state) override {} | 77 virtual void OnAcceleratedWidgetAvailable( |
78 virtual void OnLostCapture() override {} | 78 gfx::AcceleratedWidget widget) override { |
79 virtual void OnAcceleratedWidgetAvailable( | |
80 gfx::AcceleratedWidget widget) override { | |
81 DCHECK_NE(widget, gfx::kNullAcceleratedWidget); | 79 DCHECK_NE(widget, gfx::kNullAcceleratedWidget); |
82 widget_ = widget; | 80 widget_ = widget; |
83 } | 81 } |
84 virtual void OnActivationChanged(bool active) override {} | 82 virtual void OnActivationChanged(bool active) override {} |
85 | 83 |
86 private: | 84 private: |
87 bool InitializeGLSurface() { | 85 bool InitializeGLSurface() { |
88 surface_ = gfx::GLSurface::CreateViewGLSurface(GetAcceleratedWidget()); | 86 surface_ = gfx::GLSurface::CreateViewGLSurface(GetAcceleratedWidget()); |
89 if (!surface_.get()) { | 87 if (!surface_.get()) { |
90 LOG(ERROR) << "Failed to create GL surface"; | 88 LOG(ERROR) << "Failed to create GL surface"; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 DemoWindow* window = new DemoWindow; | 211 DemoWindow* window = new DemoWindow; |
214 window->Start(); | 212 window->Start(); |
215 | 213 |
216 // Run the message loop until there's nothing left to do. | 214 // Run the message loop until there's nothing left to do. |
217 // TODO(spang): Should we use QuitClosure instead? | 215 // TODO(spang): Should we use QuitClosure instead? |
218 base::RunLoop run_loop; | 216 base::RunLoop run_loop; |
219 run_loop.RunUntilIdle(); | 217 run_loop.RunUntilIdle(); |
220 | 218 |
221 return 0; | 219 return 0; |
222 } | 220 } |
OLD | NEW |