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...) 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 | |
522 #if defined(OS_WIN) | 507 #if defined(OS_WIN) |
523 // Constrained windows are added as children of the parent's parent's view | 508 // Constrained windows are added as children of the parent's parent's view |
524 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV | 509 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV |
525 // so that it can update the plugins' cutout rects accordingly. | 510 // so that it can update the plugins' cutout rects accordingly. |
526 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is | 511 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is |
527 // going to be deprecated in a year, this is ok for now. The test for this is | 512 // going to be deprecated in a year, this is ok for now. The test for this is |
528 // PrintPreviewTest.WindowedNPAPIPluginHidden. | 513 // PrintPreviewTest.WindowedNPAPIPluginHidden. |
529 virtual void OnWindowAdded(aura::Window* new_window) override { | 514 virtual void OnWindowAdded(aura::Window* new_window) override { |
530 if (!new_window->Contains(view_->window_.get())) { | 515 if (!new_window->Contains(view_->window_.get())) { |
531 // Skip the case when the parent moves to the root window. | 516 // Skip the case when the parent moves to the root window. |
(...skipping 1114 matching lines...) Loading... |
1646 if (visible) { | 1631 if (visible) { |
1647 if (!web_contents_->should_normally_be_visible()) | 1632 if (!web_contents_->should_normally_be_visible()) |
1648 web_contents_->WasShown(); | 1633 web_contents_->WasShown(); |
1649 } else { | 1634 } else { |
1650 if (web_contents_->should_normally_be_visible()) | 1635 if (web_contents_->should_normally_be_visible()) |
1651 web_contents_->WasHidden(); | 1636 web_contents_->WasHidden(); |
1652 } | 1637 } |
1653 } | 1638 } |
1654 | 1639 |
1655 } // namespace content | 1640 } // namespace content |
OLD | NEW |