summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabodenha@chromium.org <abodenha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-19 23:24:34 +0000
committerabodenha@chromium.org <abodenha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-19 23:24:34 +0000
commitecb9f4015041b18e4aa1c97c2529bff54ed44b82 (patch)
treec58bbbbf766f84adcec91168745538c92c761759
parent2282bd59af40ed835d48df67557aa1e9a80f22e3 (diff)
downloadchromium_src-ecb9f4015041b18e4aa1c97c2529bff54ed44b82.zip
chromium_src-ecb9f4015041b18e4aa1c97c2529bff54ed44b82.tar.gz
chromium_src-ecb9f4015041b18e4aa1c97c2529bff54ed44b82.tar.bz2
Fix crash in cloud print dialog on Mac.
Use TabContentsWrapper in the Mac version of html dialogs instead of using TabContents directly like on Windows and Linux. BUG=107437 TEST= Review URL: http://codereview.chromium.org/8980004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115038 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/html_dialog_window_controller.h4
-rw-r--r--chrome/browser/ui/cocoa/html_dialog_window_controller.mm17
2 files changed, 12 insertions, 9 deletions
diff --git a/chrome/browser/ui/cocoa/html_dialog_window_controller.h b/chrome/browser/ui/cocoa/html_dialog_window_controller.h
index c0a1d6e..2ba46a5 100644
--- a/chrome/browser/ui/cocoa/html_dialog_window_controller.h
+++ b/chrome/browser/ui/cocoa/html_dialog_window_controller.h
@@ -15,7 +15,7 @@
class HtmlDialogWindowDelegateBridge;
class Profile;
-class TabContents;
+class TabContentsWrapper;
// This controller manages a dialog box with properties and HTML content taken
// from a HTMLDialogUIDelegate object.
@@ -24,7 +24,7 @@ class TabContents;
// Order here is important, as tab_contents_ may send messages to
// delegate_ when it gets destroyed.
scoped_ptr<HtmlDialogWindowDelegateBridge> delegate_;
- scoped_ptr<TabContents> tabContents_;
+ scoped_ptr<TabContentsWrapper> contentsWrapper_;
}
// Creates and shows an HtmlDialogWindowController with the given
diff --git a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm
index 1849744..46e491e 100644
--- a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm
+++ b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm
@@ -12,6 +12,7 @@
#import "chrome/browser/ui/cocoa/browser_command_executor.h"
#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
#include "chrome/browser/ui/dialog_style.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h"
#include "chrome/browser/ui/webui/html_dialog_ui.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -286,17 +287,19 @@ void HtmlDialogWindowDelegateBridge::HandleKeyboardEvent(
}
- (void)loadDialogContents {
- tabContents_.reset(new TabContents(
- delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL));
- [[self window] setContentView:tabContents_->GetNativeView()];
- tabContents_->set_delegate(delegate_.get());
+ contentsWrapper_.reset(new TabContentsWrapper(new TabContents(
+ delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)));
+ [[self window]
+ setContentView:contentsWrapper_->tab_contents()->GetNativeView()];
+ contentsWrapper_->tab_contents()->set_delegate(delegate_.get());
// This must be done before loading the page; see the comments in
// HtmlDialogUI.
- HtmlDialogUI::GetPropertyAccessor().SetProperty(tabContents_->property_bag(),
- delegate_.get());
+ HtmlDialogUI::GetPropertyAccessor().SetProperty(
+ contentsWrapper_->tab_contents()->property_bag(), delegate_.get());
- tabContents_->controller().LoadURL(delegate_->GetDialogContentURL(),
+ contentsWrapper_->tab_contents()->controller().LoadURL(
+ delegate_->GetDialogContentURL(),
content::Referrer(),
content::PAGE_TRANSITION_START_PAGE,
std::string());