| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" | 74 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" |
| 75 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 75 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 76 #include "chrome/browser/ui/location_bar/location_bar.h" | 76 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 77 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 77 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 78 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 78 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| 79 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" | 79 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" |
| 80 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 80 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 81 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 81 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 82 #include "chrome/common/chrome_switches.h" | 82 #include "chrome/common/chrome_switches.h" |
| 83 #include "chrome/common/extensions/command.h" | 83 #include "chrome/common/extensions/command.h" |
| 84 #include "chrome/common/pref_names.h" |
| 84 #include "chrome/common/url_constants.h" | 85 #include "chrome/common/url_constants.h" |
| 85 #include "chrome/grit/generated_resources.h" | 86 #include "chrome/grit/generated_resources.h" |
| 86 #include "chrome/grit/locale_settings.h" | 87 #include "chrome/grit/locale_settings.h" |
| 87 #include "components/bookmarks/browser/bookmark_model.h" | 88 #include "components/bookmarks/browser/bookmark_model.h" |
| 88 #include "components/bookmarks/managed/managed_bookmark_service.h" | 89 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 89 #include "components/signin/core/common/profile_management_switches.h" | 90 #include "components/signin/core/common/profile_management_switches.h" |
| 90 #include "components/translate/core/browser/translate_manager.h" | 91 #include "components/translate/core/browser/translate_manager.h" |
| 91 #include "components/translate/core/browser/translate_ui_delegate.h" | 92 #include "components/translate/core/browser/translate_ui_delegate.h" |
| 92 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 93 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 93 #include "content/public/browser/render_view_host.h" | 94 #include "content/public/browser/render_view_host.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 // on the window bounds to determine whether to show buttons or not. | 429 // on the window bounds to determine whether to show buttons or not. |
| 429 if ([self hasToolbar]) // Do not create the buttons in popups. | 430 if ([self hasToolbar]) // Do not create the buttons in popups. |
| 430 [toolbarController_ createBrowserActionButtons]; | 431 [toolbarController_ createBrowserActionButtons]; |
| 431 | 432 |
| 432 extension_keybinding_registry_.reset( | 433 extension_keybinding_registry_.reset( |
| 433 new ExtensionKeybindingRegistryCocoa(browser_->profile(), | 434 new ExtensionKeybindingRegistryCocoa(browser_->profile(), |
| 434 [self window], | 435 [self window], |
| 435 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, | 436 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, |
| 436 windowShim_.get())); | 437 windowShim_.get())); |
| 437 | 438 |
| 439 PrefService* prefs = browser_->profile()->GetPrefs(); |
| 440 shouldHideFullscreenToolbar_ = |
| 441 prefs->GetBoolean(prefs::kHideFullscreenToolbar); |
| 442 |
| 438 blockLayoutSubviews_ = NO; | 443 blockLayoutSubviews_ = NO; |
| 439 | 444 |
| 440 // We are done initializing now. | 445 // We are done initializing now. |
| 441 initializing_ = NO; | 446 initializing_ = NO; |
| 442 } | 447 } |
| 443 return self; | 448 return self; |
| 444 } | 449 } |
| 445 | 450 |
| 446 - (void)dealloc { | 451 - (void)dealloc { |
| 447 browser_->tab_strip_model()->CloseAllTabs(); | 452 browser_->tab_strip_model()->CloseAllTabs(); |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1909 return | 1914 return |
| 1910 [[tabStripController_ activeTabContentsController] blockFullscreenResize]; | 1915 [[tabStripController_ activeTabContentsController] blockFullscreenResize]; |
| 1911 } | 1916 } |
| 1912 | 1917 |
| 1913 - (void)sheetDidEnd:(NSWindow*)sheet | 1918 - (void)sheetDidEnd:(NSWindow*)sheet |
| 1914 returnCode:(NSInteger)code | 1919 returnCode:(NSInteger)code |
| 1915 context:(void*)context { | 1920 context:(void*)context { |
| 1916 [sheet orderOut:self]; | 1921 [sheet orderOut:self]; |
| 1917 } | 1922 } |
| 1918 | 1923 |
| 1924 - (PresentationModeController*)presentationModeController { |
| 1925 return presentationModeController_.get(); |
| 1926 } |
| 1927 |
| 1919 - (void)executeExtensionCommand:(const std::string&)extension_id | 1928 - (void)executeExtensionCommand:(const std::string&)extension_id |
| 1920 command:(const extensions::Command&)command { | 1929 command:(const extensions::Command&)command { |
| 1921 // Global commands are handled by the ExtensionCommandsGlobalRegistry | 1930 // Global commands are handled by the ExtensionCommandsGlobalRegistry |
| 1922 // instance. | 1931 // instance. |
| 1923 DCHECK(!command.global()); | 1932 DCHECK(!command.global()); |
| 1924 extension_keybinding_registry_->ExecuteCommand(extension_id, | 1933 extension_keybinding_registry_->ExecuteCommand(extension_id, |
| 1925 command.accelerator()); | 1934 command.accelerator()); |
| 1926 } | 1935 } |
| 1927 | 1936 |
| 1928 - (void)setMediaState:(TabMediaState)mediaState { | 1937 - (void)setMediaState:(TabMediaState)mediaState { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1964 [self adjustUIForSlidingFullscreenStyle: | 1973 [self adjustUIForSlidingFullscreenStyle: |
| 1965 withToolbar ? fullscreen_mac::OMNIBOX_TABS_PRESENT | 1974 withToolbar ? fullscreen_mac::OMNIBOX_TABS_PRESENT |
| 1966 : fullscreen_mac::OMNIBOX_TABS_HIDDEN]; | 1975 : fullscreen_mac::OMNIBOX_TABS_HIDDEN]; |
| 1967 } | 1976 } |
| 1968 | 1977 |
| 1969 - (void)updateFullscreenExitBubble { | 1978 - (void)updateFullscreenExitBubble { |
| 1970 [self layoutSubviews]; | 1979 [self layoutSubviews]; |
| 1971 [self showFullscreenExitBubbleIfNecessary]; | 1980 [self showFullscreenExitBubbleIfNecessary]; |
| 1972 } | 1981 } |
| 1973 | 1982 |
| 1974 - (void)toggleFullscreenToolbar { | 1983 - (void)setFullscreenToolbarHidden:(BOOL)shouldHide { |
| 1975 shouldHideFullscreenToolbar_ = !shouldHideFullscreenToolbar_; | 1984 if (shouldHideFullscreenToolbar_ == shouldHide) |
| 1985 return; |
| 1976 | 1986 |
| 1987 [presentationModeController_ setToolbarFraction:0.0]; |
| 1988 shouldHideFullscreenToolbar_ = shouldHide; |
| 1977 if ([self isInAppKitFullscreen]) | 1989 if ([self isInAppKitFullscreen]) |
| 1978 [self updateFullscreenWithToolbar:!shouldHideFullscreenToolbar_]; | 1990 [self updateFullscreenWithToolbar:!shouldHideFullscreenToolbar_]; |
| 1979 } | 1991 } |
| 1980 | 1992 |
| 1981 - (BOOL)isInAnyFullscreenMode { | 1993 - (BOOL)isInAnyFullscreenMode { |
| 1982 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; | 1994 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; |
| 1983 } | 1995 } |
| 1984 | 1996 |
| 1985 - (BOOL)isInImmersiveFullscreen { | 1997 - (BOOL)isInImmersiveFullscreen { |
| 1986 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; | 1998 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2113 | 2125 |
| 2114 - (BOOL)supportsBookmarkBar { | 2126 - (BOOL)supportsBookmarkBar { |
| 2115 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2127 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2116 } | 2128 } |
| 2117 | 2129 |
| 2118 - (BOOL)isTabbedWindow { | 2130 - (BOOL)isTabbedWindow { |
| 2119 return browser_->is_type_tabbed(); | 2131 return browser_->is_type_tabbed(); |
| 2120 } | 2132 } |
| 2121 | 2133 |
| 2122 @end // @implementation BrowserWindowController(WindowType) | 2134 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |