OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/app_shim_menu_controller_mac.h" | 5 #import "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h" |
6 | 6 |
7 #include "base/mac/scoped_nsautorelease_pool.h" | 7 #include "base/mac/scoped_nsautorelease_pool.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 if (extension) | 392 if (extension) |
393 [self addMenuItems:extension]; | 393 [self addMenuItems:extension]; |
394 else | 394 else |
395 [self removeMenuItems]; | 395 [self removeMenuItems]; |
396 } else if ([name isEqualToString:NSWindowWillCloseNotification]) { | 396 } else if ([name isEqualToString:NSWindowWillCloseNotification]) { |
397 // If there are any other windows that can become main, leave the menu. It | 397 // If there are any other windows that can become main, leave the menu. It |
398 // will be changed when another window becomes main. Otherwise, restore the | 398 // will be changed when another window becomes main. Otherwise, restore the |
399 // Chrome menu. | 399 // Chrome menu. |
400 for (NSWindow* w : [NSApp windows]) { | 400 for (NSWindow* w : [NSApp windows]) { |
401 if ([w canBecomeMainWindow] && ![w isEqual:window]) | 401 if ([w canBecomeMainWindow] && ![w isEqual:window] && [w isOnActiveSpace]) |
402 return; | 402 return; |
403 } | 403 } |
404 | 404 |
405 [self removeMenuItems]; | 405 [self removeMenuItems]; |
406 } else { | 406 } else { |
407 NOTREACHED(); | 407 NOTREACHED(); |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 - (void)addMenuItems:(const extensions::Extension*)app { | 411 - (void)addMenuItems:(const extensions::Extension*)app { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 512 |
513 - (void)focusCurrentPlatformApp { | 513 - (void)focusCurrentPlatformApp { |
514 extensions::AppWindow* appWindow = | 514 extensions::AppWindow* appWindow = |
515 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile( | 515 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile( |
516 [NSApp keyWindow]); | 516 [NSApp keyWindow]); |
517 if (appWindow) | 517 if (appWindow) |
518 apps::ExtensionAppShimHandler::FocusAppForWindow(appWindow); | 518 apps::ExtensionAppShimHandler::FocusAppForWindow(appWindow); |
519 } | 519 } |
520 | 520 |
521 @end | 521 @end |
OLD | NEW |