From 7d886d12386ee44f2afd10ec47304135d0c4192b Mon Sep 17 00:00:00 2001 From: "pinkerton@chromium.org" Date: Thu, 5 Feb 2009 21:04:46 +0000 Subject: Hook up tab close menu item and plumb tab closing scaffolding through UI layer on Mac. Fix several unregistered prefs issues from other checkins. Review URL: http://codereview.chromium.org/21092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9250 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/temp_scaffolding_stubs.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'chrome/common/temp_scaffolding_stubs.cc') diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index d652dee..d050cb7 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -184,6 +184,33 @@ Profile* TabContents::profile() const { return controller_ ? controller_->profile() : NULL; } +void TabContents::CloseContents() { + // Destroy our NavigationController, which will Destroy all tabs it owns. + controller_->Destroy(); + // Note that the controller may have deleted us at this point, + // so don't touch any member variables here. +} + +void TabContents::Destroy() { + // TODO(pinkerton): this isn't the real version of Destroy(), just enough to + // get the scaffolding working. + + // Notify any observer that have a reference on this tab contents. + NotificationService::current()->Notify( + NotificationType::TAB_CONTENTS_DESTROYED, + Source(this), + NotificationService::NoDetails()); + + // Notify our NavigationController. Make sure we are deleted first, so + // that the controller is the last to die. + NavigationController* controller = controller_; + TabContentsType type = this->type(); + + delete this; + + controller->TabContentsWasDestroyed(type); +} + //-------------------------------------------------------------------------- class RenderWidgetHostViewStub : public RenderWidgetHostView { -- cgit v1.1