OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/html_dialog_window_controller.h" | 5 #import "chrome/browser/cocoa/html_dialog_window_controller.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 258 } |
259 [window setWindowController:self]; | 259 [window setWindowController:self]; |
260 [window setDelegate:self]; | 260 [window setDelegate:self]; |
261 [window setTitle:base::SysWideToNSString(delegate->GetDialogTitle())]; | 261 [window setTitle:base::SysWideToNSString(delegate->GetDialogTitle())]; |
262 [window center]; | 262 [window center]; |
263 delegate_.reset(new HtmlDialogWindowDelegateBridge(self, profile, delegate)); | 263 delegate_.reset(new HtmlDialogWindowDelegateBridge(self, profile, delegate)); |
264 return self; | 264 return self; |
265 } | 265 } |
266 | 266 |
267 - (void)loadDialogContents { | 267 - (void)loadDialogContents { |
268 tabContents_.reset( | 268 tabContents_.reset(new TabContents( |
269 new TabContents(delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL)); | 269 delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)); |
270 [[self window] setContentView:tabContents_->GetNativeView()]; | 270 [[self window] setContentView:tabContents_->GetNativeView()]; |
271 tabContents_->set_delegate(delegate_.get()); | 271 tabContents_->set_delegate(delegate_.get()); |
272 | 272 |
273 // This must be done before loading the page; see the comments in | 273 // This must be done before loading the page; see the comments in |
274 // HtmlDialogUI. | 274 // HtmlDialogUI. |
275 HtmlDialogUI::GetPropertyAccessor().SetProperty(tabContents_->property_bag(), | 275 HtmlDialogUI::GetPropertyAccessor().SetProperty(tabContents_->property_bag(), |
276 delegate_.get()); | 276 delegate_.get()); |
277 | 277 |
278 tabContents_->controller().LoadURL(delegate_->GetDialogContentURL(), | 278 tabContents_->controller().LoadURL(delegate_->GetDialogContentURL(), |
279 GURL(), PageTransition::START_PAGE); | 279 GURL(), PageTransition::START_PAGE); |
280 | 280 |
281 // TODO(akalin): add accelerator for ESC to close the dialog box. | 281 // TODO(akalin): add accelerator for ESC to close the dialog box. |
282 // | 282 // |
283 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 283 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
284 // to do the above doesn't work. | 284 // to do the above doesn't work. |
285 } | 285 } |
286 | 286 |
287 - (void)windowWillClose:(NSNotification*)notification { | 287 - (void)windowWillClose:(NSNotification*)notification { |
288 delegate_->WindowControllerClosed(); | 288 delegate_->WindowControllerClosed(); |
289 [self autorelease]; | 289 [self autorelease]; |
290 } | 290 } |
291 | 291 |
292 @end | 292 @end |
OLD | NEW |