Commit 74d2ba14 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

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: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605898}
parent cee3abc6
...@@ -1999,8 +1999,6 @@ jumbo_split_static_library("ui") { ...@@ -1999,8 +1999,6 @@ 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",
...@@ -2062,6 +2060,7 @@ jumbo_split_static_library("ui") { ...@@ -2062,6 +2060,7 @@ 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_
...@@ -302,13 +302,11 @@ void NativeWidgetMac::InitModalType(ui::ModalType modal_type) { ...@@ -302,13 +302,11 @@ 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