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/events/platform/platform_event_source.h" |
14 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
15 | 15 |
16 namespace native_viewport { | 16 namespace native_viewport { |
17 | 17 |
18 NativeViewportApplicationDelegate::NativeViewportApplicationDelegate() | 18 NativeViewportApplicationDelegate::NativeViewportApplicationDelegate() |
19 : is_headless_(false) { | 19 : is_headless_(false) { |
20 } | 20 } |
21 | 21 |
22 NativeViewportApplicationDelegate::~NativeViewportApplicationDelegate() { | 22 NativeViewportApplicationDelegate::~NativeViewportApplicationDelegate() { |
23 } | 23 } |
24 | 24 |
25 void NativeViewportApplicationDelegate::Initialize( | 25 void NativeViewportApplicationDelegate::Initialize( |
26 mojo::ApplicationImpl* application) { | 26 mojo::ApplicationImpl* application) { |
27 event_source_ = ui::PlatformEventSource::CreateDefault(); | |
28 tracing_.Initialize(application); | 27 tracing_.Initialize(application); |
29 | 28 |
30 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
31 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); | 30 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); |
32 if (!is_headless_) { | 31 if (!is_headless_) { |
| 32 event_source_ = ui::PlatformEventSource::CreateDefault(); |
33 if (command_line->HasSwitch(mojo::kUseTestConfig)) | 33 if (command_line->HasSwitch(mojo::kUseTestConfig)) |
34 gfx::GLSurface::InitializeOneOffForTests(); | 34 gfx::GLSurface::InitializeOneOffForTests(); |
35 else | 35 else |
36 gfx::GLSurface::InitializeOneOff(); | 36 gfx::GLSurface::InitializeOneOff(); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 bool NativeViewportApplicationDelegate::ConfigureIncomingConnection( | 40 bool NativeViewportApplicationDelegate::ConfigureIncomingConnection( |
41 mojo::ApplicationConnection* connection) { | 41 mojo::ApplicationConnection* connection) { |
42 connection->AddService<mojo::NativeViewport>(this); | 42 connection->AddService<mojo::NativeViewport>(this); |
(...skipping 11 matching lines...) Expand all Loading... |
54 | 54 |
55 void NativeViewportApplicationDelegate::Create( | 55 void NativeViewportApplicationDelegate::Create( |
56 mojo::ApplicationConnection* connection, | 56 mojo::ApplicationConnection* connection, |
57 mojo::InterfaceRequest<mojo::Gpu> request) { | 57 mojo::InterfaceRequest<mojo::Gpu> request) { |
58 if (!gpu_state_.get()) | 58 if (!gpu_state_.get()) |
59 gpu_state_ = new gles2::GpuState; | 59 gpu_state_ = new gles2::GpuState; |
60 new gles2::GpuImpl(request.Pass(), gpu_state_); | 60 new gles2::GpuImpl(request.Pass(), gpu_state_); |
61 } | 61 } |
62 | 62 |
63 } // namespace native_viewport | 63 } // namespace native_viewport |
OLD | NEW |