Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm

Issue 1024363002: [Mac] Restore the Chrome main menu if there are no windows on the active space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698