| 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 } | |
| 227 } | 223 } |
| 228 | 224 |
| 229 // (NSApplicationDelegate protocol) This is the Apple-approved place to override | 225 // (NSApplicationDelegate protocol) This is the Apple-approved place to override |
| 230 // the default handlers. | 226 // the default handlers. |
| 231 - (void)applicationWillFinishLaunching:(NSNotification*)notification { | 227 - (void)applicationWillFinishLaunching:(NSNotification*)notification { |
| 232 // Nothing here right now. | 228 // Nothing here right now. |
| 233 } | 229 } |
| 234 | 230 |
| 235 - (BOOL)tryToTerminateApplication:(NSApplication*)app { | 231 - (BOOL)tryToTerminateApplication:(NSApplication*)app { |
| 236 // Check for in-process downloads, and prompt the user if they really want | 232 // 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... |
| 494 | 490 |
| 495 startupComplete_ = YES; | 491 startupComplete_ = YES; |
| 496 | 492 |
| 497 // TODO(viettrungluu): This is very temporary, since this should be done "in" | 493 // TODO(viettrungluu): This is very temporary, since this should be done "in" |
| 498 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the | 494 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the |
| 499 // (probably-empty) list of URLs from the command line. | 495 // (probably-empty) list of URLs from the command line. |
| 500 if (startupUrls_.size()) { | 496 if (startupUrls_.size()) { |
| 501 [self openUrls:startupUrls_]; | 497 [self openUrls:startupUrls_]; |
| 502 [self clearStartupUrls]; | 498 [self clearStartupUrls]; |
| 503 } | 499 } |
| 500 |
| 501 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 502 if (!parsed_command_line.HasSwitch(switches::kEnableExposeForTabs)) { |
| 503 [tabposeMenuItem_ setHidden:YES]; |
| 504 } |
| 504 } | 505 } |
| 505 | 506 |
| 506 // This is called after profiles have been loaded and preferences registered. | 507 // This is called after profiles have been loaded and preferences registered. |
| 507 // It is safe to access the default profile here. | 508 // It is safe to access the default profile here. |
| 508 - (void)applicationDidBecomeActive:(NSNotification*)notify { | 509 - (void)applicationDidBecomeActive:(NSNotification*)notify { |
| 509 NotificationService::current()->Notify(NotificationType::APP_ACTIVATED, | 510 NotificationService::current()->Notify(NotificationType::APP_ACTIVATED, |
| 510 NotificationService::AllSources(), | 511 NotificationService::AllSources(), |
| 511 NotificationService::NoDetails()); | 512 NotificationService::NoDetails()); |
| 512 } | 513 } |
| 513 | 514 |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 [appController showPreferencesWindow:nil page:page profile:profile]; | 1080 [appController showPreferencesWindow:nil page:page profile:profile]; |
| 1080 } | 1081 } |
| 1081 | 1082 |
| 1082 namespace app_controller_mac { | 1083 namespace app_controller_mac { |
| 1083 | 1084 |
| 1084 bool IsOpeningNewWindow() { | 1085 bool IsOpeningNewWindow() { |
| 1085 return g_is_opening_new_window; | 1086 return g_is_opening_new_window; |
| 1086 } | 1087 } |
| 1087 | 1088 |
| 1088 } // namespace app_controller_mac | 1089 } // namespace app_controller_mac |
| OLD | NEW |