Commit 4e87fae1 authored by sergeyu's avatar sergeyu Committed by Commit bot

Revert of Fix docked browser window sometimes appears onscreen after restart...

Revert of Fix docked browser window sometimes appears onscreen after restart (patchset #1 id:1 of https://codereview.chromium.org/1055893003/)

Reason for revert:
Broke BrowserWindowCocoaTest.TestMinimizeState on 10.6: https://build.chromium.org/p/chromium.mac/builders/Mac10.6%20Tests/builds/762

Original issue's description:
> Change IsMaximized() to return false if the window is in the dock, and
> a unit test to make sure this is always the case. It turns out
> -isZoomed can sometimes return YES for a docked window, which
> sometimes results in the window becoming undocked on the next restart.
> Please read the long entry in the bug report for a complete explanation
> of how the change fixes the problem.
>
> BUG=452976
>
> Committed: https://crrev.com/de8b6d82a032a4bde620e43e6c580850871d59d8
> Cr-Commit-Position: refs/heads/master@{#323928}

TBR=avi@chromium.org,shrike@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=452976

Review URL: https://codereview.chromium.org/1061103003

Cr-Commit-Position: refs/heads/master@{#323961}
parent 0ca23022
...@@ -363,10 +363,7 @@ gfx::Rect BrowserWindowCocoa::GetBounds() const { ...@@ -363,10 +363,7 @@ gfx::Rect BrowserWindowCocoa::GetBounds() const {
} }
bool BrowserWindowCocoa::IsMaximized() const { bool BrowserWindowCocoa::IsMaximized() const {
// -isZoomed returns YES if the window's frame equals the rect returned by return [window() isZoomed];
// -windowWillUseStandardFrame:defaultFrame:, even if the window is in the
// dock, so have to explicitly check for miniaturization state first.
return ![window() isMiniaturized] && [window() isZoomed];
} }
bool BrowserWindowCocoa::IsMinimized() const { bool BrowserWindowCocoa::IsMinimized() const {
......
...@@ -48,24 +48,6 @@ TEST_F(BrowserWindowCocoaTest, TestBookmarkBarVisible) { ...@@ -48,24 +48,6 @@ TEST_F(BrowserWindowCocoaTest, TestBookmarkBarVisible) {
EXPECT_EQ(before, bwc->IsBookmarkBarVisible()); EXPECT_EQ(before, bwc->IsBookmarkBarVisible());
} }
// Test that IsMaximized() returns false when the browser window goes from
// maximized to minimized state - http://crbug/452976.
TEST_F(BrowserWindowCocoaTest, TestMinimizeState) {
scoped_ptr<BrowserWindowCocoa> bwc(
new BrowserWindowCocoa(browser(), controller_));
EXPECT_FALSE(bwc->IsMinimized());
bwc->Maximize();
EXPECT_TRUE(bwc->IsMaximized());
EXPECT_FALSE(bwc->IsMinimized());
bwc->Minimize();
EXPECT_FALSE(bwc->IsMaximized());
EXPECT_TRUE(bwc->IsMinimized());
bwc->Restore();
EXPECT_TRUE(bwc->IsMaximized());
EXPECT_FALSE(bwc->IsMinimized());
}
// Tests that BrowserWindowCocoa::Close mimics the behavior of // Tests that BrowserWindowCocoa::Close mimics the behavior of
// -[NSWindow performClose:]. // -[NSWindow performClose:].
class BrowserWindowCocoaCloseTest : public CocoaProfileTest { class BrowserWindowCocoaCloseTest : public CocoaProfileTest {
......
...@@ -727,8 +727,6 @@ using content::WebContents; ...@@ -727,8 +727,6 @@ using content::WebContents;
// browsers' behaviour, and is desirable in multi-tab situations. Note, however, // browsers' behaviour, and is desirable in multi-tab situations. Note, however,
// that the "toggle" behaviour means that the window can still be "unzoomed" to // that the "toggle" behaviour means that the window can still be "unzoomed" to
// the user size. // the user size.
// Note: this method is also called from -isZoomed. If the returned zoomed rect
// equals the current window's frame, -isZoomed returns YES.
- (NSRect)windowWillUseStandardFrame:(NSWindow*)window - (NSRect)windowWillUseStandardFrame:(NSWindow*)window
defaultFrame:(NSRect)frame { defaultFrame:(NSRect)frame {
// Forget that we grew the window up (if we in fact did). // Forget that we grew the window up (if we in fact did).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment