diff options
author | laforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-02 14:57:07 +0000 |
---|---|---|
committer | laforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-02 14:57:07 +0000 |
commit | 4011106e247759fffcae703dacfca48f519413b9 (patch) | |
tree | 624f34422f290cce7b7535e740bc7e4ab49aa725 | |
parent | 1f297a62f3eeccdf8e727f2da721e865eb402510 (diff) | |
download | chromium_src-4011106e247759fffcae703dacfca48f519413b9.zip chromium_src-4011106e247759fffcae703dacfca48f519413b9.tar.gz chromium_src-4011106e247759fffcae703dacfca48f519413b9.tar.bz2 |
Revert 108233 - Merge 107841 - Fix a crash in FullscreenExitBubbleController when the user clicks the "Exit full screen" button.
The crash was due to the fact that Browser::OnDenyFullscreenPermission causes BrowserWindow::ExitFullscreen to be called, which causes the FullscreenExitBubbleController to be destroyed. [FullscreenExitBubbleController deny:] was sending a -hideSoon message to its zombie self following the call to Browser::OnDenyFullscreenPermission.
BUG=101835
TEST=The browser doesn't crash when you click "Exit full screen" on a fullscreened page.
Review URL: http://codereview.chromium.org/8399017
TBR=jeremya@chromium.org
Review URL: http://codereview.chromium.org/8439030
TBR=cevans@chromium.org
Review URL: http://codereview.chromium.org/8440041
git-svn-id: svn://svn.chromium.org/chrome/branches/912/src@108290 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 6 insertions, 64 deletions
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index cd5f307..8b32925 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -851,8 +851,6 @@ class Browser : public TabHandlerDelegate, FRIEND_TEST_ALL_PREFIXES(BrowserTest, TestTabExitsItselfFromFullscreen); FRIEND_TEST_ALL_PREFIXES(BrowserTest, TestFullscreenBubbleMouseLockState); FRIEND_TEST_ALL_PREFIXES(BrowserTest, TabEntersPresentationModeFromWindowed); - FRIEND_TEST_ALL_PREFIXES(FullscreenExitBubbleControllerTest, - DenyExitsFullscreen); FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutNoPref); FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutWindowPref); FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutTabPref); diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h index 58e3856..cf77b7d 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.h +++ b/chrome/browser/ui/cocoa/browser_window_controller.h @@ -460,9 +460,6 @@ class TabContents; // |source| rect doesn't fit into |target|. - (NSSize)overflowFrom:(NSRect)source to:(NSRect)target; - -// The fullscreen exit bubble controller, or nil if the bubble isn't showing. -- (FullscreenExitBubbleController*)fullscreenExitBubbleController; @end // @interface BrowserWindowController (TestingAPI) diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 548d61f..7dda52f2 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -1856,11 +1856,6 @@ willAnimateFromState:(bookmarks::VisualState)oldState return NSMakeSize(x, y); } -// (Private/TestingAPI) -- (FullscreenExitBubbleController*)fullscreenExitBubbleController { - return fullscreenExitBubbleController_.get(); -} - - (void)showInstant:(TabContents*)previewContents { [previewableContentsController_ showPreview:previewContents]; [self updateBookmarkBarVisibilityWithAnimation:NO]; diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm index fade662..bdbfcd2 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm @@ -93,6 +93,7 @@ const float kHideDuration = 0.7; - (void)deny:(id)sender { DCHECK(fullscreen_bubble::ShowButtonsForType(bubbleType_)); browser_->OnDenyFullscreenPermission(bubbleType_); + [self hideSoon]; } - (void)showButtons:(BOOL)show { diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm index 65e3e93..6a293e2 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm @@ -4,14 +4,7 @@ #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/cocoa/browser_window_controller.h" -#include "chrome/browser/ui/cocoa/cocoa_profile_test.h" -#include "chrome/browser/tabs/tab_strip_model.h" -#include "chrome/common/chrome_notification_types.h" -#include "chrome/test/base/ui_test_utils.h" -#include "content/browser/site_instance.h" +#include "chrome/browser/ui/cocoa/cocoa_test_helper.h" #include "testing/gtest_mac.h" #include "ui/base/models/accelerator_cocoa.h" @@ -36,16 +29,14 @@ } @end -class FullscreenExitBubbleControllerTest : public CocoaProfileTest { +class FullscreenExitBubbleControllerTest : public CocoaTest { public: virtual void SetUp() { - CocoaProfileTest::SetUp(); - ASSERT_TRUE(profile()); + CocoaTest::SetUp(); - site_instance_ = SiteInstance::CreateSiteInstance(profile()); controller_.reset( [[FullscreenExitBubbleController alloc] initWithOwner:nil - browser:browser() + browser:nil url:GURL() bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]); EXPECT_TRUE([controller_ window]); @@ -54,52 +45,12 @@ class FullscreenExitBubbleControllerTest : public CocoaProfileTest { virtual void TearDown() { [controller_ close]; controller_.reset(); - CocoaProfileTest::TearDown(); + CocoaTest::TearDown(); } - void AppendTabToStrip() { - TabContentsWrapper* tab_contents = Browser::TabContentsFactory( - profile(), site_instance_, MSG_ROUTING_NONE, - NULL, NULL); - browser()->tabstrip_model()->AppendTabContents( - tab_contents, /*foreground=*/true); - } - - scoped_refptr<SiteInstance> site_instance_; scoped_nsobject<FullscreenExitBubbleController> controller_; }; -TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { - CreateBrowserWindow(); - AppendTabToStrip(); - TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); - { - base::mac::ScopedNSAutoreleasePool pool; - ui_test_utils::WindowedNotificationObserver fullscreen_observer( - chrome::NOTIFICATION_FULLSCREEN_CHANGED, - content::NotificationService::AllSources()); - browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); - fullscreen_observer.Wait(); - ASSERT_TRUE(browser()->window()->IsFullscreen()); - } - - NSWindow* window = browser()->window()->GetNativeHandle(); - BrowserWindowController* bwc = [BrowserWindowController - browserWindowControllerForWindow:window]; - FullscreenExitBubbleController* bubble = [bwc fullscreenExitBubbleController]; - ASSERT_TRUE(bubble); - { - ui_test_utils::WindowedNotificationObserver fullscreen_observer( - chrome::NOTIFICATION_FULLSCREEN_CHANGED, - content::NotificationService::AllSources()); - [bubble deny:nil]; - fullscreen_observer.Wait(); - } - EXPECT_FALSE([bwc fullscreenExitBubbleController]); - EXPECT_FALSE(browser()->window()->IsFullscreen()); - CloseBrowserWindow(); -} - TEST_F(FullscreenExitBubbleControllerTest, LabelWasReplaced) { EXPECT_FALSE([controller_ exitLabelPlaceholder]); EXPECT_TRUE([controller_ exitLabel]); |