Chromium Code Reviews| 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 "components/view_manager/view_manager_app.h" | 5 #include "components/view_manager/view_manager_app.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "components/view_manager/client_connection.h" | 8 #include "components/view_manager/client_connection.h" |
| 9 #include "components/view_manager/connection_manager.h" | 9 #include "components/view_manager/connection_manager.h" |
| 10 #include "components/view_manager/public/cpp/args.h" | 10 #include "components/view_manager/public/cpp/args.h" |
| 11 #include "components/view_manager/view_manager_root_connection.h" | 11 #include "components/view_manager/view_manager_root_connection.h" |
| 12 #include "components/view_manager/view_manager_root_impl.h" | 12 #include "components/view_manager/view_manager_root_impl.h" |
| 13 #include "components/view_manager/view_manager_service_impl.h" | 13 #include "components/view_manager/view_manager_service_impl.h" |
| 14 #include "mojo/application/public/cpp/application_connection.h" | 14 #include "mojo/application/public/cpp/application_connection.h" |
| 15 #include "mojo/application/public/cpp/application_impl.h" | 15 #include "mojo/application/public/cpp/application_impl.h" |
| 16 #include "mojo/application/public/cpp/application_runner.h" | 16 #include "mojo/application/public/cpp/application_runner.h" |
| 17 #include "mojo/common/tracing_impl.h" | 17 #include "mojo/common/tracing_impl.h" |
| 18 #include "third_party/mojo/src/mojo/public/c/system/main.h" | 18 #include "third_party/mojo/src/mojo/public/c/system/main.h" |
| 19 #include "ui/events/event_switches.h" | 19 #include "ui/events/event_switches.h" |
| 20 #include "ui/events/platform/platform_event_source.h" | 20 #include "ui/events/platform/platform_event_source.h" |
| 21 #include "ui/gl/gl_surface.h" | 21 #include "ui/gl/gl_surface.h" |
| 22 | 22 |
| 23 #if defined(USE_X11) | |
| 24 #include "ui/platform_window/x11/x11_window.h" | |
| 25 #endif | |
| 26 | |
| 23 using mojo::ApplicationConnection; | 27 using mojo::ApplicationConnection; |
| 24 using mojo::ApplicationImpl; | 28 using mojo::ApplicationImpl; |
| 25 using mojo::Gpu; | 29 using mojo::Gpu; |
| 26 using mojo::InterfaceRequest; | 30 using mojo::InterfaceRequest; |
| 27 using mojo::ViewManagerRoot; | 31 using mojo::ViewManagerRoot; |
| 28 using mojo::ViewManagerService; | 32 using mojo::ViewManagerService; |
| 29 | 33 |
| 30 namespace view_manager { | 34 namespace view_manager { |
| 31 | 35 |
| 32 ViewManagerApp::ViewManagerApp() : app_impl_(nullptr), is_headless_(false) { | 36 ViewManagerApp::ViewManagerApp() : app_impl_(nullptr), is_headless_(false) { |
| 33 } | 37 } |
| 34 | 38 |
| 35 ViewManagerApp::~ViewManagerApp() {} | 39 ViewManagerApp::~ViewManagerApp() {} |
| 36 | 40 |
| 37 void ViewManagerApp::Initialize(ApplicationImpl* app) { | 41 void ViewManagerApp::Initialize(ApplicationImpl* app) { |
| 38 app_impl_ = app; | 42 app_impl_ = app; |
| 39 tracing_.Initialize(app); | 43 tracing_.Initialize(app); |
| 40 | 44 |
| 41 #if !defined(OS_ANDROID) | 45 #if !defined(OS_ANDROID) |
| 42 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 46 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 43 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); | 47 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); |
| 44 if (!is_headless_) { | 48 if (!is_headless_) { |
| 45 event_source_ = ui::PlatformEventSource::CreateDefault(); | 49 event_source_ = ui::PlatformEventSource::CreateDefault(); |
| 46 if (command_line->HasSwitch(mojo::kUseTestConfig)) | 50 bool test_config = command_line->HasSwitch(mojo::kUseTestConfig); |
| 51 if (test_config) | |
| 47 gfx::GLSurface::InitializeOneOffForTests(); | 52 gfx::GLSurface::InitializeOneOffForTests(); |
| 48 else | 53 else |
| 49 gfx::GLSurface::InitializeOneOff(); | 54 gfx::GLSurface::InitializeOneOff(); |
| 55 | |
| 56 #if defined(USE_X11) | |
| 57 if (test_config) | |
| 58 ui::test::SetUseOverrideRedirectWindowByDefault(true); | |
|
msw
2015/07/16 19:17:50
Should this be part of gfx::GLSurface::InitializeO
sadrul
2015/07/16 19:57:14
Hm, good point. Done.
| |
| 59 #endif | |
| 50 } | 60 } |
| 51 #endif | 61 #endif |
| 52 | 62 |
| 53 if (!gpu_state_.get()) | 63 if (!gpu_state_.get()) |
| 54 gpu_state_ = new gles2::GpuState; | 64 gpu_state_ = new gles2::GpuState; |
| 55 connection_manager_.reset(new ConnectionManager(this)); | 65 connection_manager_.reset(new ConnectionManager(this)); |
| 56 } | 66 } |
| 57 | 67 |
| 58 bool ViewManagerApp::ConfigureIncomingConnection( | 68 bool ViewManagerApp::ConfigureIncomingConnection( |
| 59 ApplicationConnection* connection) { | 69 ApplicationConnection* connection) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 | 124 |
| 115 void ViewManagerApp::Create( | 125 void ViewManagerApp::Create( |
| 116 mojo::ApplicationConnection* connection, | 126 mojo::ApplicationConnection* connection, |
| 117 mojo::InterfaceRequest<Gpu> request) { | 127 mojo::InterfaceRequest<Gpu> request) { |
| 118 if (!gpu_state_.get()) | 128 if (!gpu_state_.get()) |
| 119 gpu_state_ = new gles2::GpuState; | 129 gpu_state_ = new gles2::GpuState; |
| 120 new gles2::GpuImpl(request.Pass(), gpu_state_); | 130 new gles2::GpuImpl(request.Pass(), gpu_state_); |
| 121 } | 131 } |
| 122 | 132 |
| 123 } // namespace view_manager | 133 } // namespace view_manager |
| OLD | NEW |