OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 #import "chrome/browser/cocoa/chrome_browser_window.h" | 31 #import "chrome/browser/cocoa/chrome_browser_window.h" |
32 #import "chrome/browser/cocoa/download_shelf_controller.h" | 32 #import "chrome/browser/cocoa/download_shelf_controller.h" |
33 #import "chrome/browser/cocoa/event_utils.h" | 33 #import "chrome/browser/cocoa/event_utils.h" |
34 #import "chrome/browser/cocoa/fast_resize_view.h" | 34 #import "chrome/browser/cocoa/fast_resize_view.h" |
35 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" | 35 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" |
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_contents_controller.h" |
41 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" | 42 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" |
42 #import "chrome/browser/cocoa/tab_strip_view.h" | 43 #import "chrome/browser/cocoa/tab_strip_view.h" |
43 #import "chrome/browser/cocoa/tab_strip_controller.h" | 44 #import "chrome/browser/cocoa/tab_strip_controller.h" |
44 #import "chrome/browser/cocoa/tab_view.h" | 45 #import "chrome/browser/cocoa/tab_view.h" |
45 #import "chrome/browser/cocoa/toolbar_controller.h" | 46 #import "chrome/browser/cocoa/toolbar_controller.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" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } | 376 } |
376 | 377 |
377 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window { | 378 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window { |
378 return [tabStripController_ attachConstrainedWindow:window]; | 379 return [tabStripController_ attachConstrainedWindow:window]; |
379 } | 380 } |
380 | 381 |
381 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { | 382 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { |
382 [tabStripController_ removeConstrainedWindow:window]; | 383 [tabStripController_ removeConstrainedWindow:window]; |
383 } | 384 } |
384 | 385 |
| 386 - (void)updateDevToolsForContents:(TabContents*)contents { |
| 387 [tabStripController_ updateDevToolsForContents:contents]; |
| 388 } |
| 389 |
385 // Called when the user wants to close a window or from the shutdown process. | 390 // Called when the user wants to close a window or from the shutdown process. |
386 // The Browser object is in control of whether or not we're allowed to close. It | 391 // The Browser object is in control of whether or not we're allowed to close. It |
387 // may defer closing due to several states, such as onUnload handlers needing to | 392 // may defer closing due to several states, such as onUnload handlers needing to |
388 // be fired. If closing is deferred, the Browser will handle the processing | 393 // be fired. If closing is deferred, the Browser will handle the processing |
389 // required to get us to the closing state and (by watching for all the tabs | 394 // required to get us to the closing state and (by watching for all the tabs |
390 // going away) will again call to close the window when it's finally ready. | 395 // going away) will again call to close the window when it's finally ready. |
391 - (BOOL)windowShouldClose:(id)sender { | 396 - (BOOL)windowShouldClose:(id)sender { |
392 // Disable updates while closing all tabs to avoid flickering. | 397 // Disable updates while closing all tabs to avoid flickering. |
393 base::ScopedNSDisableScreenUpdates disabler; | 398 base::ScopedNSDisableScreenUpdates disabler; |
394 // Give beforeunload handlers the chance to cancel the close before we hide | 399 // Give beforeunload handlers the chance to cancel the close before we hide |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 // Called when another part of the internal codebase needs to execute a | 872 // Called when another part of the internal codebase needs to execute a |
868 // command. | 873 // command. |
869 - (void)executeCommand:(int)command { | 874 - (void)executeCommand:(int)command { |
870 if (browser_->command_updater()->IsCommandEnabled(command)) | 875 if (browser_->command_updater()->IsCommandEnabled(command)) |
871 browser_->ExecuteCommand(command); | 876 browser_->ExecuteCommand(command); |
872 } | 877 } |
873 | 878 |
874 // StatusBubble delegate method: tell the status bubble how far above the bottom | 879 // StatusBubble delegate method: tell the status bubble how far above the bottom |
875 // of the window it should position itself. | 880 // of the window it should position itself. |
876 - (float)verticalOffsetForStatusBubble { | 881 - (float)verticalOffsetForStatusBubble { |
877 return verticalOffsetForStatusBubble_; | 882 return verticalOffsetForStatusBubble_ + |
| 883 [[tabStripController_ activeTabContentsController] devToolsHeight]; |
878 } | 884 } |
879 | 885 |
880 - (GTMWindowSheetController*)sheetController { | 886 - (GTMWindowSheetController*)sheetController { |
881 return [tabStripController_ sheetController]; | 887 return [tabStripController_ sheetController]; |
882 } | 888 } |
883 | 889 |
884 - (LocationBar*)locationBarBridge { | 890 - (LocationBar*)locationBarBridge { |
885 return [toolbarController_ locationBarBridge]; | 891 return [toolbarController_ locationBarBridge]; |
886 } | 892 } |
887 | 893 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 DCHECK(controller && [controller isKindOfClass:[TabWindowController class]]); | 1075 DCHECK(controller && [controller isKindOfClass:[TabWindowController class]]); |
1070 | 1076 |
1071 // Force the added tab to the right size (remove stretching.) | 1077 // Force the added tab to the right size (remove stretching.) |
1072 tabRect.size.height = [TabStripController defaultTabHeight]; | 1078 tabRect.size.height = [TabStripController defaultTabHeight]; |
1073 | 1079 |
1074 // And make sure we use the correct frame in the new view. | 1080 // And make sure we use the correct frame in the new view. |
1075 [[controller tabStripController] setFrameOfSelectedTab:tabRect]; | 1081 [[controller tabStripController] setFrameOfSelectedTab:tabRect]; |
1076 return controller; | 1082 return controller; |
1077 } | 1083 } |
1078 | 1084 |
1079 | |
1080 - (void)insertPlaceholderForTab:(TabView*)tab | 1085 - (void)insertPlaceholderForTab:(TabView*)tab |
1081 frame:(NSRect)frame | 1086 frame:(NSRect)frame |
1082 yStretchiness:(CGFloat)yStretchiness { | 1087 yStretchiness:(CGFloat)yStretchiness { |
1083 [super insertPlaceholderForTab:tab frame:frame yStretchiness:yStretchiness]; | 1088 [super insertPlaceholderForTab:tab frame:frame yStretchiness:yStretchiness]; |
1084 [tabStripController_ insertPlaceholderForTab:tab | 1089 [tabStripController_ insertPlaceholderForTab:tab |
1085 frame:frame | 1090 frame:frame |
1086 yStretchiness:yStretchiness]; | 1091 yStretchiness:yStretchiness]; |
1087 } | 1092 } |
1088 | 1093 |
1089 - (void)removePlaceholder { | 1094 - (void)removePlaceholder { |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 if (frameOverlayInactiveImage) { | 1962 if (frameOverlayInactiveImage) { |
1958 [theme setValue:frameOverlayInactiveImage | 1963 [theme setValue:frameOverlayInactiveImage |
1959 forAttribute:@"overlay" | 1964 forAttribute:@"overlay" |
1960 style:GTMThemeStyleWindow | 1965 style:GTMThemeStyleWindow |
1961 state:GTMThemeStateInactiveWindow]; | 1966 state:GTMThemeStateInactiveWindow]; |
1962 } | 1967 } |
1963 | 1968 |
1964 return theme; | 1969 return theme; |
1965 } | 1970 } |
1966 @end | 1971 @end |
OLD | NEW |