| 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/mus/public/cpp/lib/window_tree_client_impl.h" | 5 #include "components/mus/public/cpp/lib/window_tree_client_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/mus/common/util.h" | 8 #include "components/mus/common/util.h" |
| 9 #include "components/mus/public/cpp/lib/in_flight_change.h" | 9 #include "components/mus/public/cpp/lib/in_flight_change.h" |
| 10 #include "components/mus/public/cpp/lib/window_private.h" | 10 #include "components/mus/public/cpp/lib/window_private.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 360 |
| 361 Window* WindowTreeClientImpl::GetWindowById(Id id) { | 361 Window* WindowTreeClientImpl::GetWindowById(Id id) { |
| 362 IdToWindowMap::const_iterator it = windows_.find(id); | 362 IdToWindowMap::const_iterator it = windows_.find(id); |
| 363 return it != windows_.end() ? it->second : NULL; | 363 return it != windows_.end() ? it->second : NULL; |
| 364 } | 364 } |
| 365 | 365 |
| 366 Window* WindowTreeClientImpl::GetFocusedWindow() { | 366 Window* WindowTreeClientImpl::GetFocusedWindow() { |
| 367 return focused_window_; | 367 return focused_window_; |
| 368 } | 368 } |
| 369 | 369 |
| 370 Window* WindowTreeClientImpl::NewWindow() { | 370 Window* WindowTreeClientImpl::NewWindow( |
| 371 const Window::SharedProperties* properties) { |
| 371 DCHECK(tree_); | 372 DCHECK(tree_); |
| 372 Window* window = | 373 Window* window = |
| 373 new Window(this, MakeTransportId(connection_id_, next_window_id_++)); | 374 new Window(this, MakeTransportId(connection_id_, next_window_id_++)); |
| 375 if (properties) |
| 376 window->properties_ = *properties; |
| 374 AddWindow(window); | 377 AddWindow(window); |
| 375 | 378 |
| 376 const uint32_t change_id = ScheduleInFlightChange( | 379 const uint32_t change_id = ScheduleInFlightChange( |
| 377 make_scoped_ptr(new CrashInFlightChange(window, ChangeType::NEW_WINDOW))); | 380 make_scoped_ptr(new CrashInFlightChange(window, ChangeType::NEW_WINDOW))); |
| 378 tree_->NewWindow(change_id, window->id()); | 381 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties; |
| 382 if (properties) { |
| 383 transport_properties = |
| 384 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(*properties); |
| 385 } |
| 386 tree_->NewWindow(change_id, window->id(), transport_properties.Pass()); |
| 379 return window; | 387 return window; |
| 380 } | 388 } |
| 381 | 389 |
| 382 bool WindowTreeClientImpl::IsEmbedRoot() { | 390 bool WindowTreeClientImpl::IsEmbedRoot() { |
| 383 return is_embed_root_; | 391 return is_embed_root_; |
| 384 } | 392 } |
| 385 | 393 |
| 386 ConnectionSpecificId WindowTreeClientImpl::GetConnectionId() { | 394 ConnectionSpecificId WindowTreeClientImpl::GetConnectionId() { |
| 387 return connection_id_; | 395 return connection_id_; |
| 388 } | 396 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 void WindowTreeClientImpl::OnActionCompleted(bool success) { | 656 void WindowTreeClientImpl::OnActionCompleted(bool success) { |
| 649 if (!change_acked_callback_.is_null()) | 657 if (!change_acked_callback_.is_null()) |
| 650 change_acked_callback_.Run(); | 658 change_acked_callback_.Run(); |
| 651 } | 659 } |
| 652 | 660 |
| 653 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() { | 661 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() { |
| 654 return [this](bool success) { OnActionCompleted(success); }; | 662 return [this](bool success) { OnActionCompleted(success); }; |
| 655 } | 663 } |
| 656 | 664 |
| 657 } // namespace mus | 665 } // namespace mus |
| OLD | NEW |