| 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 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 base::SysNSStringToUTF16(@"🔇")); | 319 base::SysNSStringToUTF16(@"🔇")); |
| 320 } | 320 } |
| 321 return base::SysUTF16ToNSString( | 321 return base::SysUTF16ToNSString( |
| 322 browser_->GetWindowTitleForCurrentTab(include_app_name)); | 322 browser_->GetWindowTitleForCurrentTab(include_app_name)); |
| 323 } | 323 } |
| 324 | 324 |
| 325 bool BrowserWindowCocoa::IsToolbarShowing() const { | 325 bool BrowserWindowCocoa::IsToolbarShowing() const { |
| 326 if (!IsFullscreen()) | 326 if (!IsFullscreen()) |
| 327 return true; | 327 return true; |
| 328 | 328 |
| 329 // TODO(zijiehe): Retrieve the visibility of toolbar from | 329 return [cocoa_controller() isToolbarShowing] == YES; |
| 330 // FullscreenToolbarController. See http://crbug.com/702251 and | |
| 331 // http://crbug.com/680809. | |
| 332 return true; | |
| 333 } | 330 } |
| 334 | 331 |
| 335 void BrowserWindowCocoa::BookmarkBarStateChanged( | 332 void BrowserWindowCocoa::BookmarkBarStateChanged( |
| 336 BookmarkBar::AnimateChangeType change_type) { | 333 BookmarkBar::AnimateChangeType change_type) { |
| 337 [[controller_ bookmarkBarController] | 334 [[controller_ bookmarkBarController] |
| 338 updateState:browser_->bookmark_bar_state() | 335 updateState:browser_->bookmark_bar_state() |
| 339 changeType:change_type]; | 336 changeType:change_type]; |
| 340 } | 337 } |
| 341 | 338 |
| 342 void BrowserWindowCocoa::UpdateDevTools() { | 339 void BrowserWindowCocoa::UpdateDevTools() { |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 [controller_ | 717 [controller_ |
| 721 handledByExtensionCommand:event.os_event | 718 handledByExtensionCommand:event.os_event |
| 722 priority:ui::AcceleratorManager::kHighPriority]) | 719 priority:ui::AcceleratorManager::kHighPriority]) |
| 723 return content::KeyboardEventProcessingResult::HANDLED; | 720 return content::KeyboardEventProcessingResult::HANDLED; |
| 724 | 721 |
| 725 int id = [BrowserWindowUtils getCommandId:event]; | 722 int id = [BrowserWindowUtils getCommandId:event]; |
| 726 if (id == -1) | 723 if (id == -1) |
| 727 return content::KeyboardEventProcessingResult::NOT_HANDLED; | 724 return content::KeyboardEventProcessingResult::NOT_HANDLED; |
| 728 | 725 |
| 729 if (browser_->command_controller()->IsReservedCommandOrKey(id, event)) { | 726 if (browser_->command_controller()->IsReservedCommandOrKey(id, event)) { |
| 727 using Result = content::KeyboardEventProcessingResult; |
| 730 return [BrowserWindowUtils handleKeyboardEvent:event.os_event | 728 return [BrowserWindowUtils handleKeyboardEvent:event.os_event |
| 731 inWindow:window()] | 729 inWindow:window()] |
| 732 ? content::KeyboardEventProcessingResult::HANDLED | 730 ? Result::HANDLED |
| 733 : content::KeyboardEventProcessingResult::NOT_HANDLED; | 731 : Result::NOT_HANDLED_IS_SHORTCUT; |
| 734 } | 732 } |
| 735 | 733 |
| 736 return content::KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT; | 734 return content::KeyboardEventProcessingResult::NOT_HANDLED; |
| 737 } | 735 } |
| 738 | 736 |
| 739 void BrowserWindowCocoa::HandleKeyboardEvent( | 737 void BrowserWindowCocoa::HandleKeyboardEvent( |
| 740 const NativeWebKeyboardEvent& event) { | 738 const NativeWebKeyboardEvent& event) { |
| 741 if ([BrowserWindowUtils shouldHandleKeyboardEvent:event]) { | 739 if ([BrowserWindowUtils shouldHandleKeyboardEvent:event]) { |
| 742 if (![BrowserWindowUtils handleKeyboardEvent:event.os_event | 740 if (![BrowserWindowUtils handleKeyboardEvent:event.os_event |
| 743 inWindow:window()]) { | 741 inWindow:window()]) { |
| 744 | 742 |
| 745 // TODO(spqchan): This is a temporary fix for exit extension fullscreen. | 743 // TODO(spqchan): This is a temporary fix for exit extension fullscreen. |
| 746 // A priority system for exiting extension fullscreen when there is a | 744 // A priority system for exiting extension fullscreen when there is a |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 ExclusiveAccessContext* BrowserWindowCocoa::GetExclusiveAccessContext() { | 849 ExclusiveAccessContext* BrowserWindowCocoa::GetExclusiveAccessContext() { |
| 852 return [controller_ exclusiveAccessController]; | 850 return [controller_ exclusiveAccessController]; |
| 853 } | 851 } |
| 854 | 852 |
| 855 void BrowserWindowCocoa::ShowImeWarningBubble( | 853 void BrowserWindowCocoa::ShowImeWarningBubble( |
| 856 const extensions::Extension* extension, | 854 const extensions::Extension* extension, |
| 857 const base::Callback<void(ImeWarningBubblePermissionStatus status)>& | 855 const base::Callback<void(ImeWarningBubblePermissionStatus status)>& |
| 858 callback) { | 856 callback) { |
| 859 NOTREACHED() << "The IME warning bubble is unsupported on this platform."; | 857 NOTREACHED() << "The IME warning bubble is unsupported on this platform."; |
| 860 } | 858 } |
| OLD | NEW |