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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 aura::Window* root_window = view_->window_->GetRootWindow(); | 497 aura::Window* root_window = view_->window_->GetRootWindow(); |
498 if (root_window) { | 498 if (root_window) { |
499 root_window->RemoveObserver(this); | 499 root_window->RemoveObserver(this); |
500 const aura::Window::Windows& root_children = root_window->children(); | 500 const aura::Window::Windows& root_children = root_window->children(); |
501 for (size_t i = 0; i < root_children.size(); ++i) | 501 for (size_t i = 0; i < root_children.size(); ++i) |
502 root_children[i]->RemoveObserver(this); | 502 root_children[i]->RemoveObserver(this); |
503 } | 503 } |
504 #endif | 504 #endif |
505 } | 505 } |
506 | 506 |
| 507 // Overridden from aura::WindowObserver: |
| 508 void OnWindowHierarchyChanged( |
| 509 const aura::WindowObserver::HierarchyChangeParams& params) override { |
| 510 if (params.receiver != view_->window_.get() || |
| 511 !params.target->Contains(view_->window_.get())) { |
| 512 return; |
| 513 } |
| 514 |
| 515 // Use the new parent's root window for calculating HiDPI subpixel offset. |
| 516 RenderWidgetHostViewAura* rwhv = ToRenderWidgetHostViewAura( |
| 517 view_->web_contents_->GetRenderWidgetHostView()); |
| 518 if (rwhv) |
| 519 rwhv->SnapToPhysicalPixelBoundary(); |
| 520 } |
| 521 |
507 #if defined(OS_WIN) | 522 #if defined(OS_WIN) |
508 // Constrained windows are added as children of the parent's parent's view | 523 // Constrained windows are added as children of the parent's parent's view |
509 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV | 524 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV |
510 // so that it can update the plugins' cutout rects accordingly. | 525 // so that it can update the plugins' cutout rects accordingly. |
511 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is | 526 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is |
512 // going to be deprecated in a year, this is ok for now. The test for this is | 527 // going to be deprecated in a year, this is ok for now. The test for this is |
513 // PrintPreviewTest.WindowedNPAPIPluginHidden. | 528 // PrintPreviewTest.WindowedNPAPIPluginHidden. |
514 virtual void OnWindowAdded(aura::Window* new_window) override { | 529 virtual void OnWindowAdded(aura::Window* new_window) override { |
515 if (!new_window->Contains(view_->window_.get())) { | 530 if (!new_window->Contains(view_->window_.get())) { |
516 // Skip the case when the parent moves to the root window. | 531 // Skip the case when the parent moves to the root window. |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 if (visible) { | 1646 if (visible) { |
1632 if (!web_contents_->should_normally_be_visible()) | 1647 if (!web_contents_->should_normally_be_visible()) |
1633 web_contents_->WasShown(); | 1648 web_contents_->WasShown(); |
1634 } else { | 1649 } else { |
1635 if (web_contents_->should_normally_be_visible()) | 1650 if (web_contents_->should_normally_be_visible()) |
1636 web_contents_->WasHidden(); | 1651 web_contents_->WasHidden(); |
1637 } | 1652 } |
1638 } | 1653 } |
1639 | 1654 |
1640 } // namespace content | 1655 } // namespace content |
OLD | NEW |