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

Side by Side Diff: components/view_manager/view_manager_app.cc

Issue 1314953002: Rename ViewManagerService,ViewManagerClient -> ViewTree,ViewTreeClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 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
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 "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "components/view_manager/client_connection.h" 9 #include "components/view_manager/client_connection.h"
10 #include "components/view_manager/connection_manager.h" 10 #include "components/view_manager/connection_manager.h"
11 #include "components/view_manager/gles2/gpu_impl.h" 11 #include "components/view_manager/gles2/gpu_impl.h"
12 #include "components/view_manager/public/cpp/args.h" 12 #include "components/view_manager/public/cpp/args.h"
13 #include "components/view_manager/surfaces/surfaces_impl.h" 13 #include "components/view_manager/surfaces/surfaces_impl.h"
14 #include "components/view_manager/surfaces/surfaces_scheduler.h" 14 #include "components/view_manager/surfaces/surfaces_scheduler.h"
15 #include "components/view_manager/view_manager_root_connection.h" 15 #include "components/view_manager/view_manager_root_connection.h"
16 #include "components/view_manager/view_manager_root_impl.h" 16 #include "components/view_manager/view_manager_root_impl.h"
17 #include "components/view_manager/view_manager_service_impl.h" 17 #include "components/view_manager/view_tree_impl.h"
18 #include "mojo/application/public/cpp/application_connection.h" 18 #include "mojo/application/public/cpp/application_connection.h"
19 #include "mojo/application/public/cpp/application_impl.h" 19 #include "mojo/application/public/cpp/application_impl.h"
20 #include "mojo/application/public/cpp/application_runner.h" 20 #include "mojo/application/public/cpp/application_runner.h"
21 #include "mojo/common/tracing_impl.h" 21 #include "mojo/common/tracing_impl.h"
22 #include "third_party/mojo/src/mojo/public/c/system/main.h" 22 #include "third_party/mojo/src/mojo/public/c/system/main.h"
23 #include "ui/events/event_switches.h" 23 #include "ui/events/event_switches.h"
24 #include "ui/events/platform/platform_event_source.h" 24 #include "ui/events/platform/platform_event_source.h"
25 #include "ui/gl/gl_surface.h" 25 #include "ui/gl/gl_surface.h"
26 #include "ui/gl/test/gl_surface_test_support.h" 26 #include "ui/gl/test/gl_surface_test_support.h"
27 27
28 using mojo::ApplicationConnection; 28 using mojo::ApplicationConnection;
29 using mojo::ApplicationImpl; 29 using mojo::ApplicationImpl;
30 using mojo::Gpu; 30 using mojo::Gpu;
31 using mojo::InterfaceRequest; 31 using mojo::InterfaceRequest;
32 using mojo::ViewManagerRoot; 32 using mojo::ViewManagerRoot;
33 using mojo::ViewManagerService;
34 33
35 namespace view_manager { 34 namespace view_manager {
36 35
37 ViewManagerApp::ViewManagerApp() 36 ViewManagerApp::ViewManagerApp()
38 : app_impl_(nullptr), 37 : app_impl_(nullptr),
39 is_headless_(false) { 38 is_headless_(false) {
40 } 39 }
41 40
42 ViewManagerApp::~ViewManagerApp() { 41 ViewManagerApp::~ViewManagerApp() {
43 if (gpu_state_) 42 if (gpu_state_)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 connection->AddService<Gpu>(this); 80 connection->AddService<Gpu>(this);
82 return true; 81 return true;
83 } 82 }
84 83
85 void ViewManagerApp::OnNoMoreRootConnections() { 84 void ViewManagerApp::OnNoMoreRootConnections() {
86 app_impl_->Quit(); 85 app_impl_->Quit();
87 } 86 }
88 87
89 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( 88 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView(
90 ConnectionManager* connection_manager, 89 ConnectionManager* connection_manager,
91 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, 90 mojo::InterfaceRequest<mojo::ViewTree> tree_request,
92 mojo::ConnectionSpecificId creator_id, 91 mojo::ConnectionSpecificId creator_id,
93 mojo::URLRequestPtr request, 92 mojo::URLRequestPtr request,
94 const ViewId& root_id) { 93 const ViewId& root_id) {
95 mojo::ViewManagerClientPtr client; 94 mojo::ViewTreeClientPtr client;
96 app_impl_->ConnectToService(request.Pass(), &client); 95 app_impl_->ConnectToService(request.Pass(), &client);
97 96
98 scoped_ptr<ViewManagerServiceImpl> service( 97 scoped_ptr<ViewTreeImpl> service(
99 new ViewManagerServiceImpl(connection_manager, creator_id, root_id)); 98 new ViewTreeImpl(connection_manager, creator_id, root_id));
100 return new DefaultClientConnection(service.Pass(), connection_manager, 99 return new DefaultClientConnection(service.Pass(), connection_manager,
101 service_request.Pass(), client.Pass()); 100 tree_request.Pass(), client.Pass());
102 } 101 }
103 102
104 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( 103 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView(
105 ConnectionManager* connection_manager, 104 ConnectionManager* connection_manager,
106 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, 105 mojo::InterfaceRequest<mojo::ViewTree> tree_request,
107 mojo::ConnectionSpecificId creator_id, 106 mojo::ConnectionSpecificId creator_id,
108 const ViewId& root_id, 107 const ViewId& root_id,
109 mojo::ViewManagerClientPtr view_manager_client) { 108 mojo::ViewTreeClientPtr client) {
110 scoped_ptr<ViewManagerServiceImpl> service( 109 scoped_ptr<ViewTreeImpl> service(
111 new ViewManagerServiceImpl(connection_manager, creator_id, root_id)); 110 new ViewTreeImpl(connection_manager, creator_id, root_id));
112 return new DefaultClientConnection(service.Pass(), connection_manager, 111 return new DefaultClientConnection(service.Pass(), connection_manager,
113 service_request.Pass(), 112 tree_request.Pass(),
114 view_manager_client.Pass()); 113 client.Pass());
115 } 114 }
116 115
117 void ViewManagerApp::Create(ApplicationConnection* connection, 116 void ViewManagerApp::Create(ApplicationConnection* connection,
118 InterfaceRequest<ViewManagerRoot> request) { 117 InterfaceRequest<ViewManagerRoot> request) {
119 DCHECK(connection_manager_.get()); 118 DCHECK(connection_manager_.get());
120 // TODO(fsamuel): We need to make sure that only the window manager can create 119 // TODO(fsamuel): We need to make sure that only the window manager can create
121 // new roots. 120 // new roots.
122 ViewManagerRootImpl* view_manager_root = new ViewManagerRootImpl( 121 ViewManagerRootImpl* view_manager_root = new ViewManagerRootImpl(
123 connection_manager_.get(), is_headless_, app_impl_, gpu_state_, 122 connection_manager_.get(), is_headless_, app_impl_, gpu_state_,
124 surfaces_state_); 123 surfaces_state_);
125 124
126 mojo::ViewManagerClientPtr client; 125 mojo::ViewTreeClientPtr client;
127 connection->ConnectToService(&client); 126 connection->ConnectToService(&client);
128 127
129 // ViewManagerRootConnection manages its own lifetime. 128 // ViewManagerRootConnection manages its own lifetime.
130 view_manager_root->Init(new ViewManagerRootConnectionImpl( 129 view_manager_root->Init(new ViewManagerRootConnectionImpl(
131 request.Pass(), make_scoped_ptr(view_manager_root), client.Pass(), 130 request.Pass(), make_scoped_ptr(view_manager_root), client.Pass(),
132 connection_manager_.get())); 131 connection_manager_.get()));
133 } 132 }
134 133
135 void ViewManagerApp::Create( 134 void ViewManagerApp::Create(
136 mojo::ApplicationConnection* connection, 135 mojo::ApplicationConnection* connection,
137 mojo::InterfaceRequest<Gpu> request) { 136 mojo::InterfaceRequest<Gpu> request) {
138 if (!gpu_state_.get()) 137 if (!gpu_state_.get())
139 gpu_state_ = new gles2::GpuState; 138 gpu_state_ = new gles2::GpuState;
140 new gles2::GpuImpl(request.Pass(), gpu_state_); 139 new gles2::GpuImpl(request.Pass(), gpu_state_);
141 } 140 }
142 141
143 void ViewManagerApp::Create( 142 void ViewManagerApp::Create(
144 mojo::ApplicationConnection* connection, 143 mojo::ApplicationConnection* connection,
145 mojo::InterfaceRequest<mojo::Surface> request) { 144 mojo::InterfaceRequest<mojo::Surface> request) {
146 surfaces_.insert( 145 surfaces_.insert(
147 new surfaces::SurfacesImpl(this, surfaces_state_, request.Pass())); 146 new surfaces::SurfacesImpl(this, surfaces_state_, request.Pass()));
148 } 147 }
149 148
150 void ViewManagerApp::OnSurfaceConnectionClosed( 149 void ViewManagerApp::OnSurfaceConnectionClosed(
151 surfaces::SurfacesImpl* surface) { 150 surfaces::SurfacesImpl* surface) {
152 surfaces_.erase(surface); 151 surfaces_.erase(surface);
153 } 152 }
154 153
155 } // namespace view_manager 154 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/view_manager/view_manager_app.h ('k') | components/view_manager/view_manager_client_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698