| 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 25 matching lines...) Expand all Loading... |
| 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" | |
| 47 #include "chrome/browser/sync/profile_sync_service.h" | 46 #include "chrome/browser/sync/profile_sync_service.h" |
| 48 #include "chrome/browser/sync/sync_ui_util_mac.h" | 47 #include "chrome/browser/sync/sync_ui_util_mac.h" |
| 49 #include "chrome/common/pref_names.h" | 48 #include "chrome/common/pref_names.h" |
| 50 #include "chrome/common/pref_service.h" | 49 #include "chrome/common/pref_service.h" |
| 51 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
| 52 #include "grit/locale_settings.h" | 51 #include "grit/locale_settings.h" |
| 53 #include "grit/theme_resources.h" | 52 #include "grit/theme_resources.h" |
| 54 #import "third_party/GTM/AppKit/GTMTheme.h" | 53 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 55 | 54 |
| 56 // ORGANIZATION: This is a big file. It is (in principle) organized as follows | 55 // 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 Loading... |
| 829 | 828 |
| 830 // If the item is toggleable, find its toggle state and | 829 // If the item is toggleable, find its toggle state and |
| 831 // try to update it. This is a little awkward, but the alternative is | 830 // try to update it. This is a little awkward, but the alternative is |
| 832 // to check after a commandDispatch, which seems worse. | 831 // to check after a commandDispatch, which seems worse. |
| 833 [self updateToggleStateWithTag:tag forItem:item]; | 832 [self updateToggleStateWithTag:tag forItem:item]; |
| 834 } | 833 } |
| 835 } | 834 } |
| 836 return enable; | 835 return enable; |
| 837 } | 836 } |
| 838 | 837 |
| 839 - (ToolbarController*)toolbarController { | |
| 840 return toolbarController_.get(); | |
| 841 } | |
| 842 | |
| 843 // Called when the user picks a menu or toolbar item when this window is key. | 838 // Called when the user picks a menu or toolbar item when this window is key. |
| 844 // Calls through to the browser object to execute the command. This assumes that | 839 // Calls through to the browser object to execute the command. This assumes that |
| 845 // the command is supported and doesn't check, otherwise it would have been | 840 // the command is supported and doesn't check, otherwise it would have been |
| 846 // disabled in the UI in validateUserInterfaceItem:. | 841 // disabled in the UI in validateUserInterfaceItem:. |
| 847 - (void)commandDispatch:(id)sender { | 842 - (void)commandDispatch:(id)sender { |
| 848 NSInteger tag = [sender tag]; | 843 NSInteger tag = [sender tag]; |
| 849 switch (tag) { | 844 switch (tag) { |
| 850 case IDC_RELOAD: | 845 case IDC_RELOAD: |
| 851 if ([sender isKindOfClass:[NSButton class]]) { | 846 if ([sender isKindOfClass:[NSButton class]]) { |
| 852 // We revert the bar when the reload button is pressed, but don't when | 847 // 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 Loading... |
| 1004 - (void)detachTabView:(NSView*)view { | 999 - (void)detachTabView:(NSView*)view { |
| 1005 int index = [tabStripController_ modelIndexForTabView:view]; | 1000 int index = [tabStripController_ modelIndexForTabView:view]; |
| 1006 browser_->tabstrip_model()->DetachTabContentsAt(index); | 1001 browser_->tabstrip_model()->DetachTabContentsAt(index); |
| 1007 } | 1002 } |
| 1008 | 1003 |
| 1009 - (NSView*)selectedTabView { | 1004 - (NSView*)selectedTabView { |
| 1010 return [tabStripController_ selectedTabView]; | 1005 return [tabStripController_ selectedTabView]; |
| 1011 } | 1006 } |
| 1012 | 1007 |
| 1013 - (TabStripController*)tabStripController { | 1008 - (TabStripController*)tabStripController { |
| 1014 return tabStripController_; | 1009 return tabStripController_.get(); |
| 1010 } |
| 1011 |
| 1012 - (ToolbarController*)toolbarController { |
| 1013 return toolbarController_.get(); |
| 1015 } | 1014 } |
| 1016 | 1015 |
| 1017 - (void)setIsLoading:(BOOL)isLoading { | 1016 - (void)setIsLoading:(BOOL)isLoading { |
| 1018 [toolbarController_ setIsLoading:isLoading]; | 1017 [toolbarController_ setIsLoading:isLoading]; |
| 1019 } | 1018 } |
| 1020 | 1019 |
| 1021 // Make the location bar the first responder, if possible. | 1020 // Make the location bar the first responder, if possible. |
| 1022 - (void)focusLocationBar { | 1021 - (void)focusLocationBar { |
| 1023 [toolbarController_ focusLocationBar]; | 1022 [toolbarController_ focusLocationBar]; |
| 1024 } | 1023 } |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 [controller getDesiredToolbarHeightCompression]]; | 1537 [controller getDesiredToolbarHeightCompression]]; |
| 1539 } | 1538 } |
| 1540 | 1539 |
| 1541 // (Private/TestingAPI) | 1540 // (Private/TestingAPI) |
| 1542 - (void)resetWindowGrowthState { | 1541 - (void)resetWindowGrowthState { |
| 1543 windowTopGrowth_ = 0; | 1542 windowTopGrowth_ = 0; |
| 1544 windowBottomGrowth_ = 0; | 1543 windowBottomGrowth_ = 0; |
| 1545 isShrinkingFromZoomed_ = NO; | 1544 isShrinkingFromZoomed_ = NO; |
| 1546 } | 1545 } |
| 1547 | 1546 |
| 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 | |
| 1562 @end | 1547 @end |
| 1563 | 1548 |
| 1564 @implementation BrowserWindowController (Private) | 1549 @implementation BrowserWindowController (Private) |
| 1565 | 1550 |
| 1566 - (void)saveWindowPositionIfNeeded { | 1551 - (void)saveWindowPositionIfNeeded { |
| 1567 if (browser_ != BrowserList::GetLastActive()) | 1552 if (browser_ != BrowserList::GetLastActive()) |
| 1568 return; | 1553 return; |
| 1569 | 1554 |
| 1570 if (!g_browser_process || !g_browser_process->local_state() || | 1555 if (!g_browser_process || !g_browser_process->local_state() || |
| 1571 !browser_->ShouldSaveWindowPlacement()) | 1556 !browser_->ShouldSaveWindowPlacement()) |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 if (frameOverlayInactiveImage) { | 1953 if (frameOverlayInactiveImage) { |
| 1969 [theme setValue:frameOverlayInactiveImage | 1954 [theme setValue:frameOverlayInactiveImage |
| 1970 forAttribute:@"overlay" | 1955 forAttribute:@"overlay" |
| 1971 style:GTMThemeStyleWindow | 1956 style:GTMThemeStyleWindow |
| 1972 state:GTMThemeStateInactiveWindow]; | 1957 state:GTMThemeStateInactiveWindow]; |
| 1973 } | 1958 } |
| 1974 | 1959 |
| 1975 return theme; | 1960 return theme; |
| 1976 } | 1961 } |
| 1977 @end | 1962 @end |
| OLD | NEW |