| 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/mac/scoped_nsobject.h" | 9 #include "base/mac/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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 void OnDialogCloseFromWebUI() override { | 69 void OnDialogCloseFromWebUI() override { |
| 70 return impl_->OnDialogCloseFromWebUI(); | 70 return impl_->OnDialogCloseFromWebUI(); |
| 71 } | 71 } |
| 72 void ReleaseWebContentsOnDialogClose() override { | 72 void ReleaseWebContentsOnDialogClose() override { |
| 73 return impl_->ReleaseWebContentsOnDialogClose(); | 73 return impl_->ReleaseWebContentsOnDialogClose(); |
| 74 } | 74 } |
| 75 NativeWebContentsModalDialog GetNativeDialog() override { | 75 NativeWebContentsModalDialog GetNativeDialog() override { |
| 76 return constrained_window_->GetNativeDialog(); | 76 return constrained_window_->GetNativeDialog(); |
| 77 } | 77 } |
| 78 WebContents* GetWebContents() override { return impl_->GetWebContents(); } | 78 WebContents* GetWebContents() override { return impl_->GetWebContents(); } |
| 79 gfx::Size GetMinimumSize() const override { |
| 80 NOTIMPLEMENTED(); |
| 81 return gfx::Size(); |
| 82 } |
| 83 gfx::Size GetMaximumSize() const override { |
| 84 NOTIMPLEMENTED(); |
| 85 return gfx::Size(); |
| 86 } |
| 87 gfx::Size GetPreferredSize() const override { |
| 88 NOTIMPLEMENTED(); |
| 89 return gfx::Size(); |
| 90 } |
| 79 | 91 |
| 80 // ConstrainedWindowMacDelegate interface | 92 // ConstrainedWindowMacDelegate interface |
| 81 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override { | 93 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override { |
| 82 if (!impl_->closed_via_webui()) | 94 if (!impl_->closed_via_webui()) |
| 83 GetWebDialogDelegate()->OnDialogClosed(""); | 95 GetWebDialogDelegate()->OnDialogClosed(""); |
| 84 delete this; | 96 delete this; |
| 85 } | 97 } |
| 86 | 98 |
| 87 private: | 99 private: |
| 88 scoped_ptr<ConstrainedWebDialogDelegateMac> impl_; | 100 scoped_ptr<ConstrainedWebDialogDelegateMac> impl_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 108 [[window_ contentView] addSubview:GetWebContents()->GetNativeView()]; | 120 [[window_ contentView] addSubview:GetWebContents()->GetNativeView()]; |
| 109 | 121 |
| 110 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 122 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
| 111 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window_]); | 123 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window_]); |
| 112 constrained_window_.reset(new ConstrainedWindowMac( | 124 constrained_window_.reset(new ConstrainedWindowMac( |
| 113 this, web_contents, sheet)); | 125 this, web_contents, sheet)); |
| 114 | 126 |
| 115 impl_->set_window(constrained_window_.get()); | 127 impl_->set_window(constrained_window_.get()); |
| 116 } | 128 } |
| 117 | 129 |
| 118 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( | 130 ConstrainedWebDialogDelegate* ShowConstrainedWebDialog( |
| 119 content::BrowserContext* browser_context, | 131 content::BrowserContext* browser_context, |
| 120 WebDialogDelegate* delegate, | 132 WebDialogDelegate* delegate, |
| 121 content::WebContents* web_contents) { | 133 content::WebContents* web_contents) { |
| 122 // Deleted when the dialog closes. | 134 // Deleted when the dialog closes. |
| 123 ConstrainedWebDialogDelegateViewMac* constrained_delegate = | 135 ConstrainedWebDialogDelegateViewMac* constrained_delegate = |
| 124 new ConstrainedWebDialogDelegateViewMac( | 136 new ConstrainedWebDialogDelegateViewMac( |
| 125 browser_context, delegate, web_contents); | 137 browser_context, delegate, web_contents); |
| 126 return constrained_delegate; | 138 return constrained_delegate; |
| 127 } | 139 } |
| OLD | NEW |