| 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 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE { | 40 virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE { |
| 41 return impl_->GetWebDialogDelegate(); | 41 return impl_->GetWebDialogDelegate(); |
| 42 } | 42 } |
| 43 virtual void OnDialogCloseFromWebUI() OVERRIDE { | 43 virtual void OnDialogCloseFromWebUI() OVERRIDE { |
| 44 return impl_->OnDialogCloseFromWebUI(); | 44 return impl_->OnDialogCloseFromWebUI(); |
| 45 } | 45 } |
| 46 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE { | 46 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE { |
| 47 return impl_->ReleaseWebContentsOnDialogClose(); | 47 return impl_->ReleaseWebContentsOnDialogClose(); |
| 48 } | 48 } |
| 49 virtual WebContentsModalDialog* GetWindow() OVERRIDE { | 49 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE { |
| 50 return impl_->GetWindow(); | 50 return impl_->GetNativeWindow(); |
| 51 } | 51 } |
| 52 virtual WebContents* GetWebContents() OVERRIDE { | 52 virtual WebContents* GetWebContents() OVERRIDE { |
| 53 return impl_->GetWebContents(); | 53 return impl_->GetWebContents(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // ConstrainedWindowMacDelegate interface | 56 // ConstrainedWindowMacDelegate interface |
| 57 virtual void OnConstrainedWindowClosed( | 57 virtual void OnConstrainedWindowClosed( |
| 58 ConstrainedWindowMac* window) OVERRIDE { | 58 ConstrainedWindowMac* window) OVERRIDE { |
| 59 if (!impl_->closed_via_webui()) | 59 if (!impl_->closed_via_webui()) |
| 60 GetWebDialogDelegate()->OnDialogClosed(""); | 60 GetWebDialogDelegate()->OnDialogClosed(""); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 85 window_.reset( | 85 window_.reset( |
| 86 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]); | 86 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]); |
| 87 [GetWebContents()->GetNativeView() setFrame:frame]; | 87 [GetWebContents()->GetNativeView() setFrame:frame]; |
| 88 [[window_ contentView] addSubview:GetWebContents()->GetNativeView()]; | 88 [[window_ contentView] addSubview:GetWebContents()->GetNativeView()]; |
| 89 | 89 |
| 90 scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 90 scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
| 91 [[CustomConstrainedWindowSheet alloc] | 91 [[CustomConstrainedWindowSheet alloc] |
| 92 initWithCustomWindow:window_]); | 92 initWithCustomWindow:window_]); |
| 93 constrained_window_.reset(new ConstrainedWindowMac( | 93 constrained_window_.reset(new ConstrainedWindowMac( |
| 94 this, web_contents, sheet)); | 94 this, web_contents, sheet)); |
| 95 return impl_->set_window(constrained_window_.get()); | |
| 96 } | 95 } |
| 97 | 96 |
| 98 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( | 97 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( |
| 99 content::BrowserContext* browser_context, | 98 content::BrowserContext* browser_context, |
| 100 WebDialogDelegate* delegate, | 99 WebDialogDelegate* delegate, |
| 101 WebDialogWebContentsDelegate* tab_delegate, | 100 WebDialogWebContentsDelegate* tab_delegate, |
| 102 content::WebContents* web_contents) { | 101 content::WebContents* web_contents) { |
| 103 // Deleted when the dialog closes. | 102 // Deleted when the dialog closes. |
| 104 ConstrainedWebDialogDelegateMac* constrained_delegate = | 103 ConstrainedWebDialogDelegateMac* constrained_delegate = |
| 105 new ConstrainedWebDialogDelegateMac( | 104 new ConstrainedWebDialogDelegateMac( |
| 106 browser_context, delegate, tab_delegate, web_contents); | 105 browser_context, delegate, tab_delegate, web_contents); |
| 107 return constrained_delegate; | 106 return constrained_delegate; |
| 108 } | 107 } |
| OLD | NEW |