| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 [[self window] orderOut:self]; | 591 [[self window] orderOut:self]; |
| 592 return NO; | 592 return NO; |
| 593 } | 593 } |
| 594 | 594 |
| 595 // the tab strip is empty, it's ok to close the window | 595 // the tab strip is empty, it's ok to close the window |
| 596 return YES; | 596 return YES; |
| 597 } | 597 } |
| 598 | 598 |
| 599 // Called right after our window became the main window. | 599 // Called right after our window became the main window. |
| 600 - (void)windowDidBecomeMain:(NSNotification*)notification { | 600 - (void)windowDidBecomeMain:(NSNotification*)notification { |
| 601 if (chrome::GetLastActiveBrowser() != browser_.get()) { | 601 // if (chrome::GetLastActiveBrowser() != browser_.get()) { |
| 602 BrowserList::SetLastActive(browser_.get()); | 602 BrowserList::SetLastActive(browser_.get()); |
| 603 } | 603 //} |
| 604 // Always saveWindowPositionIfNeeded when becoming main, not just | 604 // Always saveWindowPositionIfNeeded when becoming main, not just |
| 605 // when |browser_| is not the last active browser. See crbug.com/536280 . | 605 // when |browser_| is not the last active browser. See crbug.com/536280 . |
| 606 [self saveWindowPositionIfNeeded]; | 606 [self saveWindowPositionIfNeeded]; |
| 607 | 607 |
| 608 NSView* rootView = [[[self window] contentView] superview]; | 608 NSView* rootView = [[[self window] contentView] superview]; |
| 609 [rootView cr_recursivelyInvokeBlock:^(id view) { | 609 [rootView cr_recursivelyInvokeBlock:^(id view) { |
| 610 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) | 610 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) |
| 611 [view windowDidChangeActive]; | 611 [view windowDidChangeActive]; |
| 612 }]; | 612 }]; |
| 613 | 613 |
| 614 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) | 614 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) |
| 615 ->set_registry_for_active_window(extension_keybinding_registry_.get()); | 615 ->set_registry_for_active_window(extension_keybinding_registry_.get()); |
| 616 } | 616 } |
| 617 | 617 |
| 618 - (void)windowDidResignMain:(NSNotification*)notification { | 618 - (void)windowDidResignMain:(NSNotification*)notification { |
| 619 NSView* rootView = [[[self window] contentView] superview]; | 619 NSView* rootView = [[[self window] contentView] superview]; |
| 620 [rootView cr_recursivelyInvokeBlock:^(id view) { | 620 [rootView cr_recursivelyInvokeBlock:^(id view) { |
| 621 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) | 621 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) |
| 622 [view windowDidChangeActive]; | 622 [view windowDidChangeActive]; |
| 623 }]; | 623 }]; |
| 624 | 624 |
| 625 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) | 625 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) |
| 626 ->set_registry_for_active_window(nullptr); | 626 ->set_registry_for_active_window(nullptr); |
| 627 |
| 628 BrowserList::NotifyBrowserNoLongerActive(browser_.get()); |
| 627 } | 629 } |
| 628 | 630 |
| 629 // Called when we have been minimized. | 631 // Called when we have been minimized. |
| 630 - (void)windowDidMiniaturize:(NSNotification *)notification { | 632 - (void)windowDidMiniaturize:(NSNotification *)notification { |
| 631 [self saveWindowPositionIfNeeded]; | 633 [self saveWindowPositionIfNeeded]; |
| 632 } | 634 } |
| 633 | 635 |
| 634 // Called when we have been unminimized. | 636 // Called when we have been unminimized. |
| 635 - (void)windowDidDeminiaturize:(NSNotification *)notification { | 637 - (void)windowDidDeminiaturize:(NSNotification *)notification { |
| 636 // Make sure the window's show_state (which is now ui::SHOW_STATE_NORMAL) | 638 // Make sure the window's show_state (which is now ui::SHOW_STATE_NORMAL) |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 | 2055 |
| 2054 - (NSRect)savedRegularWindowFrame { | 2056 - (NSRect)savedRegularWindowFrame { |
| 2055 return savedRegularWindowFrame_; | 2057 return savedRegularWindowFrame_; |
| 2056 } | 2058 } |
| 2057 | 2059 |
| 2058 - (BOOL)isFullscreenTransitionInProgress { | 2060 - (BOOL)isFullscreenTransitionInProgress { |
| 2059 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; | 2061 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; |
| 2060 } | 2062 } |
| 2061 | 2063 |
| 2062 @end // @implementation BrowserWindowController(WindowType) | 2064 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |