| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h" | 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/memory/scoped_nsobject.h" |
| 10 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" | 10 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 12 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | |
| 13 #include "chrome/browser/ui/webui/web_dialog_ui.h" | |
| 14 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" | 12 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" |
| 15 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 16 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 16 #include "ui/web_dialogs/web_dialog_ui.h" |
| 17 | 17 |
| 18 using content::WebContents; | 18 using content::WebContents; |
| 19 using ui::WebDialogDelegate; |
| 20 using ui::ConstrainedWebDialogDelegate; |
| 19 | 21 |
| 20 class ConstrainedWebDialogDelegateMac : | 22 class ConstrainedWebDialogDelegateMac : |
| 21 public ConstrainedWindowMacDelegateCustomSheet, | 23 public ConstrainedWindowMacDelegateCustomSheet, |
| 22 public ConstrainedWebDialogDelegate { | 24 public ConstrainedWebDialogDelegate { |
| 23 | 25 |
| 24 public: | 26 public: |
| 25 ConstrainedWebDialogDelegateMac( | 27 ConstrainedWebDialogDelegateMac( |
| 26 Profile* profile, | 28 Profile* profile, |
| 27 WebDialogDelegate* delegate, | 29 WebDialogDelegate* delegate, |
| 28 WebDialogWebContentsDelegate* tab_delegate); | 30 WebDialogWebContentsDelegate* tab_delegate); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 [window.get() setContentView:tab()->web_contents()->GetNativeView()]; | 109 [window.get() setContentView:tab()->web_contents()->GetNativeView()]; |
| 108 | 110 |
| 109 // Set the custom sheet to point to the new window. | 111 // Set the custom sheet to point to the new window. |
| 110 ConstrainedWindowMacDelegateCustomSheet::init( | 112 ConstrainedWindowMacDelegateCustomSheet::init( |
| 111 window.get(), | 113 window.get(), |
| 112 [[[ConstrainedWebDialogSheetCocoa alloc] | 114 [[[ConstrainedWebDialogSheetCocoa alloc] |
| 113 initWithConstrainedWebDialogDelegateMac:this] autorelease], | 115 initWithConstrainedWebDialogDelegateMac:this] autorelease], |
| 114 @selector(sheetDidEnd:returnCode:contextInfo:)); | 116 @selector(sheetDidEnd:returnCode:contextInfo:)); |
| 115 } | 117 } |
| 116 | 118 |
| 117 // static | 119 ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( |
| 118 ConstrainedWebDialogDelegate* | |
| 119 ConstrainedWebDialogUI::CreateConstrainedWebDialog( | |
| 120 Profile* profile, | 120 Profile* profile, |
| 121 WebDialogDelegate* delegate, | 121 WebDialogDelegate* delegate, |
| 122 WebDialogWebContentsDelegate* tab_delegate, | 122 WebDialogWebContentsDelegate* tab_delegate, |
| 123 TabContentsWrapper* wrapper) { | 123 TabContentsWrapper* wrapper) { |
| 124 // Deleted when ConstrainedWebDialogDelegateMac::DeleteDelegate() runs. | 124 // Deleted when ConstrainedWebDialogDelegateMac::DeleteDelegate() runs. |
| 125 ConstrainedWebDialogDelegateMac* constrained_delegate = | 125 ConstrainedWebDialogDelegateMac* constrained_delegate = |
| 126 new ConstrainedWebDialogDelegateMac(profile, delegate, tab_delegate); | 126 new ConstrainedWebDialogDelegateMac(profile, delegate, tab_delegate); |
| 127 // Deleted when ConstrainedWebDialogDelegateMac::OnDialogCloseFromWebUI() | 127 // Deleted when ConstrainedWebDialogDelegateMac::OnDialogCloseFromWebUI() |
| 128 // runs. | 128 // runs. |
| 129 ConstrainedWindow* constrained_window = | 129 ConstrainedWindow* constrained_window = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 141 return self; | 141 return self; |
| 142 } | 142 } |
| 143 | 143 |
| 144 - (void)sheetDidEnd:(NSWindow*)sheet | 144 - (void)sheetDidEnd:(NSWindow*)sheet |
| 145 returnCode:(int)returnCode | 145 returnCode:(int)returnCode |
| 146 contextInfo:(void *)contextInfo { | 146 contextInfo:(void *)contextInfo { |
| 147 [sheet orderOut:self]; | 147 [sheet orderOut:self]; |
| 148 } | 148 } |
| 149 | 149 |
| 150 @end | 150 @end |
| OLD | NEW |