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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 1334363002: [Eraser] First pass at removing the notification center panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: peter comments Created 5 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
« no previous file with comments | « no previous file | chrome/browser/background/background_contents_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return cache.ProfileIsSigninRequiredAtIndex(profile_index); 205 return cache.ProfileIsSigninRequiredAtIndex(profile_index);
206 } 206 }
207 207
208 } // namespace 208 } // namespace
209 209
210 @interface AppController () <HandoffActiveURLObserverBridgeDelegate> 210 @interface AppController () <HandoffActiveURLObserverBridgeDelegate>
211 211
212 - (void)initMenuState; 212 - (void)initMenuState;
213 - (void)initProfileMenu; 213 - (void)initProfileMenu;
214 - (void)updateConfirmToQuitPrefMenuItem:(NSMenuItem*)item; 214 - (void)updateConfirmToQuitPrefMenuItem:(NSMenuItem*)item;
215 - (void)updateDisplayMessageCenterPrefMenuItem:(NSMenuItem*)item;
216 - (void)registerServicesMenuTypesTo:(NSApplication*)app; 215 - (void)registerServicesMenuTypesTo:(NSApplication*)app;
217 - (void)getUrl:(NSAppleEventDescriptor*)event 216 - (void)getUrl:(NSAppleEventDescriptor*)event
218 withReply:(NSAppleEventDescriptor*)reply; 217 withReply:(NSAppleEventDescriptor*)reply;
219 - (void)activeSpaceDidChange:(NSNotification*)inNotification; 218 - (void)activeSpaceDidChange:(NSNotification*)inNotification;
220 - (void)checkForAnyKeyWindows; 219 - (void)checkForAnyKeyWindows;
221 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount; 220 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount;
222 - (BOOL)shouldQuitWithInProgressDownloads; 221 - (BOOL)shouldQuitWithInProgressDownloads;
223 - (void)executeApplication:(id)sender; 222 - (void)executeApplication:(id)sender;
224 - (void)profileWasRemoved:(const base::FilePath&)profilePath; 223 - (void)profileWasRemoved:(const base::FilePath&)profilePath;
225 224
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 } else if (action == @selector(showPreferences:)) { 992 } else if (action == @selector(showPreferences:)) {
994 enable = YES; 993 enable = YES;
995 } else if (action == @selector(orderFrontStandardAboutPanel:)) { 994 } else if (action == @selector(orderFrontStandardAboutPanel:)) {
996 enable = YES; 995 enable = YES;
997 } else if (action == @selector(commandFromDock:)) { 996 } else if (action == @selector(commandFromDock:)) {
998 enable = YES; 997 enable = YES;
999 } else if (action == @selector(toggleConfirmToQuit:)) { 998 } else if (action == @selector(toggleConfirmToQuit:)) {
1000 [self updateConfirmToQuitPrefMenuItem:static_cast<NSMenuItem*>(item)]; 999 [self updateConfirmToQuitPrefMenuItem:static_cast<NSMenuItem*>(item)];
1001 enable = YES; 1000 enable = YES;
1002 } else if (action == @selector(toggleDisplayMessageCenter:)) { 1001 } else if (action == @selector(toggleDisplayMessageCenter:)) {
1003 NSMenuItem* menuItem = static_cast<NSMenuItem*>(item); 1002 // TODO(dewittj): Remove this (see crbug.com/530376) with a separate update
1004 [self updateDisplayMessageCenterPrefMenuItem:menuItem]; 1003 // to the xib file.
1005 enable = YES; 1004 enable = NO;
1006 } else if (action == @selector(executeApplication:)) { 1005 } else if (action == @selector(executeApplication:)) {
1007 enable = YES; 1006 enable = YES;
1008 } 1007 }
1009 return enable; 1008 return enable;
1010 } 1009 }
1011 1010
1012 // Called when the user picks a menu item when there are no key windows, or when 1011 // Called when the user picks a menu item when there are no key windows, or when
1013 // there is no foreground browser window. Calls through to the browser object to 1012 // there is no foreground browser window. Calls through to the browser object to
1014 // execute the command. This assumes that the command is supported and doesn't 1013 // execute the command. This assumes that the command is supported and doesn't
1015 // check, otherwise it should have been disabled in the UI in 1014 // check, otherwise it should have been disabled in the UI in
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 NSString* acceleratorString = [ConfirmQuitPanelController keyCommandString]; 1318 NSString* acceleratorString = [ConfirmQuitPanelController keyCommandString];
1320 NSString* title = l10n_util::GetNSStringF(IDS_CONFIRM_TO_QUIT_OPTION, 1319 NSString* title = l10n_util::GetNSStringF(IDS_CONFIRM_TO_QUIT_OPTION,
1321 base::SysNSStringToUTF16(acceleratorString)); 1320 base::SysNSStringToUTF16(acceleratorString));
1322 [item setTitle:title]; 1321 [item setTitle:title];
1323 1322
1324 const PrefService* prefService = g_browser_process->local_state(); 1323 const PrefService* prefService = g_browser_process->local_state();
1325 bool enabled = prefService->GetBoolean(prefs::kConfirmToQuitEnabled); 1324 bool enabled = prefService->GetBoolean(prefs::kConfirmToQuitEnabled);
1326 [item setState:enabled ? NSOnState : NSOffState]; 1325 [item setState:enabled ? NSOnState : NSOffState];
1327 } 1326 }
1328 1327
1329 - (void)updateDisplayMessageCenterPrefMenuItem:(NSMenuItem*)item {
1330 const PrefService* prefService = g_browser_process->local_state();
1331 bool enabled = prefService->GetBoolean(prefs::kMessageCenterShowIcon);
1332 // The item should be checked if "show icon" is false, since the text reads
1333 // "Hide notification center icon."
1334 [item setState:enabled ? NSOffState : NSOnState];
1335 }
1336
1337 - (void)registerServicesMenuTypesTo:(NSApplication*)app { 1328 - (void)registerServicesMenuTypesTo:(NSApplication*)app {
1338 // Note that RenderWidgetHostViewCocoa implements NSServicesRequests which 1329 // Note that RenderWidgetHostViewCocoa implements NSServicesRequests which
1339 // handles requests from services. 1330 // handles requests from services.
1340 NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil]; 1331 NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil];
1341 [app registerServicesMenuSendTypes:types returnTypes:types]; 1332 [app registerServicesMenuSendTypes:types returnTypes:types];
1342 } 1333 }
1343 1334
1344 - (Profile*)lastProfile { 1335 - (Profile*)lastProfile {
1345 // Return the profile of the last-used Browser, if available. 1336 // Return the profile of the last-used Browser, if available.
1346 if (lastProfile_) 1337 if (lastProfile_)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 } 1451 }
1461 } 1452 }
1462 1453
1463 - (IBAction)toggleConfirmToQuit:(id)sender { 1454 - (IBAction)toggleConfirmToQuit:(id)sender {
1464 PrefService* prefService = g_browser_process->local_state(); 1455 PrefService* prefService = g_browser_process->local_state();
1465 bool enabled = prefService->GetBoolean(prefs::kConfirmToQuitEnabled); 1456 bool enabled = prefService->GetBoolean(prefs::kConfirmToQuitEnabled);
1466 prefService->SetBoolean(prefs::kConfirmToQuitEnabled, !enabled); 1457 prefService->SetBoolean(prefs::kConfirmToQuitEnabled, !enabled);
1467 } 1458 }
1468 1459
1469 - (IBAction)toggleDisplayMessageCenter:(id)sender { 1460 - (IBAction)toggleDisplayMessageCenter:(id)sender {
1470 PrefService* prefService = g_browser_process->local_state(); 1461 // TODO(dewittj): Remove this (see crbug.com/530376) with a separate update to
1471 bool enabled = prefService->GetBoolean(prefs::kMessageCenterShowIcon); 1462 // the xib file.
1472 prefService->SetBoolean(prefs::kMessageCenterShowIcon, !enabled);
1473 } 1463 }
1474 1464
1475 // Explicitly bring to the foreground when creating new windows from the dock. 1465 // Explicitly bring to the foreground when creating new windows from the dock.
1476 - (void)commandFromDock:(id)sender { 1466 - (void)commandFromDock:(id)sender {
1477 [NSApp activateIgnoringOtherApps:YES]; 1467 [NSApp activateIgnoringOtherApps:YES];
1478 [self commandDispatch:sender]; 1468 [self commandDispatch:sender];
1479 } 1469 }
1480 1470
1481 - (NSMenu*)applicationDockMenu:(NSApplication*)sender { 1471 - (NSMenu*)applicationDockMenu:(NSApplication*)sender {
1482 NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease]; 1472 NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease];
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 1710
1721 //--------------------------------------------------------------------------- 1711 //---------------------------------------------------------------------------
1722 1712
1723 namespace app_controller_mac { 1713 namespace app_controller_mac {
1724 1714
1725 bool IsOpeningNewWindow() { 1715 bool IsOpeningNewWindow() {
1726 return g_is_opening_new_window; 1716 return g_is_opening_new_window;
1727 } 1717 }
1728 1718
1729 } // namespace app_controller_mac 1719 } // namespace app_controller_mac
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/background/background_contents_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698