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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 #endif | 428 #endif |
429 } | 429 } |
430 | 430 |
431 #if defined(OS_WIN) | 431 #if defined(OS_WIN) |
432 // Constrained windows are added as children of the parent's parent's view | 432 // Constrained windows are added as children of the parent's parent's view |
433 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV | 433 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV |
434 // so that it can update the plugins' cutout rects accordingly. | 434 // so that it can update the plugins' cutout rects accordingly. |
435 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is | 435 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is |
436 // going to be deprecated in a year, this is ok for now. The test for this is | 436 // going to be deprecated in a year, this is ok for now. The test for this is |
437 // PrintPreviewTest.WindowedNPAPIPluginHidden. | 437 // PrintPreviewTest.WindowedNPAPIPluginHidden. |
438 virtual void OnWindowAdded(aura::Window* new_window) override { | 438 void OnWindowAdded(aura::Window* new_window) override { |
439 if (!new_window->Contains(view_->window_.get())) { | 439 if (!new_window->Contains(view_->window_.get())) { |
440 // Skip the case when the parent moves to the root window. | 440 // Skip the case when the parent moves to the root window. |
441 if (new_window != host_window_) { | 441 if (new_window != host_window_) { |
442 // Observe sibling windows of the WebContents, or children of the root | 442 // Observe sibling windows of the WebContents, or children of the root |
443 // window. | 443 // window. |
444 if (new_window->parent() == host_window_ || | 444 if (new_window->parent() == host_window_ || |
445 new_window->parent() == view_->window_->GetRootWindow()) { | 445 new_window->parent() == view_->window_->GetRootWindow()) { |
446 new_window->AddObserver(this); | 446 new_window->AddObserver(this); |
447 } | 447 } |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 if (new_window->parent() == host_window_) { | 451 if (new_window->parent() == host_window_) { |
452 UpdateConstrainedWindows(NULL); | 452 UpdateConstrainedWindows(NULL); |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 virtual void OnWillRemoveWindow(aura::Window* window) override { | 456 void OnWillRemoveWindow(aura::Window* window) override { |
457 if (window == view_->window_) | 457 if (window == view_->window_) |
458 return; | 458 return; |
459 | 459 |
460 window->RemoveObserver(this); | 460 window->RemoveObserver(this); |
461 UpdateConstrainedWindows(window); | 461 UpdateConstrainedWindows(window); |
462 } | 462 } |
463 | 463 |
464 virtual void OnWindowVisibilityChanged(aura::Window* window, | 464 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override { |
465 bool visible) override { | |
466 if (window == view_->window_ || | 465 if (window == view_->window_ || |
467 window->parent() == host_window_ || | 466 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 { |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 if (visible) { | 1324 if (visible) { |
1326 if (!web_contents_->should_normally_be_visible()) | 1325 if (!web_contents_->should_normally_be_visible()) |
1327 web_contents_->WasShown(); | 1326 web_contents_->WasShown(); |
1328 } else { | 1327 } else { |
1329 if (web_contents_->should_normally_be_visible()) | 1328 if (web_contents_->should_normally_be_visible()) |
1330 web_contents_->WasHidden(); | 1329 web_contents_->WasHidden(); |
1331 } | 1330 } |
1332 } | 1331 } |
1333 | 1332 |
1334 } // namespace content | 1333 } // namespace content |
OLD | NEW |