| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/l10n_util_mac.h" | 8 #include "app/l10n_util_mac.h" |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Activate (bring to foreground) if asked to do so. On | 213 // Activate (bring to foreground) if asked to do so. On |
| 214 // Windows this logic isn't necessary since | 214 // Windows this logic isn't necessary since |
| 215 // BrowserWindow::Activate() calls ::SetForegroundWindow() which is | 215 // BrowserWindow::Activate() calls ::SetForegroundWindow() which is |
| 216 // adequate. On Mac, BrowserWindow::Activate() calls -[NSWindow | 216 // adequate. On Mac, BrowserWindow::Activate() calls -[NSWindow |
| 217 // makeKeyAndOrderFront:] which does not activate the application | 217 // makeKeyAndOrderFront:] which does not activate the application |
| 218 // itself. | 218 // itself. |
| 219 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 219 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 220 if (parsed_command_line.HasSwitch(switches::kActivateOnLaunch)) { | 220 if (parsed_command_line.HasSwitch(switches::kActivateOnLaunch)) { |
| 221 [NSApp activateIgnoringOtherApps:YES]; | 221 [NSApp activateIgnoringOtherApps:YES]; |
| 222 } | 222 } |
| 223 |
| 224 if (!parsed_command_line.HasSwitch(switches::kEnableExposeForTabs)) { |
| 225 [tabposeMenuItem_ setHidden:YES]; |
| 226 } |
| 223 } | 227 } |
| 224 | 228 |
| 225 // (NSApplicationDelegate protocol) This is the Apple-approved place to override | 229 // (NSApplicationDelegate protocol) This is the Apple-approved place to override |
| 226 // the default handlers. | 230 // the default handlers. |
| 227 - (void)applicationWillFinishLaunching:(NSNotification*)notification { | 231 - (void)applicationWillFinishLaunching:(NSNotification*)notification { |
| 228 // Nothing here right now. | 232 // Nothing here right now. |
| 229 } | 233 } |
| 230 | 234 |
| 231 - (BOOL)tryToTerminateApplication:(NSApplication*)app { | 235 - (BOOL)tryToTerminateApplication:(NSApplication*)app { |
| 232 // Check for in-process downloads, and prompt the user if they really want | 236 // Check for in-process downloads, and prompt the user if they really want |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 494 |
| 491 startupComplete_ = YES; | 495 startupComplete_ = YES; |
| 492 | 496 |
| 493 // TODO(viettrungluu): This is very temporary, since this should be done "in" | 497 // TODO(viettrungluu): This is very temporary, since this should be done "in" |
| 494 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the | 498 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the |
| 495 // (probably-empty) list of URLs from the command line. | 499 // (probably-empty) list of URLs from the command line. |
| 496 if (startupUrls_.size()) { | 500 if (startupUrls_.size()) { |
| 497 [self openUrls:startupUrls_]; | 501 [self openUrls:startupUrls_]; |
| 498 [self clearStartupUrls]; | 502 [self clearStartupUrls]; |
| 499 } | 503 } |
| 500 | |
| 501 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | |
| 502 if (!parsed_command_line.HasSwitch(switches::kEnableExposeForTabs)) { | |
| 503 [tabposeMenuItem_ setHidden:YES]; | |
| 504 } | |
| 505 } | 504 } |
| 506 | 505 |
| 507 // This is called after profiles have been loaded and preferences registered. | 506 // This is called after profiles have been loaded and preferences registered. |
| 508 // It is safe to access the default profile here. | 507 // It is safe to access the default profile here. |
| 509 - (void)applicationDidBecomeActive:(NSNotification*)notify { | 508 - (void)applicationDidBecomeActive:(NSNotification*)notify { |
| 510 NotificationService::current()->Notify(NotificationType::APP_ACTIVATED, | 509 NotificationService::current()->Notify(NotificationType::APP_ACTIVATED, |
| 511 NotificationService::AllSources(), | 510 NotificationService::AllSources(), |
| 512 NotificationService::NoDetails()); | 511 NotificationService::NoDetails()); |
| 513 } | 512 } |
| 514 | 513 |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 [appController showPreferencesWindow:nil page:page profile:profile]; | 1079 [appController showPreferencesWindow:nil page:page profile:profile]; |
| 1081 } | 1080 } |
| 1082 | 1081 |
| 1083 namespace app_controller_mac { | 1082 namespace app_controller_mac { |
| 1084 | 1083 |
| 1085 bool IsOpeningNewWindow() { | 1084 bool IsOpeningNewWindow() { |
| 1086 return g_is_opening_new_window; | 1085 return g_is_opening_new_window; |
| 1087 } | 1086 } |
| 1088 | 1087 |
| 1089 } // namespace app_controller_mac | 1088 } // namespace app_controller_mac |
| OLD | NEW |