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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 if (window == view_->window_ || | 466 if (window == view_->window_ || |
467 window->parent() == host_window_ || | 467 window->parent() == host_window_ || |
468 window->parent() == view_->window_->GetRootWindow()) { | 468 window->parent() == view_->window_->GetRootWindow()) { |
469 UpdateConstrainedWindows(NULL); | 469 UpdateConstrainedWindows(NULL); |
470 } | 470 } |
471 } | 471 } |
472 #endif | 472 #endif |
473 | 473 |
474 void OnWindowParentChanged(aura::Window* window, | 474 void OnWindowParentChanged(aura::Window* window, |
475 aura::Window* parent) override { | 475 aura::Window* parent) override { |
476 if (window != view_->window_) | 476 if (window != view_->window_.get()) |
477 return; | 477 return; |
478 | 478 |
479 aura::Window* host_window = | 479 aura::Window* host_window = |
480 window->GetProperty(aura::client::kHostWindowKey); | 480 window->GetProperty(aura::client::kHostWindowKey); |
481 if (!host_window) | 481 if (!host_window) |
482 host_window = parent; | 482 host_window = parent; |
483 | 483 |
484 if (host_window_) | 484 if (host_window_) |
485 host_window_->RemoveObserver(this); | 485 host_window_->RemoveObserver(this); |
486 | 486 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 children[i]->AddObserver(this); | 522 children[i]->AddObserver(this); |
523 } | 523 } |
524 } | 524 } |
525 #endif | 525 #endif |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 void OnWindowBoundsChanged(aura::Window* window, | 529 void OnWindowBoundsChanged(aura::Window* window, |
530 const gfx::Rect& old_bounds, | 530 const gfx::Rect& old_bounds, |
531 const gfx::Rect& new_bounds) override { | 531 const gfx::Rect& new_bounds) override { |
532 if (window == host_window_ || window == view_->window_) { | 532 if (window == host_window_ || window == view_->window_.get()) { |
533 SendScreenRects(); | 533 SendScreenRects(); |
534 if (old_bounds.origin() != new_bounds.origin()) { | 534 if (old_bounds.origin() != new_bounds.origin()) { |
535 TouchSelectionControllerClientAura* selection_controller_client = | 535 TouchSelectionControllerClientAura* selection_controller_client = |
536 view_->GetSelectionControllerClient(); | 536 view_->GetSelectionControllerClient(); |
537 if (selection_controller_client) | 537 if (selection_controller_client) |
538 selection_controller_client->OnWindowMoved(); | 538 selection_controller_client->OnWindowMoved(); |
539 } | 539 } |
540 #if defined(OS_WIN) | 540 #if defined(OS_WIN) |
541 } else { | 541 } else { |
542 UpdateConstrainedWindows(NULL); | 542 UpdateConstrainedWindows(NULL); |
543 #endif | 543 #endif |
544 } | 544 } |
545 } | 545 } |
546 | 546 |
547 void OnWindowDestroying(aura::Window* window) override { | 547 void OnWindowDestroying(aura::Window* window) override { |
548 if (window == host_window_) { | 548 if (window == host_window_) { |
549 host_window_->RemoveObserver(this); | 549 host_window_->RemoveObserver(this); |
550 host_window_ = NULL; | 550 host_window_ = NULL; |
551 } | 551 } |
552 } | 552 } |
553 | 553 |
554 void OnWindowAddedToRootWindow(aura::Window* window) override { | 554 void OnWindowAddedToRootWindow(aura::Window* window) override { |
555 if (window == view_->window_) { | 555 if (window == view_->window_.get()) { |
556 window->GetHost()->AddObserver(this); | 556 window->GetHost()->AddObserver(this); |
557 #if defined(OS_WIN) | 557 #if defined(OS_WIN) |
558 if (!window->GetRootWindow()->HasObserver(this)) | 558 if (!window->GetRootWindow()->HasObserver(this)) |
559 window->GetRootWindow()->AddObserver(this); | 559 window->GetRootWindow()->AddObserver(this); |
560 #endif | 560 #endif |
561 } | 561 } |
562 } | 562 } |
563 | 563 |
564 void OnWindowRemovingFromRootWindow(aura::Window* window, | 564 void OnWindowRemovingFromRootWindow(aura::Window* window, |
565 aura::Window* new_root) override { | 565 aura::Window* new_root) override { |
566 if (window == view_->window_) { | 566 if (window == view_->window_.get()) { |
567 window->GetHost()->RemoveObserver(this); | 567 window->GetHost()->RemoveObserver(this); |
568 #if defined(OS_WIN) | 568 #if defined(OS_WIN) |
569 window->GetRootWindow()->RemoveObserver(this); | 569 window->GetRootWindow()->RemoveObserver(this); |
570 | 570 |
571 const aura::Window::Windows& root_children = | 571 const aura::Window::Windows& root_children = |
572 window->GetRootWindow()->children(); | 572 window->GetRootWindow()->children(); |
573 for (size_t i = 0; i < root_children.size(); ++i) { | 573 for (size_t i = 0; i < root_children.size(); ++i) { |
574 if (root_children[i] != view_->window_ && | 574 if (root_children[i] != view_->window_ && |
575 root_children[i] != host_window_) { | 575 root_children[i] != host_window_) { |
576 root_children[i]->RemoveObserver(this); | 576 root_children[i]->RemoveObserver(this); |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 if (visible) { | 1319 if (visible) { |
1320 if (!web_contents_->should_normally_be_visible()) | 1320 if (!web_contents_->should_normally_be_visible()) |
1321 web_contents_->WasShown(); | 1321 web_contents_->WasShown(); |
1322 } else { | 1322 } else { |
1323 if (web_contents_->should_normally_be_visible()) | 1323 if (web_contents_->should_normally_be_visible()) |
1324 web_contents_->WasHidden(); | 1324 web_contents_->WasHidden(); |
1325 } | 1325 } |
1326 } | 1326 } |
1327 | 1327 |
1328 } // namespace content | 1328 } // namespace content |
OLD | NEW |