| 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 // Instead call it after a zero-length delay, which gets us back to the main | 551 // Instead call it after a zero-length delay, which gets us back to the main |
| 552 // event loop. | 552 // event loop. |
| 553 [self performSelector:@selector(autorelease) | 553 [self performSelector:@selector(autorelease) |
| 554 withObject:nil | 554 withObject:nil |
| 555 afterDelay:0]; | 555 afterDelay:0]; |
| 556 } | 556 } |
| 557 | 557 |
| 558 - (void)updateDevToolsForContents:(WebContents*)contents { | 558 - (void)updateDevToolsForContents:(WebContents*)contents { |
| 559 [devToolsController_ updateDevToolsForWebContents:contents | 559 [devToolsController_ updateDevToolsForWebContents:contents |
| 560 withProfile:browser_->profile()]; | 560 withProfile:browser_->profile()]; |
| 561 [self updateAllowOverlappingViews:[self inPresentationMode]]; | |
| 562 } | 561 } |
| 563 | 562 |
| 564 // Called when the user wants to close a window or from the shutdown process. | 563 // Called when the user wants to close a window or from the shutdown process. |
| 565 // The Browser object is in control of whether or not we're allowed to close. It | 564 // The Browser object is in control of whether or not we're allowed to close. It |
| 566 // may defer closing due to several states, such as onUnload handlers needing to | 565 // may defer closing due to several states, such as onUnload handlers needing to |
| 567 // be fired. If closing is deferred, the Browser will handle the processing | 566 // be fired. If closing is deferred, the Browser will handle the processing |
| 568 // required to get us to the closing state and (by watching for all the tabs | 567 // required to get us to the closing state and (by watching for all the tabs |
| 569 // going away) will again call to close the window when it's finally ready. | 568 // going away) will again call to close the window when it's finally ready. |
| 570 - (BOOL)windowShouldClose:(id)sender { | 569 - (BOOL)windowShouldClose:(id)sender { |
| 571 // Disable updates while closing all tabs to avoid flickering. | 570 // Disable updates while closing all tabs to avoid flickering. |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 // have SetView(NULL) called. Fix this when the previous contents are | 1630 // have SetView(NULL) called. Fix this when the previous contents are |
| 1632 // available here or move to BrowserWindowCocoa::OnActiveTabChanged(). | 1631 // available here or move to BrowserWindowCocoa::OnActiveTabChanged(). |
| 1633 // crbug.com/340720 | 1632 // crbug.com/340720 |
| 1634 PermissionBubbleManager::FromWebContents(contents)->SetView( | 1633 PermissionBubbleManager::FromWebContents(contents)->SetView( |
| 1635 permissionBubbleCocoa_.get()); | 1634 permissionBubbleCocoa_.get()); |
| 1636 | 1635 |
| 1637 // Must do this after bookmark and infobar updates to avoid | 1636 // Must do this after bookmark and infobar updates to avoid |
| 1638 // unnecesary resize in contents. | 1637 // unnecesary resize in contents. |
| 1639 [devToolsController_ updateDevToolsForWebContents:contents | 1638 [devToolsController_ updateDevToolsForWebContents:contents |
| 1640 withProfile:browser_->profile()]; | 1639 withProfile:browser_->profile()]; |
| 1641 | |
| 1642 [self updateAllowOverlappingViews:[self inPresentationMode]]; | |
| 1643 } | 1640 } |
| 1644 | 1641 |
| 1645 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change | 1642 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change |
| 1646 withContents:(WebContents*)contents { | 1643 withContents:(WebContents*)contents { |
| 1647 // Update titles if this is the currently selected tab and if it isn't just | 1644 // Update titles if this is the currently selected tab and if it isn't just |
| 1648 // the loading state which changed. | 1645 // the loading state which changed. |
| 1649 if (change != TabStripModelObserver::LOADING_ONLY) | 1646 if (change != TabStripModelObserver::LOADING_ONLY) |
| 1650 windowShim_->UpdateTitleBar(); | 1647 windowShim_->UpdateTitleBar(); |
| 1651 | 1648 |
| 1652 // Update the bookmark bar if this is the currently selected tab and if it | 1649 // Update the bookmark bar if this is the currently selected tab and if it |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 - (void)layoutInfoBars { | 2011 - (void)layoutInfoBars { |
| 2015 [self layoutSubviews]; | 2012 [self layoutSubviews]; |
| 2016 } | 2013 } |
| 2017 | 2014 |
| 2018 - (void)sheetDidEnd:(NSWindow*)sheet | 2015 - (void)sheetDidEnd:(NSWindow*)sheet |
| 2019 returnCode:(NSInteger)code | 2016 returnCode:(NSInteger)code |
| 2020 context:(void*)context { | 2017 context:(void*)context { |
| 2021 [sheet orderOut:self]; | 2018 [sheet orderOut:self]; |
| 2022 } | 2019 } |
| 2023 | 2020 |
| 2024 - (void)onFindBarVisibilityChanged { | |
| 2025 [self updateAllowOverlappingViews:[self inPresentationMode]]; | |
| 2026 } | |
| 2027 | |
| 2028 - (void)onOverlappedViewShown { | |
| 2029 ++overlappedViewCount_; | |
| 2030 [self updateAllowOverlappingViews:[self inPresentationMode]]; | |
| 2031 } | |
| 2032 | |
| 2033 - (void)onOverlappedViewHidden { | |
| 2034 --overlappedViewCount_; | |
| 2035 [self updateAllowOverlappingViews:[self inPresentationMode]]; | |
| 2036 } | |
| 2037 | |
| 2038 - (void)executeExtensionCommand:(const std::string&)extension_id | 2021 - (void)executeExtensionCommand:(const std::string&)extension_id |
| 2039 command:(const extensions::Command&)command { | 2022 command:(const extensions::Command&)command { |
| 2040 // Global commands are handled by the ExtensionCommandsGlobalRegistry | 2023 // Global commands are handled by the ExtensionCommandsGlobalRegistry |
| 2041 // instance. | 2024 // instance. |
| 2042 DCHECK(!command.global()); | 2025 DCHECK(!command.global()); |
| 2043 extension_keybinding_registry_->ExecuteCommand(extension_id, | 2026 extension_keybinding_registry_->ExecuteCommand(extension_id, |
| 2044 command.accelerator()); | 2027 command.accelerator()); |
| 2045 } | 2028 } |
| 2046 | 2029 |
| 2047 - (void)activatePageAction:(const std::string&)extension_id { | 2030 - (void)activatePageAction:(const std::string&)extension_id { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2292 | 2275 |
| 2293 - (BOOL)supportsBookmarkBar { | 2276 - (BOOL)supportsBookmarkBar { |
| 2294 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2277 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2295 } | 2278 } |
| 2296 | 2279 |
| 2297 - (BOOL)isTabbedWindow { | 2280 - (BOOL)isTabbedWindow { |
| 2298 return browser_->is_type_tabbed(); | 2281 return browser_->is_type_tabbed(); |
| 2299 } | 2282 } |
| 2300 | 2283 |
| 2301 @end // @implementation BrowserWindowController(WindowType) | 2284 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |