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

Side by Side Diff: ash/wm_window.cc

Issue 2908793002: [mus+ash] Removes WmWindow from ash/wm/overview and ash/wm/workspace (Closed)
Patch Set: Created 3 years, 7 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 | « ash/wm_window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/wm_window.h" 5 #include "ash/wm_window.h"
6 6
7 #include "ash/ash_constants.h" 7 #include "ash/ash_constants.h"
8 #include "ash/public/cpp/config.h" 8 #include "ash/public/cpp/config.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/public/cpp/window_properties.h" 10 #include "ash/public/cpp/window_properties.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 441
442 void WmWindow::Hide() { 442 void WmWindow::Hide() {
443 window_->Hide(); 443 window_->Hide();
444 } 444 }
445 445
446 void WmWindow::Show() { 446 void WmWindow::Show() {
447 window_->Show(); 447 window_->Show();
448 } 448 }
449 449
450 void WmWindow::CloseWidget() {
451 if (Shell::GetAshConfig() == Config::MASH &&
452 aura_window()->GetProperty(kWidgetCreationTypeKey) ==
453 WidgetCreationType::FOR_CLIENT) {
454 // NOTE: in the FOR_CLIENT case there is not necessarily a widget associated
455 // with the window. Mash only creates widgets for top level windows if mash
456 // renders the non-client frame.
457 DCHECK(Shell::window_manager_client());
458 Shell::window_manager_client()->RequestClose(aura_window());
459 return;
460 }
461 views::Widget* widget = GetInternalWidgetForWindow(window_);
462 DCHECK(widget);
463 widget->Close();
464 }
465
466 void WmWindow::SetFocused() { 450 void WmWindow::SetFocused() {
467 aura::client::GetFocusClient(window_)->FocusWindow(window_); 451 aura::client::GetFocusClient(window_)->FocusWindow(window_);
468 } 452 }
469 453
470 bool WmWindow::IsFocused() const { 454 bool WmWindow::IsFocused() const {
471 return window_->HasFocus(); 455 return window_->HasFocus();
472 } 456 }
473 457
474 bool WmWindow::IsActive() const { 458 bool WmWindow::IsActive() const {
475 return wm::IsActiveWindow(window_); 459 return wm::IsActiveWindow(window_);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 void WmWindow::RemoveTransientWindowObserver( 542 void WmWindow::RemoveTransientWindowObserver(
559 WmTransientWindowObserver* observer) { 543 WmTransientWindowObserver* observer) {
560 transient_observers_.RemoveObserver(observer); 544 transient_observers_.RemoveObserver(observer);
561 if (added_transient_observer_ && 545 if (added_transient_observer_ &&
562 !transient_observers_.might_have_observers()) { 546 !transient_observers_.might_have_observers()) {
563 added_transient_observer_ = false; 547 added_transient_observer_ = false;
564 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this); 548 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this);
565 } 549 }
566 } 550 }
567 551
568 void WmWindow::AddLimitedPreTargetHandler(ui::EventHandler* handler) {
569 // In mus AddPreTargetHandler() only works for windows created by this client.
570 DCHECK(Shell::GetAshConfig() != Config::MASH ||
571 Shell::window_tree_client()->WasCreatedByThisClient(
572 aura::WindowMus::Get(window_)));
573 window_->AddPreTargetHandler(handler);
574 }
575
576 void WmWindow::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) {
577 window_->RemovePreTargetHandler(handler);
578 }
579
580 WmWindow::WmWindow(aura::Window* window) : window_(window) { 552 WmWindow::WmWindow(aura::Window* window) : window_(window) {
581 window_->SetProperty(kWmWindowKey, this); 553 window_->SetProperty(kWmWindowKey, this);
582 } 554 }
583 555
584 void WmWindow::OnTransientChildAdded(aura::Window* window, 556 void WmWindow::OnTransientChildAdded(aura::Window* window,
585 aura::Window* transient) { 557 aura::Window* transient) {
586 for (auto& observer : transient_observers_) 558 for (auto& observer : transient_observers_)
587 observer.OnTransientChildAdded(this, Get(transient)); 559 observer.OnTransientChildAdded(this, Get(transient));
588 } 560 }
589 561
590 void WmWindow::OnTransientChildRemoved(aura::Window* window, 562 void WmWindow::OnTransientChildRemoved(aura::Window* window,
591 aura::Window* transient) { 563 aura::Window* transient) {
592 for (auto& observer : transient_observers_) 564 for (auto& observer : transient_observers_)
593 observer.OnTransientChildRemoved(this, Get(transient)); 565 observer.OnTransientChildRemoved(this, Get(transient));
594 } 566 }
595 567
596 } // namespace ash 568 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698