Commit eb03cf17 authored by Alexander Dunaev's avatar Alexander Dunaev Committed by Commit Bot

Renamed JavascriptAppModalEventBlockerX11 to a better name.

This is a follow-up to [1] where it had been noted that the
JavascriptAppModalEventBlockerX11 does not depend on anything X11 and
should be renamed.

This CL only renames one class.  No changes to any logic are intended.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2366745

Change-Id: I711abba94bef47d17f14e401be6ef7af2a272eaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377485
Auto-Submit: Alexander Dunaev <adunaev@igalia.com>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801841}
parent 21998238
...@@ -4307,8 +4307,8 @@ static_library("ui") { ...@@ -4307,8 +4307,8 @@ static_library("ui") {
if (use_aura) { if (use_aura) {
sources += [ sources += [
"views/chrome_javascript_app_modal_view_factory_views.cc", "views/chrome_javascript_app_modal_view_factory_views.cc",
"views/javascript_app_modal_event_blocker_x11.cc", "views/javascript_app_modal_event_blocker.cc",
"views/javascript_app_modal_event_blocker_x11.h", "views/javascript_app_modal_event_blocker.h",
] ]
deps += [ "//ui/wm/public" ] deps += [ "//ui/wm/public" ]
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/ui/blocked_content/popunder_preventer.h" #include "chrome/browser/ui/blocked_content/popunder_preventer.h"
#include "chrome/browser/ui/views/javascript_app_modal_event_blocker_x11.h" #include "chrome/browser/ui/views/javascript_app_modal_event_blocker.h"
#include "components/constrained_window/constrained_window_views.h" #include "components/constrained_window/constrained_window_views.h"
#include "components/javascript_dialogs/app_modal_dialog_controller.h" #include "components/javascript_dialogs/app_modal_dialog_controller.h"
#include "components/javascript_dialogs/app_modal_dialog_manager.h" #include "components/javascript_dialogs/app_modal_dialog_manager.h"
...@@ -58,7 +58,7 @@ class ChromeJavaScriptAppModalDialogViews ...@@ -58,7 +58,7 @@ class ChromeJavaScriptAppModalDialogViews
// unnecessary on Windows and Chrome OS. // unnecessary on Windows and Chrome OS.
// TODO(pkotwicz): Find a better way of doing this and remove this hack. // TODO(pkotwicz): Find a better way of doing this and remove this hack.
if (UseEventBlocker() && !event_blocker_.get()) { if (UseEventBlocker() && !event_blocker_.get()) {
event_blocker_ = std::make_unique<JavascriptAppModalEventBlockerX11>( event_blocker_ = std::make_unique<JavascriptAppModalEventBlocker>(
GetWidget()->GetNativeView()); GetWidget()->GetNativeView());
} }
AppModalDialogViewViews::ShowAppModalDialog(); AppModalDialogViewViews::ShowAppModalDialog();
...@@ -69,7 +69,7 @@ class ChromeJavaScriptAppModalDialogViews ...@@ -69,7 +69,7 @@ class ChromeJavaScriptAppModalDialogViews
private: private:
// Blocks events to other browser windows while the dialog is open. // Blocks events to other browser windows while the dialog is open.
std::unique_ptr<JavascriptAppModalEventBlockerX11> event_blocker_; std::unique_ptr<JavascriptAppModalEventBlocker> event_blocker_;
PopunderPreventer popunder_preventer_; PopunderPreventer popunder_preventer_;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/javascript_app_modal_event_blocker_x11.h" #include "chrome/browser/ui/views/javascript_app_modal_event_blocker.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
...@@ -23,14 +23,14 @@ aura::Window* GetTopmostTransientParent(aura::Window* window) { ...@@ -23,14 +23,14 @@ aura::Window* GetTopmostTransientParent(aura::Window* window) {
} // namespace } // namespace
JavascriptAppModalEventBlockerX11::JavascriptAppModalEventBlockerX11( JavascriptAppModalEventBlocker::JavascriptAppModalEventBlocker(
aura::Window* modal_window) aura::Window* modal_window)
: modal_window_(modal_window), browser_view_with_modal_dialog_(nullptr) { : modal_window_(modal_window), browser_view_with_modal_dialog_(nullptr) {
aura::Window* topmost_transient_parent = aura::Window* topmost_transient_parent =
GetTopmostTransientParent(modal_window); GetTopmostTransientParent(modal_window);
browser_view_with_modal_dialog_ = browser_view_with_modal_dialog_ =
BrowserView::GetBrowserViewForNativeWindow(topmost_transient_parent); BrowserView::GetBrowserViewForNativeWindow(topmost_transient_parent);
// |browser_view_with_modal_dialog_| is NULL if the dialog was opened by an // |browser_view_with_modal_dialog_| is nullptr if the dialog was opened by an
// extension background page. // extension background page.
aura::Env::GetInstance()->AddPreTargetHandler( aura::Env::GetInstance()->AddPreTargetHandler(
...@@ -39,11 +39,11 @@ JavascriptAppModalEventBlockerX11::JavascriptAppModalEventBlockerX11( ...@@ -39,11 +39,11 @@ JavascriptAppModalEventBlockerX11::JavascriptAppModalEventBlockerX11(
// WindowModalityController will cancel touches as appropriate. // WindowModalityController will cancel touches as appropriate.
} }
JavascriptAppModalEventBlockerX11::~JavascriptAppModalEventBlockerX11() { JavascriptAppModalEventBlocker::~JavascriptAppModalEventBlocker() {
aura::Env::GetInstance()->RemovePreTargetHandler(this); aura::Env::GetInstance()->RemovePreTargetHandler(this);
} }
bool JavascriptAppModalEventBlockerX11::ShouldStopPropagationTo( bool JavascriptAppModalEventBlocker::ShouldStopPropagationTo(
ui::EventTarget* target) { ui::EventTarget* target) {
// Stop propagation if: // Stop propagation if:
// -|target| is a browser window or a transient child of a browser window. // -|target| is a browser window or a transient child of a browser window.
...@@ -61,12 +61,12 @@ bool JavascriptAppModalEventBlockerX11::ShouldStopPropagationTo( ...@@ -61,12 +61,12 @@ bool JavascriptAppModalEventBlockerX11::ShouldStopPropagationTo(
return browser_view && browser_view != browser_view_with_modal_dialog_; return browser_view && browser_view != browser_view_with_modal_dialog_;
} }
void JavascriptAppModalEventBlockerX11::OnKeyEvent(ui::KeyEvent* event) { void JavascriptAppModalEventBlocker::OnKeyEvent(ui::KeyEvent* event) {
if (ShouldStopPropagationTo(event->target())) if (ShouldStopPropagationTo(event->target()))
event->StopPropagation(); event->StopPropagation();
} }
void JavascriptAppModalEventBlockerX11::OnMouseEvent(ui::MouseEvent* event) { void JavascriptAppModalEventBlocker::OnMouseEvent(ui::MouseEvent* event) {
if (event->type() != ui::ET_MOUSE_CAPTURE_CHANGED && if (event->type() != ui::ET_MOUSE_CAPTURE_CHANGED &&
ShouldStopPropagationTo(event->target())) { ShouldStopPropagationTo(event->target())) {
if (event->type() == ui::ET_MOUSE_PRESSED) if (event->type() == ui::ET_MOUSE_PRESSED)
...@@ -75,12 +75,12 @@ void JavascriptAppModalEventBlockerX11::OnMouseEvent(ui::MouseEvent* event) { ...@@ -75,12 +75,12 @@ void JavascriptAppModalEventBlockerX11::OnMouseEvent(ui::MouseEvent* event) {
} }
} }
void JavascriptAppModalEventBlockerX11::OnScrollEvent(ui::ScrollEvent* event) { void JavascriptAppModalEventBlocker::OnScrollEvent(ui::ScrollEvent* event) {
if (ShouldStopPropagationTo(event->target())) if (ShouldStopPropagationTo(event->target()))
event->StopPropagation(); event->StopPropagation();
} }
void JavascriptAppModalEventBlockerX11::OnTouchEvent(ui::TouchEvent* event) { void JavascriptAppModalEventBlocker::OnTouchEvent(ui::TouchEvent* event) {
if (event->type() != ui::ET_TOUCH_CANCELLED && if (event->type() != ui::ET_TOUCH_CANCELLED &&
ShouldStopPropagationTo(event->target())) { ShouldStopPropagationTo(event->target())) {
if (event->type() == ui::ET_TOUCH_PRESSED) if (event->type() == ui::ET_TOUCH_PRESSED)
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_EVENT_BLOCKER_X11_H_ #ifndef CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_EVENT_BLOCKER_H_
#define CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_EVENT_BLOCKER_X11_H_ #define CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_EVENT_BLOCKER_H_
#include "base/macros.h" #include "base/macros.h"
#include "ui/events/event_handler.h" #include "ui/events/event_handler.h"
...@@ -18,15 +18,15 @@ namespace ui { ...@@ -18,15 +18,15 @@ namespace ui {
class EventTarget; class EventTarget;
} }
// JavascriptAppModalEventBlockerX11 blocks events to all browser windows except // JavascriptAppModalEventBlocker blocks events to all browser windows except
// the browser window which hosts |app_modal_window| for the duration of its // the browser window which hosts |app_modal_window| for the duration of its
// lifetime. JavascriptAppModalEventBlockerX11 should not outlive // lifetime. JavascriptAppModalEventBlocker should not outlive
// |app_modal_window|. // |app_modal_window|.
// TODO(pkotwicz): Merge this class into WindowModalityController. // TODO(pkotwicz): Merge this class into WindowModalityController.
class JavascriptAppModalEventBlockerX11 : public ui::EventHandler { class JavascriptAppModalEventBlocker : public ui::EventHandler {
public: public:
explicit JavascriptAppModalEventBlockerX11(aura::Window* app_modal_window); explicit JavascriptAppModalEventBlocker(aura::Window* app_modal_window);
~JavascriptAppModalEventBlockerX11() override; ~JavascriptAppModalEventBlocker() override;
private: private:
// Returns true if the propagation of events to |target| should be stopped. // Returns true if the propagation of events to |target| should be stopped.
...@@ -44,7 +44,7 @@ class JavascriptAppModalEventBlockerX11 : public ui::EventHandler { ...@@ -44,7 +44,7 @@ class JavascriptAppModalEventBlockerX11 : public ui::EventHandler {
// The BrowserView which hosts the app modal dialog. // The BrowserView which hosts the app modal dialog.
BrowserView* browser_view_with_modal_dialog_; BrowserView* browser_view_with_modal_dialog_;
DISALLOW_COPY_AND_ASSIGN(JavascriptAppModalEventBlockerX11); DISALLOW_COPY_AND_ASSIGN(JavascriptAppModalEventBlocker);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_EVENT_BLOCKER_X11_H_ #endif // CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_EVENT_BLOCKER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment