1 // Copyright (c) 2013 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.
5 #include "components/web_modal/web_contents_modal_dialog_manager.h"
7 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
8 #include "components/web_modal/native_web_contents_modal_dialog_manager.h"
10 using web_modal::NativeWebContentsModalDialog;
14 class NativeWebContentsModalDialogManagerCocoa
15 : public web_modal::NativeWebContentsModalDialogManager {
17 NativeWebContentsModalDialogManagerCocoa() {
20 virtual ~NativeWebContentsModalDialogManagerCocoa() {
23 // NativeWebContentsModalDialogManager overrides
24 virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE {
27 virtual void ShowDialog(NativeWebContentsModalDialog dialog) OVERRIDE {
28 GetConstrainedWindowMac(dialog)->ShowWebContentsModalDialog();
31 virtual void HideDialog(NativeWebContentsModalDialog dialog) OVERRIDE {
34 virtual void CloseDialog(NativeWebContentsModalDialog dialog) OVERRIDE {
35 GetConstrainedWindowMac(dialog)->CloseWebContentsModalDialog();
38 virtual void FocusDialog(NativeWebContentsModalDialog dialog) OVERRIDE {
39 GetConstrainedWindowMac(dialog)->FocusWebContentsModalDialog();
42 virtual void PulseDialog(NativeWebContentsModalDialog dialog) OVERRIDE {
43 GetConstrainedWindowMac(dialog)->PulseWebContentsModalDialog();
46 virtual void HostChanged(
47 web_modal::WebContentsModalDialogHost* new_host) OVERRIDE {
51 static ConstrainedWindowMac* GetConstrainedWindowMac(
52 NativeWebContentsModalDialog dialog) {
53 return static_cast<ConstrainedWindowMac*>(dialog);
56 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerCocoa);
63 NativeWebContentsModalDialogManager*
64 WebContentsModalDialogManager::CreateNativeManager(
65 NativeWebContentsModalDialogManagerDelegate* native_delegate) {
66 return new NativeWebContentsModalDialogManagerCocoa;
69 } // namespace web_modal