| 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 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/web_dialog_window_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
| 9 #include "base/property_bag.h" | 9 #include "base/property_bag.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())]; | 332 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())]; |
| 333 [window setMinSize:dialogRect.size]; | 333 [window setMinSize:dialogRect.size]; |
| 334 [window center]; | 334 [window center]; |
| 335 delegate_.reset( | 335 delegate_.reset( |
| 336 new WebDialogWindowDelegateBridge(self, context, delegate)); | 336 new WebDialogWindowDelegateBridge(self, context, delegate)); |
| 337 return self; | 337 return self; |
| 338 } | 338 } |
| 339 | 339 |
| 340 - (void)loadDialogContents { | 340 - (void)loadDialogContents { |
| 341 tabContents_.reset(new TabContents(WebContents::Create( | 341 tabContents_.reset(new TabContents(WebContents::Create( |
| 342 delegate_->browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL))); | 342 delegate_->browser_context(), NULL, MSG_ROUTING_NONE, NULL))); |
| 343 [[self window] | 343 [[self window] |
| 344 setContentView:tabContents_->web_contents()->GetNativeView()]; | 344 setContentView:tabContents_->web_contents()->GetNativeView()]; |
| 345 tabContents_->web_contents()->SetDelegate(delegate_.get()); | 345 tabContents_->web_contents()->SetDelegate(delegate_.get()); |
| 346 | 346 |
| 347 // This must be done before loading the page; see the comments in | 347 // This must be done before loading the page; see the comments in |
| 348 // WebDialogUI. | 348 // WebDialogUI. |
| 349 WebDialogUI::GetPropertyAccessor().SetProperty( | 349 WebDialogUI::GetPropertyAccessor().SetProperty( |
| 350 tabContents_->web_contents()->GetPropertyBag(), delegate_.get()); | 350 tabContents_->web_contents()->GetPropertyBag(), delegate_.get()); |
| 351 | 351 |
| 352 tabContents_->web_contents()->GetController().LoadURL( | 352 tabContents_->web_contents()->GetController().LoadURL( |
| 353 delegate_->GetDialogContentURL(), | 353 delegate_->GetDialogContentURL(), |
| 354 content::Referrer(), | 354 content::Referrer(), |
| 355 content::PAGE_TRANSITION_START_PAGE, | 355 content::PAGE_TRANSITION_START_PAGE, |
| 356 std::string()); | 356 std::string()); |
| 357 | 357 |
| 358 // TODO(akalin): add accelerator for ESC to close the dialog box. | 358 // TODO(akalin): add accelerator for ESC to close the dialog box. |
| 359 // | 359 // |
| 360 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 360 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 361 // to do the above doesn't work. | 361 // to do the above doesn't work. |
| 362 } | 362 } |
| 363 | 363 |
| 364 - (void)windowWillClose:(NSNotification*)notification { | 364 - (void)windowWillClose:(NSNotification*)notification { |
| 365 delegate_->WindowControllerClosed(); | 365 delegate_->WindowControllerClosed(); |
| 366 [self autorelease]; | 366 [self autorelease]; |
| 367 } | 367 } |
| 368 | 368 |
| 369 @end | 369 @end |
| OLD | NEW |