OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "chrome/browser/ui/cocoa/modal_dialog_client_cocoa.h" |
| 6 |
| 7 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" |
| 8 #import "chrome/browser/ui/cocoa/single_web_contents_dialog_manager_cocoa.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 10 |
| 11 using web_modal::WebContentsModalDialogManager; |
| 12 |
| 13 ModalDialogClientCocoa::ModalDialogClientCocoa() : manager_(nullptr) { |
| 14 } |
| 15 |
| 16 ModalDialogClientCocoa::~ModalDialogClientCocoa() { |
| 17 DCHECK(!manager_); |
| 18 } |
| 19 |
| 20 void ModalDialogClientCocoa::Show(id<ConstrainedWindowSheet> sheet, |
| 21 content::WebContents* web_contents) { |
| 22 auto manager = WebContentsModalDialogManager::FromWebContents(web_contents); |
| 23 scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager( |
| 24 new SingleWebContentsDialogManagerCocoa(this, sheet, manager)); |
| 25 manager->ShowDialogWithManager([sheet sheetWindow], native_manager.Pass()); |
| 26 } |
| 27 |
| 28 void ModalDialogClientCocoa::Close() { |
| 29 if (manager_) |
| 30 manager_->Close(); |
| 31 } |
OLD | NEW |