| 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" | |
| 10 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 11 #import "chrome/browser/ui/browser_dialogs.h" | 10 #import "chrome/browser/ui/browser_dialogs.h" |
| 12 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 11 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
| 13 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 12 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 15 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 14 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 16 #include "content/public/browser/native_web_keyboard_event.h" | 15 #include "content/public/browser/native_web_keyboard_event.h" |
| 17 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/browser/web_ui_message_handler.h" | 17 #include "content/public/browser/web_ui_message_handler.h" |
| 19 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 338 |
| 340 - (void)loadDialogContents { | 339 - (void)loadDialogContents { |
| 341 tabContents_.reset(new TabContents(WebContents::Create( | 340 tabContents_.reset(new TabContents(WebContents::Create( |
| 342 delegate_->browser_context(), NULL, MSG_ROUTING_NONE, NULL))); | 341 delegate_->browser_context(), NULL, MSG_ROUTING_NONE, NULL))); |
| 343 [[self window] | 342 [[self window] |
| 344 setContentView:tabContents_->web_contents()->GetNativeView()]; | 343 setContentView:tabContents_->web_contents()->GetNativeView()]; |
| 345 tabContents_->web_contents()->SetDelegate(delegate_.get()); | 344 tabContents_->web_contents()->SetDelegate(delegate_.get()); |
| 346 | 345 |
| 347 // This must be done before loading the page; see the comments in | 346 // This must be done before loading the page; see the comments in |
| 348 // WebDialogUI. | 347 // WebDialogUI. |
| 349 WebDialogUI::GetPropertyAccessor().SetProperty( | 348 WebDialogUI::SetDelegate(tabContents_->web_contents(), delegate_.get()); |
| 350 tabContents_->web_contents()->GetPropertyBag(), delegate_.get()); | |
| 351 | 349 |
| 352 tabContents_->web_contents()->GetController().LoadURL( | 350 tabContents_->web_contents()->GetController().LoadURL( |
| 353 delegate_->GetDialogContentURL(), | 351 delegate_->GetDialogContentURL(), |
| 354 content::Referrer(), | 352 content::Referrer(), |
| 355 content::PAGE_TRANSITION_START_PAGE, | 353 content::PAGE_TRANSITION_START_PAGE, |
| 356 std::string()); | 354 std::string()); |
| 357 | 355 |
| 358 // TODO(akalin): add accelerator for ESC to close the dialog box. | 356 // TODO(akalin): add accelerator for ESC to close the dialog box. |
| 359 // | 357 // |
| 360 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 358 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 361 // to do the above doesn't work. | 359 // to do the above doesn't work. |
| 362 } | 360 } |
| 363 | 361 |
| 364 - (void)windowWillClose:(NSNotification*)notification { | 362 - (void)windowWillClose:(NSNotification*)notification { |
| 365 delegate_->WindowControllerClosed(); | 363 delegate_->WindowControllerClosed(); |
| 366 [self autorelease]; | 364 [self autorelease]; |
| 367 } | 365 } |
| 368 | 366 |
| 369 @end | 367 @end |
| OLD | NEW |