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