| 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 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
| 12 #import "base/mac/foundation_util.h" | 12 #import "base/mac/foundation_util.h" |
| 13 #include "base/mac/mac_util.h" | 13 #include "base/mac/mac_util.h" |
| 14 #import "base/mac/sdk_forward_declarations.h" | 14 #import "base/mac/sdk_forward_declarations.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/app/chrome_command_ids.h" // IDC_* | 17 #include "chrome/app/chrome_command_ids.h" // IDC_* |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 20 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | 20 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/devtools/devtools_window.h" | 22 #include "chrome/browser/devtools/devtools_window.h" |
| 23 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
| 23 #include "chrome/browser/fullscreen.h" | 24 #include "chrome/browser/fullscreen.h" |
| 24 #include "chrome/browser/profiles/avatar_menu.h" | 25 #include "chrome/browser/profiles/avatar_menu.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/profiles/profile_info_cache.h" | 27 #include "chrome/browser/profiles/profile_info_cache.h" |
| 27 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
| 28 #include "chrome/browser/profiles/profiles_state.h" | 29 #include "chrome/browser/profiles/profiles_state.h" |
| 29 #include "chrome/browser/signin/signin_ui_util.h" | 30 #include "chrome/browser/signin/signin_ui_util.h" |
| 30 #include "chrome/browser/themes/theme_service.h" | 31 #include "chrome/browser/themes/theme_service.h" |
| 31 #include "chrome/browser/themes/theme_service_factory.h" | 32 #include "chrome/browser/themes/theme_service_factory.h" |
| 32 #include "chrome/browser/translate/chrome_translate_client.h" | 33 #include "chrome/browser/translate/chrome_translate_client.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/signin/core/common/profile_management_switches.h" | 88 #include "components/signin/core/common/profile_management_switches.h" |
| 88 #include "components/translate/core/browser/translate_manager.h" | 89 #include "components/translate/core/browser/translate_manager.h" |
| 89 #include "components/translate/core/browser/translate_ui_delegate.h" | 90 #include "components/translate/core/browser/translate_ui_delegate.h" |
| 90 #include "components/web_modal/popup_manager.h" | 91 #include "components/web_modal/popup_manager.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" |
| 93 #include "content/public/browser/render_widget_host_view.h" | 94 #include "content/public/browser/render_widget_host_view.h" |
| 94 #include "content/public/browser/web_contents.h" | 95 #include "content/public/browser/web_contents.h" |
| 96 #include "ui/base/accelerators/accelerator.h" |
| 95 #import "ui/base/cocoa/cocoa_base_utils.h" | 97 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 96 #include "ui/base/l10n/l10n_util.h" | 98 #include "ui/base/l10n/l10n_util.h" |
| 97 #include "ui/base/l10n/l10n_util_mac.h" | 99 #include "ui/base/l10n/l10n_util_mac.h" |
| 98 #include "ui/gfx/mac/scoped_ns_disable_screen_updates.h" | 100 #include "ui/gfx/mac/scoped_ns_disable_screen_updates.h" |
| 99 | 101 |
| 100 using l10n_util::GetStringUTF16; | 102 using l10n_util::GetStringUTF16; |
| 101 using l10n_util::GetNSStringWithFixup; | 103 using l10n_util::GetNSStringWithFixup; |
| 102 using l10n_util::GetNSStringFWithFixup; | 104 using l10n_util::GetNSStringFWithFixup; |
| 103 | 105 |
| 104 // ORGANIZATION: This is a big file. It is (in principle) organized as follows | 106 // ORGANIZATION: This is a big file. It is (in principle) organized as follows |
| (...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 | 2025 |
| 2024 - (void)executeExtensionCommand:(const std::string&)extension_id | 2026 - (void)executeExtensionCommand:(const std::string&)extension_id |
| 2025 command:(const extensions::Command&)command { | 2027 command:(const extensions::Command&)command { |
| 2026 // Global commands are handled by the ExtensionCommandsGlobalRegistry | 2028 // Global commands are handled by the ExtensionCommandsGlobalRegistry |
| 2027 // instance. | 2029 // instance. |
| 2028 DCHECK(!command.global()); | 2030 DCHECK(!command.global()); |
| 2029 extension_keybinding_registry_->ExecuteCommand(extension_id, | 2031 extension_keybinding_registry_->ExecuteCommand(extension_id, |
| 2030 command.accelerator()); | 2032 command.accelerator()); |
| 2031 } | 2033 } |
| 2032 | 2034 |
| 2035 - (BOOL)isExtensionCommandRegisteredForAccelerator: |
| 2036 (const ui::Accelerator&)accelerator { |
| 2037 return extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())-> |
| 2038 IsAcceleratorRegistered(accelerator) || |
| 2039 extension_keybinding_registry_->IsAcceleratorRegistered(accelerator); |
| 2040 } |
| 2041 |
| 2033 @end // @implementation BrowserWindowController | 2042 @end // @implementation BrowserWindowController |
| 2034 | 2043 |
| 2035 @implementation BrowserWindowController(Fullscreen) | 2044 @implementation BrowserWindowController(Fullscreen) |
| 2036 | 2045 |
| 2037 - (void)handleLionToggleFullscreen { | 2046 - (void)handleLionToggleFullscreen { |
| 2038 DCHECK(base::mac::IsOSLionOrLater()); | 2047 DCHECK(base::mac::IsOSLionOrLater()); |
| 2039 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); | 2048 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); |
| 2040 } | 2049 } |
| 2041 | 2050 |
| 2042 - (void)enterFullscreenWithChrome { | 2051 - (void)enterFullscreenWithChrome { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 | 2205 |
| 2197 - (BOOL)supportsBookmarkBar { | 2206 - (BOOL)supportsBookmarkBar { |
| 2198 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2207 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2199 } | 2208 } |
| 2200 | 2209 |
| 2201 - (BOOL)isTabbedWindow { | 2210 - (BOOL)isTabbedWindow { |
| 2202 return browser_->is_type_tabbed(); | 2211 return browser_->is_type_tabbed(); |
| 2203 } | 2212 } |
| 2204 | 2213 |
| 2205 @end // @implementation BrowserWindowController(WindowType) | 2214 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |