Commit d1f914d0 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Revert "MacViews: Remove JavaScriptAppModalDialogCocoa"

This reverts commit 74d2ba14.

Reason for revert:

This breaks the dialog.

The beforeunload dialog *must* block all of Chrome. MacViews does not have the modality code do to so yet. If you implement that modality you may reland this.

Original change's description:
> MacViews: Remove JavaScriptAppModalDialogCocoa
> 
> Move from using Cocoa to using Views. The Cocoa version was was causing
> problems with app exit dialogs showing up in the wrong process in
> RemoteMacViews. This issue was solved by the views version.
> 
> Bug: 898604
> Change-Id: I30bd1e543fa98a1503d80b4ad3947f676eb5e0c6
> Reviewed-on: https://chromium-review.googlesource.com/c/1298300
> Commit-Queue: ccameron <ccameron@chromium.org>
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#605898}

TBR=ellyjones@chromium.org,ccameron@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 898604
Change-Id: I5ec60bc8490083175092da9b4f2d0a2167aac18a
Reviewed-on: https://chromium-review.googlesource.com/c/1331831Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607418}
parent ec79c47c
...@@ -2006,6 +2006,8 @@ jumbo_split_static_library("ui") { ...@@ -2006,6 +2006,8 @@ jumbo_split_static_library("ui") {
"cocoa/history_menu_cocoa_controller.mm", "cocoa/history_menu_cocoa_controller.mm",
"cocoa/history_overlay_controller.h", "cocoa/history_overlay_controller.h",
"cocoa/history_overlay_controller.mm", "cocoa/history_overlay_controller.mm",
"cocoa/javascript_app_modal_dialog_cocoa.h",
"cocoa/javascript_app_modal_dialog_cocoa.mm",
"cocoa/key_equivalent_constants.h", "cocoa/key_equivalent_constants.h",
"cocoa/key_equivalent_constants.mm", "cocoa/key_equivalent_constants.mm",
"cocoa/keystone_infobar_delegate.h", "cocoa/keystone_infobar_delegate.h",
...@@ -2067,7 +2069,6 @@ jumbo_split_static_library("ui") { ...@@ -2067,7 +2069,6 @@ jumbo_split_static_library("ui") {
"cocoa/window_size_autosaver.mm", "cocoa/window_size_autosaver.mm",
"views/apps/chrome_app_window_client_views_mac.mm", "views/apps/chrome_app_window_client_views_mac.mm",
"views/certificate_viewer_mac_views.mm", "views/certificate_viewer_mac_views.mm",
"views/chrome_javascript_native_dialog_factory_views.cc",
"views/dropdown_bar_host_mac.mm", "views/dropdown_bar_host_mac.mm",
"views/frame/browser_frame_mac.h", "views/frame/browser_frame_mac.h",
"views/frame/browser_frame_mac.mm", "views/frame/browser_frame_mac.mm",
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
#define CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
#include <memory>
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#include "components/app_modal/native_app_modal_dialog.h"
class PopunderPreventer;
namespace app_modal {
class JavaScriptAppModalDialog;
}
#if __OBJC__
@class NSAlert;
@class JavaScriptAppModalDialogHelper;
#else
class NSAlert;
class JavaScriptAppModalDialogHelper;
#endif
class JavaScriptAppModalDialogCocoa : public app_modal::NativeAppModalDialog {
public:
explicit JavaScriptAppModalDialogCocoa(
app_modal::JavaScriptAppModalDialog* dialog);
~JavaScriptAppModalDialogCocoa() override;
// Overridden from NativeAppModalDialog:
int GetAppModalDialogButtons() const override;
void ShowAppModalDialog() override;
void ActivateAppModalDialog() override;
void CloseAppModalDialog() override;
void AcceptAppModalDialog() override;
void CancelAppModalDialog() override;
bool IsShowing() const override;
app_modal::JavaScriptAppModalDialog* dialog() const {
return dialog_.get();
}
private:
// Returns the NSAlert associated with the modal dialog.
NSAlert* GetAlert() const;
std::unique_ptr<app_modal::JavaScriptAppModalDialog> dialog_;
std::unique_ptr<PopunderPreventer> popunder_preventer_;
// Created in the constructor and destroyed in the destructor.
base::scoped_nsobject<JavaScriptAppModalDialogHelper> helper_;
bool is_showing_;
DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogCocoa);
};
#endif // CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
This diff is collapsed.
...@@ -302,11 +302,13 @@ void NativeWidgetMac::InitModalType(ui::ModalType modal_type) { ...@@ -302,11 +302,13 @@ void NativeWidgetMac::InitModalType(ui::ModalType modal_type) {
if (modal_type == ui::MODAL_TYPE_NONE) if (modal_type == ui::MODAL_TYPE_NONE)
return; return;
// System modal windows not implemented (or used) on Mac.
DCHECK_NE(ui::MODAL_TYPE_SYSTEM, modal_type);
// A peculiarity of the constrained window framework is that it permits a // A peculiarity of the constrained window framework is that it permits a
// dialog of MODAL_TYPE_WINDOW to have a null parent window; falling back to // dialog of MODAL_TYPE_WINDOW to have a null parent window; falling back to
// a non-modal window in this case. // a non-modal window in this case.
DCHECK(bridge_host_->parent() || modal_type == ui::MODAL_TYPE_WINDOW || DCHECK(bridge_host_->parent() || modal_type == ui::MODAL_TYPE_WINDOW);
modal_type == ui::MODAL_TYPE_SYSTEM);
// Everything happens upon show. // Everything happens upon show.
} }
......
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