Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1040)

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 1815593002: Remove windowed NPAPI code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make_test_plugin_windowless
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mus.cc ('k') | content/child/npapi/plugin_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_view_aura.cc
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 59747158a219c9a95bcd3f39073c80d18e39be76..7053c50b57603233c085d6394f01cd11b536352e 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -406,11 +406,6 @@ class WebContentsViewAura::WindowObserver
: view_(view),
host_window_(NULL) {
view_->window_->AddObserver(this);
-
-#if defined(OS_WIN)
- if (view_->window_->GetRootWindow())
- view_->window_->GetRootWindow()->AddObserver(this);
-#endif
}
~WindowObserver() override {
@@ -419,64 +414,8 @@ class WebContentsViewAura::WindowObserver
view_->window_->GetHost()->RemoveObserver(this);
if (host_window_)
host_window_->RemoveObserver(this);
-#if defined(OS_WIN)
- if (host_window_) {
- const aura::Window::Windows& children = host_window_->children();
- for (size_t i = 0; i < children.size(); ++i)
- children[i]->RemoveObserver(this);
- }
-
- aura::Window* root_window = view_->window_->GetRootWindow();
- if (root_window) {
- root_window->RemoveObserver(this);
- const aura::Window::Windows& root_children = root_window->children();
- for (size_t i = 0; i < root_children.size(); ++i)
- root_children[i]->RemoveObserver(this);
- }
-#endif
- }
-
-#if defined(OS_WIN)
- // Constrained windows are added as children of the parent's parent's view
- // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV
- // so that it can update the plugins' cutout rects accordingly.
- // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is
- // going to be deprecated in a year, this is ok for now. The test for this is
- // PrintPreviewTest.WindowedNPAPIPluginHidden.
- void OnWindowAdded(aura::Window* new_window) override {
- if (!new_window->Contains(view_->window_.get())) {
- // Skip the case when the parent moves to the root window.
- if (new_window != host_window_) {
- // Observe sibling windows of the WebContents, or children of the root
- // window.
- if (new_window->parent() == host_window_ ||
- new_window->parent() == view_->window_->GetRootWindow()) {
- new_window->AddObserver(this);
- }
- }
- }
-
- if (new_window->parent() == host_window_) {
- UpdateConstrainedWindows(NULL);
- }
}
- void OnWillRemoveWindow(aura::Window* window) override {
- if (window == view_->window_.get())
- return;
-
- window->RemoveObserver(this);
- UpdateConstrainedWindows(window);
- }
-
- void OnWindowVisibilityChanged(aura::Window* window, bool visible) override {
- if (window == view_->window_.get() || window->parent() == host_window_ ||
- window->parent() == view_->window_->GetRootWindow()) {
- UpdateConstrainedWindows(NULL);
- }
- }
-#endif
-
void OnWindowParentChanged(aura::Window* window,
aura::Window* parent) override {
if (window != view_->window_.get())
@@ -490,46 +429,9 @@ class WebContentsViewAura::WindowObserver
if (host_window_)
host_window_->RemoveObserver(this);
-#if defined(OS_WIN)
- if (host_window_) {
- const aura::Window::Windows& children = host_window_->children();
- for (size_t i = 0; i < children.size(); ++i)
- children[i]->RemoveObserver(this);
- RenderWidgetHostViewAura* rwhv = ToRenderWidgetHostViewAura(
- view_->web_contents_->GetRenderWidgetHostView());
- if (rwhv)
- rwhv->UpdateConstrainedWindowRects(std::vector<gfx::Rect>());
- }
-
- // When we get parented to the root window, the code below will watch the
- // host window, aka root window. Since we already watch the root window on
- // Windows, unregister first so that the debug check doesn't fire.
- if (host_window && host_window == window->GetRootWindow())
- host_window->RemoveObserver(this);
-
- // We need to undo the above if we were parented to the root window and then
- // got parented to another window. At that point, the code before the ifdef
- // would have stopped watching the root window.
- if (window->GetRootWindow() &&
- host_window != window->GetRootWindow() &&
- !window->GetRootWindow()->HasObserver(this)) {
- window->GetRootWindow()->AddObserver(this);
- }
-#endif
-
host_window_ = host_window;
- if (host_window) {
+ if (host_window)
host_window->AddObserver(this);
-#if defined(OS_WIN)
- if (host_window != window->GetRootWindow()) {
- const aura::Window::Windows& children = host_window->children();
- for (size_t i = 0; i < children.size(); ++i) {
- if (!children[i]->Contains(view_->window_.get()))
- children[i]->AddObserver(this);
- }
- }
-#endif
- }
}
void OnWindowBoundsChanged(aura::Window* window,
@@ -543,10 +445,6 @@ class WebContentsViewAura::WindowObserver
if (selection_controller_client)
selection_controller_client->OnWindowMoved();
}
-#if defined(OS_WIN)
- } else {
- UpdateConstrainedWindows(NULL);
-#endif
}
}
@@ -558,32 +456,14 @@ class WebContentsViewAura::WindowObserver
}
void OnWindowAddedToRootWindow(aura::Window* window) override {
- if (window == view_->window_.get()) {
+ if (window == view_->window_.get())
window->GetHost()->AddObserver(this);
-#if defined(OS_WIN)
- if (!window->GetRootWindow()->HasObserver(this))
- window->GetRootWindow()->AddObserver(this);
-#endif
- }
}
void OnWindowRemovingFromRootWindow(aura::Window* window,
aura::Window* new_root) override {
- if (window == view_->window_.get()) {
+ if (window == view_->window_.get())
window->GetHost()->RemoveObserver(this);
-#if defined(OS_WIN)
- window->GetRootWindow()->RemoveObserver(this);
-
- const aura::Window::Windows& root_children =
- window->GetRootWindow()->children();
- for (size_t i = 0; i < root_children.size(); ++i) {
- if (root_children[i] != view_->window_.get() &&
- root_children[i] != host_window_) {
- root_children[i]->RemoveObserver(this);
- }
- }
-#endif
- }
}
// Overridden WindowTreeHostObserver:
@@ -600,41 +480,6 @@ class WebContentsViewAura::WindowObserver
private:
void SendScreenRects() { view_->web_contents_->SendScreenRects(); }
-#if defined(OS_WIN)
- void UpdateConstrainedWindows(aura::Window* exclude) {
- RenderWidgetHostViewAura* view = ToRenderWidgetHostViewAura(
- view_->web_contents_->GetRenderWidgetHostView());
- if (!view)
- return;
-
- std::vector<gfx::Rect> constrained_windows;
- if (host_window_) {
- const aura::Window::Windows& children = host_window_->children();
- for (size_t i = 0; i < children.size(); ++i) {
- if (!children[i]->Contains(view_->window_.get()) &&
- children[i] != exclude &&
- children[i]->IsVisible()) {
- constrained_windows.push_back(children[i]->GetBoundsInRootWindow());
- }
- }
- }
-
- aura::Window* root_window = view_->window_->GetRootWindow();
- const aura::Window::Windows& root_children = root_window->children();
- if (root_window) {
- for (size_t i = 0; i < root_children.size(); ++i) {
- if (root_children[i]->IsVisible() &&
- !root_children[i]->Contains(view_->window_.get())) {
- constrained_windows.push_back(
- root_children[i]->GetBoundsInRootWindow());
- }
- }
- }
-
- view->UpdateConstrainedWindowRects(constrained_windows);
- }
-#endif
-
WebContentsViewAura* view_;
// The parent window that hosts the constrained windows. We cache the old host
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mus.cc ('k') | content/child/npapi/plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698