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

Side by Side Diff: mojo/services/view_manager/connection_manager.cc

Issue 692693002: Make it possible to change the viewport size (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix style nits Created 6 years, 1 month 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 "mojo/services/view_manager/connection_manager.h" 5 #include "mojo/services/view_manager/connection_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "mojo/converters/geometry/geometry_type_converters.h"
9 #include "mojo/converters/input_events/input_events_type_converters.h" 10 #include "mojo/converters/input_events/input_events_type_converters.h"
10 #include "mojo/public/cpp/application/application_connection.h" 11 #include "mojo/public/cpp/application/application_connection.h"
11 #include "mojo/public/interfaces/application/service_provider.mojom.h" 12 #include "mojo/public/interfaces/application/service_provider.mojom.h"
12 #include "mojo/services/view_manager/connection_manager_delegate.h" 13 #include "mojo/services/view_manager/connection_manager_delegate.h"
13 #include "mojo/services/view_manager/view_manager_service_impl.h" 14 #include "mojo/services/view_manager/view_manager_service_impl.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 namespace service { 17 namespace service {
17 18
18 class WindowManagerInternalClientImpl 19 class WindowManagerInternalClientImpl
19 : public InterfaceImpl<WindowManagerInternalClient> { 20 : public InterfaceImpl<WindowManagerInternalClient> {
20 public: 21 public:
21 WindowManagerInternalClientImpl(WindowManagerInternalClient* real_client, 22 WindowManagerInternalClientImpl(WindowManagerInternalClient* real_client,
22 ErrorHandler* error_handler) 23 ErrorHandler* error_handler)
23 : real_client_(real_client), error_handler_(error_handler) {} 24 : real_client_(real_client), error_handler_(error_handler) {}
24 ~WindowManagerInternalClientImpl() override {} 25 ~WindowManagerInternalClientImpl() override {}
25 26
26 // WindowManagerInternalClient: 27 // WindowManagerInternalClient:
27 void DispatchInputEventToView(Id transport_view_id, EventPtr event) override { 28 void DispatchInputEventToView(Id transport_view_id, EventPtr event) override {
28 real_client_->DispatchInputEventToView(transport_view_id, event.Pass()); 29 real_client_->DispatchInputEventToView(transport_view_id, event.Pass());
29 } 30 }
30 31
32 void SetViewportSize(SizePtr size) override {
33 real_client_->SetViewportSize(size.Pass());
34 }
35
31 // InterfaceImpl: 36 // InterfaceImpl:
32 void OnConnectionError() override { error_handler_->OnConnectionError(); } 37 void OnConnectionError() override { error_handler_->OnConnectionError(); }
33 38
34 private: 39 private:
35 WindowManagerInternalClient* real_client_; 40 WindowManagerInternalClient* real_client_;
36 ErrorHandler* error_handler_; 41 ErrorHandler* error_handler_;
37 42
38 DISALLOW_COPY_AND_ASSIGN(WindowManagerInternalClientImpl); 43 DISALLOW_COPY_AND_ASSIGN(WindowManagerInternalClientImpl);
39 }; 44 };
40 45
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 void ConnectionManager::OnViewPropertyChanged( 322 void ConnectionManager::OnViewPropertyChanged(
318 const ServerView* view, 323 const ServerView* view,
319 const std::string& name, 324 const std::string& name,
320 const std::vector<uint8_t>* new_data) { 325 const std::vector<uint8_t>* new_data) {
321 for (auto& pair : connection_map_) { 326 for (auto& pair : connection_map_) {
322 pair.second->ProcessViewPropertyChanged( 327 pair.second->ProcessViewPropertyChanged(
323 view, name, new_data, IsChangeSource(pair.first)); 328 view, name, new_data, IsChangeSource(pair.first));
324 } 329 }
325 } 330 }
326 331
332 void ConnectionManager::SetViewportSize(SizePtr size) {
333 gfx::Size new_size = size.To<gfx::Size>();
334 display_manager_.SetViewportSize(new_size);
335 }
336
327 void ConnectionManager::DispatchInputEventToView(Id transport_view_id, 337 void ConnectionManager::DispatchInputEventToView(Id transport_view_id,
328 EventPtr event) { 338 EventPtr event) {
329 const ViewId view_id(ViewIdFromTransportId(transport_view_id)); 339 const ViewId view_id(ViewIdFromTransportId(transport_view_id));
330 340
331 ViewManagerServiceImpl* connection = GetConnectionWithRoot(view_id); 341 ViewManagerServiceImpl* connection = GetConnectionWithRoot(view_id);
332 if (!connection) 342 if (!connection)
333 connection = GetConnection(view_id.connection_id); 343 connection = GetConnection(view_id.connection_id);
334 if (connection) { 344 if (connection) {
335 connection->client()->OnViewInputEvent( 345 connection->client()->OnViewInputEvent(
336 transport_view_id, event.Pass(), base::Bind(&base::DoNothing)); 346 transport_view_id, event.Pass(), base::Bind(&base::DoNothing));
(...skipping 30 matching lines...) Expand all
367 new WindowManagerInternalClientImpl(this, this)); 377 new WindowManagerInternalClientImpl(this, this));
368 WeakBindToRequest(wm_internal_client_impl_.get(), &request); 378 WeakBindToRequest(wm_internal_client_impl_.get(), &request);
369 } 379 }
370 380
371 void ConnectionManager::OnConnectionError() { 381 void ConnectionManager::OnConnectionError() {
372 delegate_->OnLostConnectionToWindowManager(); 382 delegate_->OnLostConnectionToWindowManager();
373 } 383 }
374 384
375 } // namespace service 385 } // namespace service
376 } // namespace mojo 386 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/connection_manager.h ('k') | mojo/services/view_manager/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698