Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm

Issue 10534093: TabContentsWrapper -> TabContents, part 37. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h"
12 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" 12 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "ui/web_dialogs/web_dialog_delegate.h" 15 #include "ui/web_dialogs/web_dialog_delegate.h"
16 #include "ui/web_dialogs/web_dialog_ui.h" 16 #include "ui/web_dialogs/web_dialog_ui.h"
17 17
18 using content::WebContents; 18 using content::WebContents;
19 using ui::WebDialogDelegate; 19 using ui::WebDialogDelegate;
20 using ui::ConstrainedWebDialogDelegate; 20 using ui::ConstrainedWebDialogDelegate;
21 21
(...skipping 22 matching lines...) Expand all
44 } 44 }
45 virtual void OnDialogCloseFromWebUI() OVERRIDE { 45 virtual void OnDialogCloseFromWebUI() OVERRIDE {
46 return impl_->OnDialogCloseFromWebUI(); 46 return impl_->OnDialogCloseFromWebUI();
47 } 47 }
48 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE { 48 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE {
49 return impl_->ReleaseTabContentsOnDialogClose(); 49 return impl_->ReleaseTabContentsOnDialogClose();
50 } 50 }
51 virtual ConstrainedWindow* window() OVERRIDE { 51 virtual ConstrainedWindow* window() OVERRIDE {
52 return impl_->window(); 52 return impl_->window();
53 } 53 }
54 virtual TabContentsWrapper* tab() OVERRIDE { 54 virtual TabContents* tab() OVERRIDE {
55 return impl_->tab(); 55 return impl_->tab();
56 } 56 }
57 57
58 // ConstrainedWindowMacDelegateCustomSheet interface 58 // ConstrainedWindowMacDelegateCustomSheet interface
59 virtual void DeleteDelegate() OVERRIDE { 59 virtual void DeleteDelegate() OVERRIDE {
60 // From ConstrainedWindowMacDelegate: "you MUST close the sheet belonging to 60 // From ConstrainedWindowMacDelegate: "you MUST close the sheet belonging to
61 // your delegate in this method." 61 // your delegate in this method."
62 if (is_sheet_open()) 62 if (is_sheet_open())
63 [NSApp endSheet:sheet()]; 63 [NSApp endSheet:sheet()];
64 if (!impl_->closed_via_webui()) 64 if (!impl_->closed_via_webui())
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 window.get(), 113 window.get(),
114 [[[ConstrainedWebDialogSheetCocoa alloc] 114 [[[ConstrainedWebDialogSheetCocoa alloc]
115 initWithConstrainedWebDialogDelegateMac:this] autorelease], 115 initWithConstrainedWebDialogDelegateMac:this] autorelease],
116 @selector(sheetDidEnd:returnCode:contextInfo:)); 116 @selector(sheetDidEnd:returnCode:contextInfo:));
117 } 117 }
118 118
119 ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( 119 ConstrainedWebDialogDelegate* ui::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 TabContents* tab_contents) {
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 =
130 new ConstrainedWindowMac(wrapper, constrained_delegate); 130 new ConstrainedWindowMac(tab_contents, constrained_delegate);
131 constrained_delegate->set_window(constrained_window); 131 constrained_delegate->set_window(constrained_window);
132 return constrained_delegate; 132 return constrained_delegate;
133 } 133 }
134 134
135 @implementation ConstrainedWebDialogSheetCocoa 135 @implementation ConstrainedWebDialogSheetCocoa
136 136
137 - (id)initWithConstrainedWebDialogDelegateMac: 137 - (id)initWithConstrainedWebDialogDelegateMac:
138 (ConstrainedWebDialogDelegateMac*)ConstrainedWebDialogDelegateMac { 138 (ConstrainedWebDialogDelegateMac*)ConstrainedWebDialogDelegateMac {
139 if ((self = [super init])) 139 if ((self = [super init]))
140 constrainedWebDelegate_ = ConstrainedWebDialogDelegateMac; 140 constrainedWebDelegate_ = ConstrainedWebDialogDelegateMac;
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | chrome/browser/ui/cocoa/constrained_window_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698