Commit bc6a5226 authored by spqchan's avatar spqchan Committed by Commit Bot

[MacViews] Show Harmony PasswordReuseDialog with --secondary-ui-md

Bug: 741138
Change-Id: I62e5475e3e4ec45797c4491e42d90ef0187491bf
Reviewed-on: https://chromium-review.googlesource.com/691057Reviewed-by: default avatarJialiu Lin <jialiul@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Sarah Chan <spqchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505384}
parent 8e145d7e
......@@ -20,8 +20,10 @@
#include "chrome/browser/ui/views/importer/import_lock_dialog_view.h"
#include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
#include "chrome/browser/ui/views/page_info/page_info_bubble_view.h"
#include "chrome/browser/ui/views/safe_browsing/password_reuse_modal_warning_dialog.h"
#include "chrome/browser/ui/views/task_manager_view.h"
#include "chrome/browser/ui/views/update_recommended_message_box.h"
#include "components/constrained_window/constrained_window_views.h"
// This file provides definitions of desktop browser dialog-creation methods for
// Mac where a Cocoa browser is using Views dialogs. I.e. it is included in the
......@@ -140,4 +142,16 @@ void ShowFirstRunBubbleViews(Browser* browser) {
return FirstRunBubble::Show(browser);
}
void ShowPasswordReuseWarningDialog(
content::WebContents* web_contents,
safe_browsing::ChromePasswordProtectionService* service,
safe_browsing::OnWarningDone done_callback) {
safe_browsing::PasswordReuseModalWarningDialog* dialog =
new safe_browsing::PasswordReuseModalWarningDialog(
web_contents, service, std::move(done_callback));
constrained_window::CreateBrowserModalDialogViews(
dialog, web_contents->GetTopLevelNativeWindow())
->Show();
}
} // namespace chrome
......@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_UI_COCOA_BROWSER_DIALOGS_VIEWS_MAC_H_
#define CHROME_BROWSER_UI_COCOA_BROWSER_DIALOGS_VIEWS_MAC_H_
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
#include "ui/gfx/native_widget_types.h"
class Browser;
......@@ -92,6 +93,11 @@ void ShowImportLockDialogViews(gfx::NativeWindow parent,
// Shows the first run bubble.
void ShowFirstRunBubbleViews(Browser* browser);
void ShowPasswordReuseWarningDialog(
content::WebContents* web_contents,
safe_browsing::ChromePasswordProtectionService* service,
safe_browsing::OnWarningDone done_callback);
} // namespace chrome
#endif // CHROME_BROWSER_UI_COCOA_BROWSER_DIALOGS_VIEWS_MAC_H_
......@@ -4,9 +4,11 @@
#import "chrome/browser/ui/cocoa/password_reuse_warning_dialog_cocoa.h"
#include "chrome/browser/ui/cocoa/browser_dialogs_views_mac.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
#import "chrome/browser/ui/cocoa/password_reuse_warning_view_controller.h"
#include "ui/base/material_design/material_design_controller.h"
namespace safe_browsing {
......@@ -16,6 +18,12 @@ void ShowPasswordReuseModalWarningDialog(
OnWarningDone done_callback) {
DCHECK(web_contents);
if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
chrome::ShowPasswordReuseWarningDialog(web_contents, service,
std::move(done_callback));
return;
}
// Dialog owns itself.
new PasswordReuseWarningDialogCocoa(web_contents, service,
std::move(done_callback));
......
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