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 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())-> | 630 auto registry = |
631 set_registry_for_active_window(extension_keybinding_registry_.get()); | 631 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()); |
632 if (registry) { | |
633 registry->set_registry_for_active_window( | |
634 extension_keybinding_registry_.get()); | |
635 } | |
Finnur
2015/01/23 10:49:38
Hmm... I'm not sure this is the right fix...
We s
Andre
2015/01/23 18:24:01
Thanks Finnur.
When recording a shortcut for an ex
| |
632 } | 636 } |
633 | 637 |
634 - (void)windowDidResignMain:(NSNotification*)notification { | 638 - (void)windowDidResignMain:(NSNotification*)notification { |
635 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 639 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
636 // about the active window state should be registering for notifications. | 640 // about the active window state should be registering for notifications. |
637 [[self window] setViewsNeedDisplay:YES]; | 641 [[self window] setViewsNeedDisplay:YES]; |
638 | 642 |
639 // TODO(viettrungluu): For some reason, the above doesn't suffice. | 643 // TODO(viettrungluu): For some reason, the above doesn't suffice. |
640 if ([self isInAnyFullscreenMode]) | 644 if ([self isInAnyFullscreenMode]) |
641 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. | 645 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. |
642 | 646 |
643 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())-> | 647 auto registry = |
644 set_registry_for_active_window(nullptr); | 648 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()); |
649 if (registry) | |
650 registry->set_registry_for_active_window(nullptr); | |
645 } | 651 } |
646 | 652 |
647 // Called when we are activated (when we gain focus). | 653 // Called when we are activated (when we gain focus). |
648 - (void)windowDidBecomeKey:(NSNotification*)notification { | 654 - (void)windowDidBecomeKey:(NSNotification*)notification { |
649 // We need to activate the controls (in the "WebView"). To do this, get the | 655 // We need to activate the controls (in the "WebView"). To do this, get the |
650 // selected WebContents's RenderWidgetHostView and tell it to activate. | 656 // selected WebContents's RenderWidgetHostView and tell it to activate. |
651 if (WebContents* contents = | 657 if (WebContents* contents = |
652 browser_->tab_strip_model()->GetActiveWebContents()) { | 658 browser_->tab_strip_model()->GetActiveWebContents()) { |
653 | 659 |
654 WebContents* devtools = DevToolsWindow::GetInTabWebContents( | 660 WebContents* devtools = DevToolsWindow::GetInTabWebContents( |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2232 | 2238 |
2233 - (BOOL)supportsBookmarkBar { | 2239 - (BOOL)supportsBookmarkBar { |
2234 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2240 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2235 } | 2241 } |
2236 | 2242 |
2237 - (BOOL)isTabbedWindow { | 2243 - (BOOL)isTabbedWindow { |
2238 return browser_->is_type_tabbed(); | 2244 return browser_->is_type_tabbed(); |
2239 } | 2245 } |
2240 | 2246 |
2241 @end // @implementation BrowserWindowController(WindowType) | 2247 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |