Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: components/native_viewport/native_viewport_application_delegate.cc

Issue 1131523007: Move NativeViewport service into view_manager. This is a file move only. Further merging will happe… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/native_viewport/native_viewport_application_delegate.h"
6
7 #include "base/command_line.h"
8 #include "components/native_viewport/native_viewport_impl.h"
9 #include "components/native_viewport/public/cpp/args.h"
10 #include "mojo/application/public/cpp/application_connection.h"
11 #include "mojo/application/public/cpp/application_impl.h"
12 #include "ui/events/event_switches.h"
13 #include "ui/events/platform/platform_event_source.h"
14 #include "ui/gl/gl_surface.h"
15
16 namespace native_viewport {
17
18 NativeViewportApplicationDelegate::NativeViewportApplicationDelegate()
19 : is_headless_(false) {
20 }
21
22 NativeViewportApplicationDelegate::~NativeViewportApplicationDelegate() {
23 }
24
25 void NativeViewportApplicationDelegate::Initialize(
26 mojo::ApplicationImpl* application) {
27 tracing_.Initialize(application);
28
29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
30 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig);
31 if (!is_headless_) {
32 event_source_ = ui::PlatformEventSource::CreateDefault();
33 if (command_line->HasSwitch(mojo::kUseTestConfig))
34 gfx::GLSurface::InitializeOneOffForTests();
35 else
36 gfx::GLSurface::InitializeOneOff();
37 }
38 }
39
40 bool NativeViewportApplicationDelegate::ConfigureIncomingConnection(
41 mojo::ApplicationConnection* connection) {
42 connection->AddService<mojo::NativeViewport>(this);
43 connection->AddService<mojo::Gpu>(this);
44 return true;
45 }
46
47 void NativeViewportApplicationDelegate::Create(
48 mojo::ApplicationConnection* connection,
49 mojo::InterfaceRequest<mojo::NativeViewport> request) {
50 if (!gpu_state_.get())
51 gpu_state_ = new gles2::GpuState;
52 new NativeViewportImpl(is_headless_, gpu_state_, request.Pass(),
53 app_lifetime_helper_.CreateAppRefCount());
54 }
55
56 void NativeViewportApplicationDelegate::Create(
57 mojo::ApplicationConnection* connection,
58 mojo::InterfaceRequest<mojo::Gpu> request) {
59 if (!gpu_state_.get())
60 gpu_state_ = new gles2::GpuState;
61 new gles2::GpuImpl(request.Pass(), gpu_state_);
62 }
63
64 } // namespace native_viewport
OLDNEW
« no previous file with comments | « components/native_viewport/native_viewport_application_delegate.h ('k') | components/native_viewport/native_viewport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698