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

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2710023007: Make WindowTree::SetModal() take the type. (Closed)
Patch Set: address feedback. Created 3 years, 9 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
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_); 476 drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_);
477 capture_synchronizer_ = base::MakeUnique<CaptureSynchronizer>(this, tree_); 477 capture_synchronizer_ = base::MakeUnique<CaptureSynchronizer>(this, tree_);
478 focus_synchronizer_ = base::MakeUnique<FocusSynchronizer>(this, tree_); 478 focus_synchronizer_ = base::MakeUnique<FocusSynchronizer>(this, tree_);
479 } 479 }
480 480
481 void WindowTreeClient::OnConnectionLost() { 481 void WindowTreeClient::OnConnectionLost() {
482 delegate_->OnLostConnection(this); 482 delegate_->OnLostConnection(this);
483 } 483 }
484 484
485 bool WindowTreeClient::HandleInternalPropertyChanged(WindowMus* window, 485 bool WindowTreeClient::HandleInternalPropertyChanged(WindowMus* window,
486 const void* key) { 486 const void* key,
487 int64_t old_value) {
487 if (key != client::kModalKey) 488 if (key != client::kModalKey)
488 return false; 489 return false;
489 490
490 if (window->GetWindow()->GetProperty(client::kModalKey) ==
491 ui::MODAL_TYPE_NONE) {
492 // TODO: shouldn't early return, but explicitly tell server to turn off
493 // modality. http://crbug.com/660073.
494 return true;
495 }
496
497 const uint32_t change_id = 491 const uint32_t change_id =
498 ScheduleInFlightChange(base::MakeUnique<InFlightSetModalChange>(window)); 492 ScheduleInFlightChange(base::MakeUnique<InFlightSetModalTypeChange>(
499 // TODO: this is subtly different that explicitly specifying a type. 493 window, static_cast<ui::ModalType>(old_value)));
500 // http://crbug.com/660073. 494 tree_->SetModalType(change_id, window->server_id(),
501 tree_->SetModal(change_id, window->server_id()); 495 window->GetWindow()->GetProperty(client::kModalKey));
502 return true; 496 return true;
503 } 497 }
504 498
505 void WindowTreeClient::OnEmbedImpl(ui::mojom::WindowTree* window_tree, 499 void WindowTreeClient::OnEmbedImpl(ui::mojom::WindowTree* window_tree,
506 ClientSpecificId client_id, 500 ClientSpecificId client_id,
507 ui::mojom::WindowDataPtr root_data, 501 ui::mojom::WindowDataPtr root_data,
508 int64_t display_id, 502 int64_t display_id,
509 Id focused_window_id, 503 Id focused_window_id,
510 bool drawn) { 504 bool drawn) {
511 // WARNING: this is only called if WindowTreeClient was created as the 505 // WARNING: this is only called if WindowTreeClient was created as the
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 window->GetWindow(), key, &data->transport_name, 724 window->GetWindow(), key, &data->transport_name,
731 &data->transport_value)) { 725 &data->transport_value)) {
732 return nullptr; 726 return nullptr;
733 } 727 }
734 return std::move(data); 728 return std::move(data);
735 } 729 }
736 730
737 void WindowTreeClient::OnWindowMusPropertyChanged( 731 void WindowTreeClient::OnWindowMusPropertyChanged(
738 WindowMus* window, 732 WindowMus* window,
739 const void* key, 733 const void* key,
734 int64_t old_value,
740 std::unique_ptr<ui::PropertyData> data) { 735 std::unique_ptr<ui::PropertyData> data) {
741 if (HandleInternalPropertyChanged(window, key) || !data) 736 if (HandleInternalPropertyChanged(window, key, old_value) || !data)
742 return; 737 return;
743 738
744 WindowPortPropertyDataMus* data_mus = 739 WindowPortPropertyDataMus* data_mus =
745 static_cast<WindowPortPropertyDataMus*>(data.get()); 740 static_cast<WindowPortPropertyDataMus*>(data.get());
746 741
747 std::string transport_name; 742 std::string transport_name;
748 std::unique_ptr<std::vector<uint8_t>> transport_value; 743 std::unique_ptr<std::vector<uint8_t>> transport_value;
749 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( 744 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport(
750 window->GetWindow(), key, &transport_name, &transport_value)) { 745 window->GetWindow(), key, &transport_name, &transport_value)) {
751 return; 746 return;
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1819 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1825 this, capture_synchronizer_.get(), window)); 1820 this, capture_synchronizer_.get(), window));
1826 } 1821 }
1827 1822
1828 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1823 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1829 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1824 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1830 this, focus_synchronizer_.get(), window)); 1825 this, focus_synchronizer_.get(), window));
1831 } 1826 }
1832 1827
1833 } // namespace aura 1828 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698