| 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 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 } | 599 } |
| 600 | 600 |
| 601 // the tab strip is empty, it's ok to close the window | 601 // the tab strip is empty, it's ok to close the window |
| 602 return YES; | 602 return YES; |
| 603 } | 603 } |
| 604 | 604 |
| 605 // Called right after our window became the main window. | 605 // Called right after our window became the main window. |
| 606 - (void)windowDidBecomeMain:(NSNotification*)notification { | 606 - (void)windowDidBecomeMain:(NSNotification*)notification { |
| 607 if (chrome::GetLastActiveBrowser() != browser_) { | 607 if (chrome::GetLastActiveBrowser() != browser_) { |
| 608 BrowserList::SetLastActive(browser_.get()); | 608 BrowserList::SetLastActive(browser_.get()); |
| 609 [self saveWindowPositionIfNeeded]; | |
| 610 } | 609 } |
| 610 // Always saveWindowPositionIfNeeded when becoming main, not just |
| 611 // when |browser_| is not the last active browser. See crbug.com/536280 . |
| 612 [self saveWindowPositionIfNeeded]; |
| 611 | 613 |
| 612 NSView* rootView = [[[self window] contentView] superview]; | 614 NSView* rootView = [[[self window] contentView] superview]; |
| 613 [rootView cr_recursivelyInvokeBlock:^(id view) { | 615 [rootView cr_recursivelyInvokeBlock:^(id view) { |
| 614 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) | 616 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) |
| 615 [view windowDidChangeActive]; | 617 [view windowDidChangeActive]; |
| 616 }]; | 618 }]; |
| 617 | 619 |
| 618 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) | 620 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) |
| 619 ->set_registry_for_active_window(extension_keybinding_registry_.get()); | 621 ->set_registry_for_active_window(extension_keybinding_registry_.get()); |
| 620 } | 622 } |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 | 2063 |
| 2062 - (BOOL)supportsBookmarkBar { | 2064 - (BOOL)supportsBookmarkBar { |
| 2063 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2065 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2064 } | 2066 } |
| 2065 | 2067 |
| 2066 - (BOOL)isTabbedWindow { | 2068 - (BOOL)isTabbedWindow { |
| 2067 return browser_->is_type_tabbed(); | 2069 return browser_->is_type_tabbed(); |
| 2068 } | 2070 } |
| 2069 | 2071 |
| 2070 @end // @implementation BrowserWindowController(WindowType) | 2072 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |