Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 501135: Revert 34998, more stabbing in the dark to find a perf regression - Mac: impl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <Carbon/Carbon.h> 5 #include <Carbon/Carbon.h>
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #include "base/scoped_nsdisable_screen_updates.h" 9 #include "base/scoped_nsdisable_screen_updates.h"
10 #import "base/scoped_nsobject.h" 10 #import "base/scoped_nsobject.h"
(...skipping 25 matching lines...) Expand all
36 #include "chrome/browser/cocoa/find_bar_bridge.h" 36 #include "chrome/browser/cocoa/find_bar_bridge.h"
37 #import "chrome/browser/cocoa/fullscreen_window.h" 37 #import "chrome/browser/cocoa/fullscreen_window.h"
38 #import "chrome/browser/cocoa/infobar_container_controller.h" 38 #import "chrome/browser/cocoa/infobar_container_controller.h"
39 #import "chrome/browser/cocoa/sad_tab_controller.h" 39 #import "chrome/browser/cocoa/sad_tab_controller.h"
40 #import "chrome/browser/cocoa/status_bubble_mac.h" 40 #import "chrome/browser/cocoa/status_bubble_mac.h"
41 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" 41 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h"
42 #import "chrome/browser/cocoa/tab_strip_view.h" 42 #import "chrome/browser/cocoa/tab_strip_view.h"
43 #import "chrome/browser/cocoa/tab_strip_controller.h" 43 #import "chrome/browser/cocoa/tab_strip_controller.h"
44 #import "chrome/browser/cocoa/tab_view.h" 44 #import "chrome/browser/cocoa/tab_view.h"
45 #import "chrome/browser/cocoa/toolbar_controller.h" 45 #import "chrome/browser/cocoa/toolbar_controller.h"
46 #include "chrome/browser/net/url_fixer_upper.h"
46 #include "chrome/browser/sync/profile_sync_service.h" 47 #include "chrome/browser/sync/profile_sync_service.h"
47 #include "chrome/browser/sync/sync_ui_util_mac.h" 48 #include "chrome/browser/sync/sync_ui_util_mac.h"
48 #include "chrome/common/pref_names.h" 49 #include "chrome/common/pref_names.h"
49 #include "chrome/common/pref_service.h" 50 #include "chrome/common/pref_service.h"
50 #include "grit/generated_resources.h" 51 #include "grit/generated_resources.h"
51 #include "grit/locale_settings.h" 52 #include "grit/locale_settings.h"
52 #include "grit/theme_resources.h" 53 #include "grit/theme_resources.h"
53 #import "third_party/GTM/AppKit/GTMTheme.h" 54 #import "third_party/GTM/AppKit/GTMTheme.h"
54 55
55 // ORGANIZATION: This is a big file. It is (in principle) organized as follows 56 // ORGANIZATION: This is a big file. It is (in principle) organized as follows
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 829
829 // If the item is toggleable, find its toggle state and 830 // If the item is toggleable, find its toggle state and
830 // try to update it. This is a little awkward, but the alternative is 831 // try to update it. This is a little awkward, but the alternative is
831 // to check after a commandDispatch, which seems worse. 832 // to check after a commandDispatch, which seems worse.
832 [self updateToggleStateWithTag:tag forItem:item]; 833 [self updateToggleStateWithTag:tag forItem:item];
833 } 834 }
834 } 835 }
835 return enable; 836 return enable;
836 } 837 }
837 838
839 - (ToolbarController*)toolbarController {
840 return toolbarController_.get();
841 }
842
838 // Called when the user picks a menu or toolbar item when this window is key. 843 // Called when the user picks a menu or toolbar item when this window is key.
839 // Calls through to the browser object to execute the command. This assumes that 844 // Calls through to the browser object to execute the command. This assumes that
840 // the command is supported and doesn't check, otherwise it would have been 845 // the command is supported and doesn't check, otherwise it would have been
841 // disabled in the UI in validateUserInterfaceItem:. 846 // disabled in the UI in validateUserInterfaceItem:.
842 - (void)commandDispatch:(id)sender { 847 - (void)commandDispatch:(id)sender {
843 NSInteger tag = [sender tag]; 848 NSInteger tag = [sender tag];
844 switch (tag) { 849 switch (tag) {
845 case IDC_RELOAD: 850 case IDC_RELOAD:
846 if ([sender isKindOfClass:[NSButton class]]) { 851 if ([sender isKindOfClass:[NSButton class]]) {
847 // We revert the bar when the reload button is pressed, but don't when 852 // We revert the bar when the reload button is pressed, but don't when
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 - (void)detachTabView:(NSView*)view { 1004 - (void)detachTabView:(NSView*)view {
1000 int index = [tabStripController_ modelIndexForTabView:view]; 1005 int index = [tabStripController_ modelIndexForTabView:view];
1001 browser_->tabstrip_model()->DetachTabContentsAt(index); 1006 browser_->tabstrip_model()->DetachTabContentsAt(index);
1002 } 1007 }
1003 1008
1004 - (NSView*)selectedTabView { 1009 - (NSView*)selectedTabView {
1005 return [tabStripController_ selectedTabView]; 1010 return [tabStripController_ selectedTabView];
1006 } 1011 }
1007 1012
1008 - (TabStripController*)tabStripController { 1013 - (TabStripController*)tabStripController {
1009 return tabStripController_.get(); 1014 return tabStripController_;
1010 }
1011
1012 - (ToolbarController*)toolbarController {
1013 return toolbarController_.get();
1014 } 1015 }
1015 1016
1016 - (void)setIsLoading:(BOOL)isLoading { 1017 - (void)setIsLoading:(BOOL)isLoading {
1017 [toolbarController_ setIsLoading:isLoading]; 1018 [toolbarController_ setIsLoading:isLoading];
1018 } 1019 }
1019 1020
1020 // Make the location bar the first responder, if possible. 1021 // Make the location bar the first responder, if possible.
1021 - (void)focusLocationBar { 1022 - (void)focusLocationBar {
1022 [toolbarController_ focusLocationBar]; 1023 [toolbarController_ focusLocationBar];
1023 } 1024 }
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 [controller getDesiredToolbarHeightCompression]]; 1538 [controller getDesiredToolbarHeightCompression]];
1538 } 1539 }
1539 1540
1540 // (Private/TestingAPI) 1541 // (Private/TestingAPI)
1541 - (void)resetWindowGrowthState { 1542 - (void)resetWindowGrowthState {
1542 windowTopGrowth_ = 0; 1543 windowTopGrowth_ = 0;
1543 windowBottomGrowth_ = 0; 1544 windowBottomGrowth_ = 0;
1544 isShrinkingFromZoomed_ = NO; 1545 isShrinkingFromZoomed_ = NO;
1545 } 1546 }
1546 1547
1548 // Our implementation of the |URLDropTargetWindowController| protocol just
1549 // reflects everything to the |tabStripController_|.
1550 - (void)dropURLs:(NSArray*)urls at:(NSPoint)location {
1551 [tabStripController_ dropURLs:urls at:location];
1552 }
1553
1554 - (void)indicateDropURLsAt:(NSPoint)location {
1555 [tabStripController_ indicateDropURLsAt:location];
1556 }
1557
1558 - (void)hideDropURLsIndicator {
1559 [tabStripController_ hideDropURLsIndicator];
1560 }
1561
1547 @end 1562 @end
1548 1563
1549 @implementation BrowserWindowController (Private) 1564 @implementation BrowserWindowController (Private)
1550 1565
1551 - (void)saveWindowPositionIfNeeded { 1566 - (void)saveWindowPositionIfNeeded {
1552 if (browser_ != BrowserList::GetLastActive()) 1567 if (browser_ != BrowserList::GetLastActive())
1553 return; 1568 return;
1554 1569
1555 if (!g_browser_process || !g_browser_process->local_state() || 1570 if (!g_browser_process || !g_browser_process->local_state() ||
1556 !browser_->ShouldSaveWindowPlacement()) 1571 !browser_->ShouldSaveWindowPlacement())
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 if (frameOverlayInactiveImage) { 1968 if (frameOverlayInactiveImage) {
1954 [theme setValue:frameOverlayInactiveImage 1969 [theme setValue:frameOverlayInactiveImage
1955 forAttribute:@"overlay" 1970 forAttribute:@"overlay"
1956 style:GTMThemeStyleWindow 1971 style:GTMThemeStyleWindow
1957 state:GTMThemeStateInactiveWindow]; 1972 state:GTMThemeStateInactiveWindow];
1958 } 1973 }
1959 1974
1960 return theme; 1975 return theme;
1961 } 1976 }
1962 @end 1977 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.h ('k') | chrome/browser/cocoa/tab_strip_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698