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/window.h" | 5 #include "components/mus/public/cpp/window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 std::string Window::GetName() const { | 467 std::string Window::GetName() const { |
468 if (HasSharedProperty(mojom::WindowManager::kName_Property)) | 468 if (HasSharedProperty(mojom::WindowManager::kName_Property)) |
469 return GetSharedProperty<std::string>(mojom::WindowManager::kName_Property); | 469 return GetSharedProperty<std::string>(mojom::WindowManager::kName_Property); |
470 | 470 |
471 return std::string(); | 471 return std::string(); |
472 } | 472 } |
473 | 473 |
474 //////////////////////////////////////////////////////////////////////////////// | 474 //////////////////////////////////////////////////////////////////////////////// |
475 // Window, protected: | 475 // Window, protected: |
476 | 476 |
477 namespace { | |
478 | |
479 mojom::ViewportMetricsPtr CreateEmptyViewportMetrics() { | |
480 mojom::ViewportMetricsPtr metrics = mojom::ViewportMetrics::New(); | |
481 metrics->size_in_pixels = mojo::Size::New(); | |
482 return metrics; | |
483 } | |
484 | |
485 } // namespace | |
486 | |
487 Window::Window() : Window(nullptr, static_cast<Id>(-1)) {} | 477 Window::Window() : Window(nullptr, static_cast<Id>(-1)) {} |
488 | 478 |
489 Window::~Window() { | 479 Window::~Window() { |
490 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroying(this)); | 480 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroying(this)); |
491 | 481 |
492 if (HasFocus()) { | 482 if (HasFocus()) { |
493 // The focused window is being removed. When this happens the server | 483 // The focused window is being removed. When this happens the server |
494 // advances focus. We don't want to randomly pick a Window to get focus, so | 484 // advances focus. We don't want to randomly pick a Window to get focus, so |
495 // we update local state only, and wait for the next focus change from the | 485 // we update local state only, and wait for the next focus change from the |
496 // server. | 486 // server. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 Window::Window(WindowTreeConnection* connection, Id id) | 532 Window::Window(WindowTreeConnection* connection, Id id) |
543 : connection_(connection), | 533 : connection_(connection), |
544 server_id_(id), | 534 server_id_(id), |
545 parent_(nullptr), | 535 parent_(nullptr), |
546 stacking_target_(nullptr), | 536 stacking_target_(nullptr), |
547 transient_parent_(nullptr), | 537 transient_parent_(nullptr), |
548 is_modal_(false), | 538 is_modal_(false), |
549 // Matches aura, see aura::Window for details. | 539 // Matches aura, see aura::Window for details. |
550 observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY), | 540 observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY), |
551 input_event_handler_(nullptr), | 541 input_event_handler_(nullptr), |
552 viewport_metrics_(CreateEmptyViewportMetrics()), | 542 viewport_metrics_(mojom::ViewportMetrics::New()), |
553 visible_(false), | 543 visible_(false), |
554 opacity_(1.0f), | 544 opacity_(1.0f), |
555 cursor_id_(mojom::Cursor::CURSOR_NULL), | 545 cursor_id_(mojom::Cursor::CURSOR_NULL), |
556 parent_drawn_(false) {} | 546 parent_drawn_(false) {} |
557 | 547 |
558 WindowTreeClientImpl* Window::tree_client() { | 548 WindowTreeClientImpl* Window::tree_client() { |
559 return static_cast<WindowTreeClientImpl*>(connection_); | 549 return static_cast<WindowTreeClientImpl*>(connection_); |
560 } | 550 } |
561 | 551 |
562 void Window::SetSharedPropertyInternal(const std::string& name, | 552 void Window::SetSharedPropertyInternal(const std::string& name, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 notifier->NotifyWindowReordered(); | 886 notifier->NotifyWindowReordered(); |
897 | 887 |
898 return true; | 888 return true; |
899 } | 889 } |
900 | 890 |
901 // static | 891 // static |
902 Window** Window::GetStackingTarget(Window* window) { | 892 Window** Window::GetStackingTarget(Window* window) { |
903 return &window->stacking_target_; | 893 return &window->stacking_target_; |
904 } | 894 } |
905 } // namespace mus | 895 } // namespace mus |
OLD | NEW |