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

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

Issue 586613002: Remove AppsClient::GetLoadedBrowserContexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to chrome/browser/apps Created 6 years, 3 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
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"
11 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" 11 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h"
12 #include "chrome/browser/apps/app_window_registry_util.h"
12 #import "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" 13 #import "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h"
13 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
14 #include "extensions/browser/app_window/app_window.h" 15 #include "extensions/browser/app_window/app_window.h"
15 #include "extensions/browser/app_window/app_window_registry.h"
16 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/l10n/l10n_util_mac.h" 18 #include "ui/base/l10n/l10n_util_mac.h"
19 19
20 namespace { 20 namespace {
21 21
22 // Gets an item from the main menu given the tag of the top level item 22 // Gets an item from the main menu given the tag of the top level item
23 // |menu_tag| and the tag of the item |item_tag|. 23 // |menu_tag| and the tag of the item |item_tag|.
24 NSMenuItem* GetItemByTag(NSInteger menu_tag, NSInteger item_tag) { 24 NSMenuItem* GetItemByTag(NSInteger menu_tag, NSInteger item_tag) {
25 return [[[[NSApp mainMenu] itemWithTag:menu_tag] submenu] 25 return [[[[NSApp mainMenu] itemWithTag:menu_tag] submenu]
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // -dealloc for a specific NSWindow. Any autoreleases sent to that window 282 // -dealloc for a specific NSWindow. Any autoreleases sent to that window
283 // must be drained before the window finishes -dealloc. In this method, an 283 // must be drained before the window finishes -dealloc. In this method, an
284 // autorelease is sent by the invocation of [NSApp windows]. 284 // autorelease is sent by the invocation of [NSApp windows].
285 // http://crbug.com/406944. 285 // http://crbug.com/406944.
286 base::mac::ScopedNSAutoreleasePool pool; 286 base::mac::ScopedNSAutoreleasePool pool;
287 287
288 id window = [notification object]; 288 id window = [notification object];
289 NSString* name = [notification name]; 289 NSString* name = [notification name];
290 if ([name isEqualToString:NSWindowDidBecomeMainNotification]) { 290 if ([name isEqualToString:NSWindowDidBecomeMainNotification]) {
291 extensions::AppWindow* appWindow = 291 extensions::AppWindow* appWindow =
292 extensions::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( 292 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile(
293 window); 293 window);
294 294
295 const extensions::Extension* extension = NULL; 295 const extensions::Extension* extension = NULL;
296 if (appWindow) 296 if (appWindow)
297 extension = appWindow->GetExtension(); 297 extension = appWindow->GetExtension();
298 298
299 if (extension) 299 if (extension)
300 [self addMenuItems:extension]; 300 [self addMenuItems:extension];
301 else 301 else
302 [self removeMenuItems]; 302 [self removeMenuItems];
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 [aboutDoppelganger_ disable]; 364 [aboutDoppelganger_ disable];
365 [hideDoppelganger_ disable]; 365 [hideDoppelganger_ disable];
366 [quitDoppelganger_ disable]; 366 [quitDoppelganger_ disable];
367 [newDoppelganger_ disable]; 367 [newDoppelganger_ disable];
368 [openDoppelganger_ disable]; 368 [openDoppelganger_ disable];
369 } 369 }
370 370
371 - (void)quitCurrentPlatformApp { 371 - (void)quitCurrentPlatformApp {
372 extensions::AppWindow* appWindow = 372 extensions::AppWindow* appWindow =
373 extensions::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( 373 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile(
374 [NSApp keyWindow]); 374 [NSApp keyWindow]);
375 if (appWindow) 375 if (appWindow)
376 apps::ExtensionAppShimHandler::QuitAppForWindow(appWindow); 376 apps::ExtensionAppShimHandler::QuitAppForWindow(appWindow);
377 } 377 }
378 378
379 - (void)hideCurrentPlatformApp { 379 - (void)hideCurrentPlatformApp {
380 extensions::AppWindow* appWindow = 380 extensions::AppWindow* appWindow =
381 extensions::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( 381 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile(
382 [NSApp keyWindow]); 382 [NSApp keyWindow]);
383 if (appWindow) 383 if (appWindow)
384 apps::ExtensionAppShimHandler::HideAppForWindow(appWindow); 384 apps::ExtensionAppShimHandler::HideAppForWindow(appWindow);
385 } 385 }
386 386
387 - (void)focusCurrentPlatformApp { 387 - (void)focusCurrentPlatformApp {
388 extensions::AppWindow* appWindow = 388 extensions::AppWindow* appWindow =
389 extensions::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( 389 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile(
390 [NSApp keyWindow]); 390 [NSApp keyWindow]);
391 if (appWindow) 391 if (appWindow)
392 apps::ExtensionAppShimHandler::FocusAppForWindow(appWindow); 392 apps::ExtensionAppShimHandler::FocusAppForWindow(appWindow);
393 } 393 }
394 394
395 @end 395 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698