OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/native_viewport/native_viewport_application_delegate.h" | 5 #include "components/native_viewport/native_viewport_application_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "components/native_viewport/native_viewport_impl.h" | 8 #include "components/native_viewport/native_viewport_impl.h" |
9 #include "components/native_viewport/public/cpp/args.h" | 9 #include "components/native_viewport/public/cpp/args.h" |
10 #include "mojo/application/public/cpp/application_connection.h" | 10 #include "mojo/application/public/cpp/application_connection.h" |
11 #include "mojo/application/public/cpp/application_impl.h" | 11 #include "mojo/application/public/cpp/application_impl.h" |
12 #include "ui/events/event_switches.h" | 12 #include "ui/events/event_switches.h" |
| 13 #include "ui/events/platform/platform_event_source.h" |
13 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
14 | 15 |
15 namespace native_viewport { | 16 namespace native_viewport { |
16 | 17 |
17 NativeViewportApplicationDelegate::NativeViewportApplicationDelegate() | 18 NativeViewportApplicationDelegate::NativeViewportApplicationDelegate() |
18 : is_headless_(false) { | 19 : is_headless_(false) { |
19 } | 20 } |
20 | 21 |
21 NativeViewportApplicationDelegate::~NativeViewportApplicationDelegate() { | 22 NativeViewportApplicationDelegate::~NativeViewportApplicationDelegate() { |
22 } | 23 } |
23 | 24 |
24 void NativeViewportApplicationDelegate::Initialize( | 25 void NativeViewportApplicationDelegate::Initialize( |
25 mojo::ApplicationImpl* application) { | 26 mojo::ApplicationImpl* application) { |
| 27 event_source_ = ui::PlatformEventSource::CreateDefault(); |
26 tracing_.Initialize(application); | 28 tracing_.Initialize(application); |
27 | 29 |
28 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 30 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
29 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); | 31 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); |
30 if (!is_headless_) { | 32 if (!is_headless_) { |
31 if (command_line->HasSwitch(mojo::kUseTestConfig)) | 33 if (command_line->HasSwitch(mojo::kUseTestConfig)) |
32 gfx::GLSurface::InitializeOneOffForTests(); | 34 gfx::GLSurface::InitializeOneOffForTests(); |
33 else | 35 else |
34 gfx::GLSurface::InitializeOneOff(); | 36 gfx::GLSurface::InitializeOneOff(); |
35 } | 37 } |
(...skipping 16 matching lines...) Expand all Loading... |
52 | 54 |
53 void NativeViewportApplicationDelegate::Create( | 55 void NativeViewportApplicationDelegate::Create( |
54 mojo::ApplicationConnection* connection, | 56 mojo::ApplicationConnection* connection, |
55 mojo::InterfaceRequest<mojo::Gpu> request) { | 57 mojo::InterfaceRequest<mojo::Gpu> request) { |
56 if (!gpu_state_.get()) | 58 if (!gpu_state_.get()) |
57 gpu_state_ = new gles2::GpuState; | 59 gpu_state_ = new gles2::GpuState; |
58 new gles2::GpuImpl(request.Pass(), gpu_state_); | 60 new gles2::GpuImpl(request.Pass(), gpu_state_); |
59 } | 61 } |
60 | 62 |
61 } // namespace native_viewport | 63 } // namespace native_viewport |
OLD | NEW |