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

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

Issue 11358027: Move constrained web dialog code back to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cros fix2 Created 8 years, 1 month 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.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
14 #include "ui/web_dialogs/web_dialog_delegate.h" 14 #include "ui/web_dialogs/web_dialog_delegate.h"
15 #include "ui/web_dialogs/web_dialog_ui.h" 15 #include "ui/web_dialogs/web_dialog_ui.h"
16 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" 16 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
17 17
18 using content::WebContents; 18 using content::WebContents;
19 using ui::ConstrainedWebDialogDelegate;
20 using ui::WebDialogDelegate; 19 using ui::WebDialogDelegate;
21 using ui::WebDialogWebContentsDelegate; 20 using ui::WebDialogWebContentsDelegate;
22 21
23 class ConstrainedWebDialogDelegateMac : 22 class ConstrainedWebDialogDelegateMac :
24 public ConstrainedWindowMacDelegateCustomSheet, 23 public ConstrainedWindowMacDelegateCustomSheet,
25 public ConstrainedWebDialogDelegate { 24 public ConstrainedWebDialogDelegate {
26 25
27 public: 26 public:
28 ConstrainedWebDialogDelegateMac( 27 ConstrainedWebDialogDelegateMac(
29 Profile* profile, 28 Profile* profile,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 [window.get() setContentView:tab()->web_contents()->GetNativeView()]; 109 [window.get() setContentView:tab()->web_contents()->GetNativeView()];
111 110
112 // Set the custom sheet to point to the new window. 111 // Set the custom sheet to point to the new window.
113 ConstrainedWindowMacDelegateCustomSheet::init( 112 ConstrainedWindowMacDelegateCustomSheet::init(
114 window.get(), 113 window.get(),
115 [[[ConstrainedWebDialogSheetCocoa alloc] 114 [[[ConstrainedWebDialogSheetCocoa alloc]
116 initWithConstrainedWebDialogDelegateMac:this] autorelease], 115 initWithConstrainedWebDialogDelegateMac:this] autorelease],
117 @selector(sheetDidEnd:returnCode:contextInfo:)); 116 @selector(sheetDidEnd:returnCode:contextInfo:));
118 } 117 }
119 118
120 ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( 119 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
121 Profile* profile, 120 Profile* profile,
122 WebDialogDelegate* delegate, 121 WebDialogDelegate* delegate,
123 WebDialogWebContentsDelegate* tab_delegate, 122 WebDialogWebContentsDelegate* tab_delegate,
124 TabContents* tab_contents) { 123 content::WebContents* web_contents) {
125 // Deleted when ConstrainedWebDialogDelegateMac::DeleteDelegate() runs. 124 // Deleted when ConstrainedWebDialogDelegateMac::DeleteDelegate() runs.
126 ConstrainedWebDialogDelegateMac* constrained_delegate = 125 ConstrainedWebDialogDelegateMac* constrained_delegate =
127 new ConstrainedWebDialogDelegateMac(profile, delegate, tab_delegate); 126 new ConstrainedWebDialogDelegateMac(profile, delegate, tab_delegate);
128 // Deleted when ConstrainedWebDialogDelegateMac::OnDialogCloseFromWebUI() 127 // Deleted when ConstrainedWebDialogDelegateMac::OnDialogCloseFromWebUI()
129 // runs. 128 // runs.
130 ConstrainedWindow* constrained_window = 129 ConstrainedWindow* constrained_window =
131 new ConstrainedWindowMac(tab_contents->web_contents(), 130 new ConstrainedWindowMac(web_contents, constrained_delegate);
132 constrained_delegate);
133 constrained_delegate->set_window(constrained_window); 131 constrained_delegate->set_window(constrained_window);
134 return constrained_delegate; 132 return constrained_delegate;
135 } 133 }
136 134
137 @implementation ConstrainedWebDialogSheetCocoa 135 @implementation ConstrainedWebDialogSheetCocoa
138 136
139 - (id)initWithConstrainedWebDialogDelegateMac: 137 - (id)initWithConstrainedWebDialogDelegateMac:
140 (ConstrainedWebDialogDelegateMac*)ConstrainedWebDialogDelegateMac { 138 (ConstrainedWebDialogDelegateMac*)ConstrainedWebDialogDelegateMac {
141 if ((self = [super init])) 139 if ((self = [super init]))
142 constrainedWebDelegate_ = ConstrainedWebDialogDelegateMac; 140 constrainedWebDelegate_ = ConstrainedWebDialogDelegateMac;
143 return self; 141 return self;
144 } 142 }
145 143
146 - (void)sheetDidEnd:(NSWindow*)sheet 144 - (void)sheetDidEnd:(NSWindow*)sheet
147 returnCode:(int)returnCode 145 returnCode:(int)returnCode
148 contextInfo:(void *)contextInfo { 146 contextInfo:(void *)contextInfo {
149 [sheet orderOut:self]; 147 [sheet orderOut:self];
150 } 148 }
151 149
152 @end 150 @end
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698