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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 BrowserList::SetLastActive(browser_.get()); | 619 BrowserList::SetLastActive(browser_.get()); |
619 [self saveWindowPositionIfNeeded]; | 620 [self saveWindowPositionIfNeeded]; |
620 | 621 |
621 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 622 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
622 // about the active window state should be registering for notifications. | 623 // about the active window state should be registering for notifications. |
623 [[self window] setViewsNeedDisplay:YES]; | 624 [[self window] setViewsNeedDisplay:YES]; |
624 | 625 |
625 // TODO(viettrungluu): For some reason, the above doesn't suffice. | 626 // TODO(viettrungluu): For some reason, the above doesn't suffice. |
626 if ([self isInAnyFullscreenMode]) | 627 if ([self isInAnyFullscreenMode]) |
627 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. | 628 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. |
| 629 |
| 630 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())-> |
| 631 set_registry_for_active_window(extension_keybinding_registry_.get()); |
628 } | 632 } |
629 | 633 |
630 - (void)windowDidResignMain:(NSNotification*)notification { | 634 - (void)windowDidResignMain:(NSNotification*)notification { |
631 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 635 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
632 // about the active window state should be registering for notifications. | 636 // about the active window state should be registering for notifications. |
633 [[self window] setViewsNeedDisplay:YES]; | 637 [[self window] setViewsNeedDisplay:YES]; |
634 | 638 |
635 // TODO(viettrungluu): For some reason, the above doesn't suffice. | 639 // TODO(viettrungluu): For some reason, the above doesn't suffice. |
636 if ([self isInAnyFullscreenMode]) | 640 if ([self isInAnyFullscreenMode]) |
637 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. | 641 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. |
| 642 |
| 643 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())-> |
| 644 set_registry_for_active_window(nullptr); |
638 } | 645 } |
639 | 646 |
640 // Called when we are activated (when we gain focus). | 647 // Called when we are activated (when we gain focus). |
641 - (void)windowDidBecomeKey:(NSNotification*)notification { | 648 - (void)windowDidBecomeKey:(NSNotification*)notification { |
642 // We need to activate the controls (in the "WebView"). To do this, get the | 649 // We need to activate the controls (in the "WebView"). To do this, get the |
643 // selected WebContents's RenderWidgetHostView and tell it to activate. | 650 // selected WebContents's RenderWidgetHostView and tell it to activate. |
644 if (WebContents* contents = | 651 if (WebContents* contents = |
645 browser_->tab_strip_model()->GetActiveWebContents()) { | 652 browser_->tab_strip_model()->GetActiveWebContents()) { |
646 | 653 |
647 WebContents* devtools = DevToolsWindow::GetInTabWebContents( | 654 WebContents* devtools = DevToolsWindow::GetInTabWebContents( |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 | 2232 |
2226 - (BOOL)supportsBookmarkBar { | 2233 - (BOOL)supportsBookmarkBar { |
2227 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2234 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2228 } | 2235 } |
2229 | 2236 |
2230 - (BOOL)isTabbedWindow { | 2237 - (BOOL)isTabbedWindow { |
2231 return browser_->is_type_tabbed(); | 2238 return browser_->is_type_tabbed(); |
2232 } | 2239 } |
2233 | 2240 |
2234 @end // @implementation BrowserWindowController(WindowType) | 2241 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |