Commit d4843952 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbuiv: make message box closure unconditional

This change:
1) Removes the can_close parameter to chrome::ShowWarningMessageBox()
2) Removes the code supporting that parameter, making close always possible
   on message boxes
3) Renames SimpleMessageBoxViews to MessageBoxDialog, to indicate that it
   is a dialog rather than a View

Bug: 1011446
Change-Id: Ia4e0ba79ad170bc7837d48eb380ff752236c05ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028667Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736889}
parent 328c515e
......@@ -88,8 +88,7 @@ class DeleteProfileDialogManager : public BrowserListObserver {
IDS_PROFILE_WILL_BE_DELETED_DIALOG_DESCRIPTION,
base::ASCIIToUTF16(primary_account_email_),
base::ASCIIToUTF16(
gaia::ExtractDomainName(primary_account_email_))),
/*can_close=*/false);
gaia::ExtractDomainName(primary_account_email_))));
webui::DeleteProfileAtPath(
profile_->GetPath(),
......
......@@ -3026,6 +3026,8 @@ jumbo_static_library("ui") {
"views/media_router/presentation_receiver_window_view.h",
"views/media_router/web_contents_display_observer_view.cc",
"views/media_router/web_contents_display_observer_view.h",
"views/message_box_dialog.cc",
"views/message_box_dialog.h",
"views/native_file_system/native_file_system_access_icon_view.cc",
"views/native_file_system/native_file_system_access_icon_view.h",
"views/native_file_system/native_file_system_directory_access_confirmation_view.cc",
......@@ -3212,8 +3214,6 @@ jumbo_static_library("ui") {
"views/sharing/sharing_dialog_view.h",
"views/sharing/sharing_icon_view.cc",
"views/sharing/sharing_icon_view.h",
"views/simple_message_box_views.cc",
"views/simple_message_box_views.h",
"views/status_bubble_views.cc",
"views/status_bubble_views.h",
"views/storage/storage_pressure_bubble_view.cc",
......
......@@ -13,8 +13,7 @@ namespace chrome {
void ShowWarningMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message,
bool can_close) {
const base::string16& message) {
NOTIMPLEMENTED();
}
......
......@@ -42,8 +42,7 @@ enum MessageBoxType {
// infobars; consult the UI leads for a recommendation.
void ShowWarningMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message,
bool can_close = true);
const base::string16& message);
// As above, but shows the dialog box asynchronously with a checkbox.
// |callback| will be invoked after the dialog is dismissed. It is invoked with
......
......@@ -2,17 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_
#ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_BOX_DIALOG_H_
#define CHROME_BROWSER_UI_VIEWS_MESSAGE_BOX_DIALOG_H_
#include "chrome/browser/ui/simple_message_box.h"
#include "ui/views/controls/message_box_view.h"
#include "ui/views/widget/widget_observer.h"
#include "ui/views/window/dialog_delegate.h"
class SimpleMessageBoxViews : public views::DialogDelegate,
public views::WidgetObserver {
namespace views {
class MessageBoxView;
}
class MessageBoxDialog : public views::DialogDelegate,
public views::WidgetObserver {
public:
using MessageBoxResultCallback =
base::OnceCallback<void(chrome::MessageBoxResult result)>;
......@@ -25,13 +28,9 @@ class SimpleMessageBoxViews : public views::DialogDelegate,
const base::string16& yes_text,
const base::string16& no_text,
const base::string16& checkbox_text,
bool can_close,
MessageBoxResultCallback callback = MessageBoxResultCallback());
// views::DialogDelegate:
bool Cancel() override;
bool Accept() override;
bool Close() override;
base::string16 GetWindowTitle() const override;
void DeleteDelegate() override;
ui::ModalType GetModalType() const override;
......@@ -42,31 +41,30 @@ class SimpleMessageBoxViews : public views::DialogDelegate,
void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
private:
SimpleMessageBoxViews(const base::string16& title,
const base::string16& message,
chrome::MessageBoxType type,
const base::string16& yes_text,
const base::string16& no_text,
const base::string16& checkbox_text,
bool is_system_modal,
bool can_close);
~SimpleMessageBoxViews() override;
MessageBoxDialog(const base::string16& title,
const base::string16& message,
chrome::MessageBoxType type,
const base::string16& yes_text,
const base::string16& no_text,
const base::string16& checkbox_text,
bool is_system_modal);
~MessageBoxDialog() override;
void Run(MessageBoxResultCallback result_callback);
void Done();
void Done(chrome::MessageBoxResult result);
// views::DialogDelegate:
void OnDialogAccepted();
// WidgetGetter:
const views::Widget* GetWidgetImpl() const override;
const base::string16 window_title_;
const chrome::MessageBoxType type_;
chrome::MessageBoxResult result_;
views::MessageBoxView* message_box_view_;
MessageBoxResultCallback result_callback_;
bool is_system_modal_;
bool can_close_;
DISALLOW_COPY_AND_ASSIGN(SimpleMessageBoxViews);
DISALLOW_COPY_AND_ASSIGN(MessageBoxDialog);
};
#endif // CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_
#endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_BOX_DIALOG_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