Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Unified Diff: chrome/browser/ui/cocoa/modal_dialog_client_cocoa.mm

Issue 866263008: MacViews: Unify web contents modal dialog types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ValidationMessageBubble
Patch Set: Fixes for tapted Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/modal_dialog_client_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/modal_dialog_client_cocoa.mm b/chrome/browser/ui/cocoa/modal_dialog_client_cocoa.mm
new file mode 100644
index 0000000000000000000000000000000000000000..2d0065992bfa51f6439925a5f33fffaec2fa6676
--- /dev/null
+++ b/chrome/browser/ui/cocoa/modal_dialog_client_cocoa.mm
@@ -0,0 +1,31 @@
+// Copyright 2015 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.
+
+#import "chrome/browser/ui/cocoa/modal_dialog_client_cocoa.h"
+
+#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h"
+#import "chrome/browser/ui/cocoa/single_web_contents_dialog_manager_cocoa.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
+
+using web_modal::WebContentsModalDialogManager;
+
+ModalDialogClientCocoa::ModalDialogClientCocoa() : manager_(nullptr) {
+}
+
+ModalDialogClientCocoa::~ModalDialogClientCocoa() {
+ DCHECK(!manager_);
+}
+
+void ModalDialogClientCocoa::Show(id<ConstrainedWindowSheet> sheet,
+ content::WebContents* web_contents) {
+ auto manager = WebContentsModalDialogManager::FromWebContents(web_contents);
+ scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager(
+ new SingleWebContentsDialogManagerCocoa(this, sheet, manager));
+ manager->ShowDialogWithManager([sheet sheetWindow], native_manager.Pass());
+}
+
+void ModalDialogClientCocoa::Close() {
+ if (manager_)
+ manager_->Close();
+}

Powered by Google App Engine
This is Rietveld 408576698