OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 } | 448 } |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
452 if (new_window->parent() == host_window_) { | 452 if (new_window->parent() == host_window_) { |
453 UpdateConstrainedWindows(NULL); | 453 UpdateConstrainedWindows(NULL); |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 void OnWillRemoveWindow(aura::Window* window) override { | 457 void OnWillRemoveWindow(aura::Window* window) override { |
458 if (window == view_->window_) | 458 if (window == view_->window_.get()) |
459 return; | 459 return; |
460 | 460 |
461 window->RemoveObserver(this); | 461 window->RemoveObserver(this); |
462 UpdateConstrainedWindows(window); | 462 UpdateConstrainedWindows(window); |
463 } | 463 } |
464 | 464 |
465 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override { | 465 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override { |
466 if (window == view_->window_ || | 466 if (window == view_->window_.get() || window->parent() == host_window_ || |
467 window->parent() == host_window_ || | |
468 window->parent() == view_->window_->GetRootWindow()) { | 467 window->parent() == view_->window_->GetRootWindow()) { |
469 UpdateConstrainedWindows(NULL); | 468 UpdateConstrainedWindows(NULL); |
470 } | 469 } |
471 } | 470 } |
472 #endif | 471 #endif |
473 | 472 |
474 void OnWindowParentChanged(aura::Window* window, | 473 void OnWindowParentChanged(aura::Window* window, |
475 aura::Window* parent) override { | 474 aura::Window* parent) override { |
476 if (window != view_->window_) | 475 if (window != view_->window_.get()) |
477 return; | 476 return; |
478 | 477 |
479 aura::Window* host_window = | 478 aura::Window* host_window = |
480 window->GetProperty(aura::client::kHostWindowKey); | 479 window->GetProperty(aura::client::kHostWindowKey); |
481 if (!host_window) | 480 if (!host_window) |
482 host_window = parent; | 481 host_window = parent; |
483 | 482 |
484 if (host_window_) | 483 if (host_window_) |
485 host_window_->RemoveObserver(this); | 484 host_window_->RemoveObserver(this); |
486 | 485 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 children[i]->AddObserver(this); | 521 children[i]->AddObserver(this); |
523 } | 522 } |
524 } | 523 } |
525 #endif | 524 #endif |
526 } | 525 } |
527 } | 526 } |
528 | 527 |
529 void OnWindowBoundsChanged(aura::Window* window, | 528 void OnWindowBoundsChanged(aura::Window* window, |
530 const gfx::Rect& old_bounds, | 529 const gfx::Rect& old_bounds, |
531 const gfx::Rect& new_bounds) override { | 530 const gfx::Rect& new_bounds) override { |
532 if (window == host_window_ || window == view_->window_) { | 531 if (window == host_window_ || window == view_->window_.get()) { |
533 SendScreenRects(); | 532 SendScreenRects(); |
534 if (old_bounds.origin() != new_bounds.origin()) { | 533 if (old_bounds.origin() != new_bounds.origin()) { |
535 TouchSelectionControllerClientAura* selection_controller_client = | 534 TouchSelectionControllerClientAura* selection_controller_client = |
536 view_->GetSelectionControllerClient(); | 535 view_->GetSelectionControllerClient(); |
537 if (selection_controller_client) | 536 if (selection_controller_client) |
538 selection_controller_client->OnWindowMoved(); | 537 selection_controller_client->OnWindowMoved(); |
539 } | 538 } |
540 #if defined(OS_WIN) | 539 #if defined(OS_WIN) |
541 } else { | 540 } else { |
542 UpdateConstrainedWindows(NULL); | 541 UpdateConstrainedWindows(NULL); |
543 #endif | 542 #endif |
544 } | 543 } |
545 } | 544 } |
546 | 545 |
547 void OnWindowDestroying(aura::Window* window) override { | 546 void OnWindowDestroying(aura::Window* window) override { |
548 if (window == host_window_) { | 547 if (window == host_window_) { |
549 host_window_->RemoveObserver(this); | 548 host_window_->RemoveObserver(this); |
550 host_window_ = NULL; | 549 host_window_ = NULL; |
551 } | 550 } |
552 } | 551 } |
553 | 552 |
554 void OnWindowAddedToRootWindow(aura::Window* window) override { | 553 void OnWindowAddedToRootWindow(aura::Window* window) override { |
555 if (window == view_->window_) { | 554 if (window == view_->window_.get()) { |
556 window->GetHost()->AddObserver(this); | 555 window->GetHost()->AddObserver(this); |
557 #if defined(OS_WIN) | 556 #if defined(OS_WIN) |
558 if (!window->GetRootWindow()->HasObserver(this)) | 557 if (!window->GetRootWindow()->HasObserver(this)) |
559 window->GetRootWindow()->AddObserver(this); | 558 window->GetRootWindow()->AddObserver(this); |
560 #endif | 559 #endif |
561 } | 560 } |
562 } | 561 } |
563 | 562 |
564 void OnWindowRemovingFromRootWindow(aura::Window* window, | 563 void OnWindowRemovingFromRootWindow(aura::Window* window, |
565 aura::Window* new_root) override { | 564 aura::Window* new_root) override { |
566 if (window == view_->window_) { | 565 if (window == view_->window_.get()) { |
567 window->GetHost()->RemoveObserver(this); | 566 window->GetHost()->RemoveObserver(this); |
568 #if defined(OS_WIN) | 567 #if defined(OS_WIN) |
569 window->GetRootWindow()->RemoveObserver(this); | 568 window->GetRootWindow()->RemoveObserver(this); |
570 | 569 |
571 const aura::Window::Windows& root_children = | 570 const aura::Window::Windows& root_children = |
572 window->GetRootWindow()->children(); | 571 window->GetRootWindow()->children(); |
573 for (size_t i = 0; i < root_children.size(); ++i) { | 572 for (size_t i = 0; i < root_children.size(); ++i) { |
574 if (root_children[i] != view_->window_ && | 573 if (root_children[i] != view_->window_.get() && |
575 root_children[i] != host_window_) { | 574 root_children[i] != host_window_) { |
576 root_children[i]->RemoveObserver(this); | 575 root_children[i]->RemoveObserver(this); |
577 } | 576 } |
578 } | 577 } |
579 #endif | 578 #endif |
580 } | 579 } |
581 } | 580 } |
582 | 581 |
583 // Overridden WindowTreeHostObserver: | 582 // Overridden WindowTreeHostObserver: |
584 void OnHostMoved(const aura::WindowTreeHost* host, | 583 void OnHostMoved(const aura::WindowTreeHost* host, |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 if (visible) { | 1318 if (visible) { |
1320 if (!web_contents_->should_normally_be_visible()) | 1319 if (!web_contents_->should_normally_be_visible()) |
1321 web_contents_->WasShown(); | 1320 web_contents_->WasShown(); |
1322 } else { | 1321 } else { |
1323 if (web_contents_->should_normally_be_visible()) | 1322 if (web_contents_->should_normally_be_visible()) |
1324 web_contents_->WasHidden(); | 1323 web_contents_->WasHidden(); |
1325 } | 1324 } |
1326 } | 1325 } |
1327 | 1326 |
1328 } // namespace content | 1327 } // namespace content |
OLD | NEW |