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