OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 void BrowserWindowCocoa::Copy() { | 600 void BrowserWindowCocoa::Copy() { |
601 [NSApp sendAction:@selector(copy:) to:nil from:nil]; | 601 [NSApp sendAction:@selector(copy:) to:nil from:nil]; |
602 } | 602 } |
603 | 603 |
604 void BrowserWindowCocoa::Paste() { | 604 void BrowserWindowCocoa::Paste() { |
605 [NSApp sendAction:@selector(paste:) to:nil from:nil]; | 605 [NSApp sendAction:@selector(paste:) to:nil from:nil]; |
606 } | 606 } |
607 | 607 |
608 void BrowserWindowCocoa::EnterFullscreenWithChrome() { | 608 void BrowserWindowCocoa::EnterFullscreenWithChrome() { |
609 // This method cannot be called if simplified fullscreen is enabled. | |
610 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
611 DCHECK(!command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)); | |
612 | |
613 CHECK(chrome::mac::SupportsSystemFullscreen()); | 609 CHECK(chrome::mac::SupportsSystemFullscreen()); |
614 [controller_ enterFullscreenWithChrome]; | 610 [controller_ enterFullscreenWithChrome]; |
615 } | 611 } |
616 | 612 |
617 bool BrowserWindowCocoa::IsFullscreenWithChrome() { | 613 bool BrowserWindowCocoa::IsFullscreenWithChrome() { |
618 // The WithChrome mode does not exist when simplified fullscreen is enabled. | |
619 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
620 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) | |
621 return false; | |
622 return IsFullscreen() && ![controller_ inPresentationMode]; | 614 return IsFullscreen() && ![controller_ inPresentationMode]; |
623 } | 615 } |
624 | 616 |
625 bool BrowserWindowCocoa::IsFullscreenWithoutChrome() { | 617 bool BrowserWindowCocoa::IsFullscreenWithoutChrome() { |
626 // Presentation mode does not exist if simplified fullscreen is enabled. The | |
627 // WithoutChrome mode simply maps to whether or not the window is fullscreen. | |
628 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
629 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) | |
630 return IsFullscreen(); | |
631 | |
632 return IsFullscreen() && [controller_ inPresentationMode]; | 618 return IsFullscreen() && [controller_ inPresentationMode]; |
633 } | 619 } |
634 | 620 |
635 WindowOpenDisposition BrowserWindowCocoa::GetDispositionForPopupBounds( | 621 WindowOpenDisposition BrowserWindowCocoa::GetDispositionForPopupBounds( |
636 const gfx::Rect& bounds) { | 622 const gfx::Rect& bounds) { |
637 // When using Cocoa's System Fullscreen mode, convert popups into tabs. | 623 // When using Cocoa's System Fullscreen mode, convert popups into tabs. |
638 if ([controller_ isInAppKitFullscreen]) | 624 if ([controller_ isInAppKitFullscreen]) |
639 return NEW_FOREGROUND_TAB; | 625 return NEW_FOREGROUND_TAB; |
640 return NEW_POPUP; | 626 return NEW_POPUP; |
641 } | 627 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) | 719 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) |
734 return 0; | 720 return 0; |
735 return 40; | 721 return 40; |
736 } | 722 } |
737 | 723 |
738 void BrowserWindowCocoa::ExecuteExtensionCommand( | 724 void BrowserWindowCocoa::ExecuteExtensionCommand( |
739 const extensions::Extension* extension, | 725 const extensions::Extension* extension, |
740 const extensions::Command& command) { | 726 const extensions::Command& command) { |
741 [cocoa_controller() executeExtensionCommand:extension->id() command:command]; | 727 [cocoa_controller() executeExtensionCommand:extension->id() command:command]; |
742 } | 728 } |
OLD | NEW |