Index: chrome/browser/background_mode_manager_mac.mm |
diff --git a/chrome/browser/background_mode_manager_mac.mm b/chrome/browser/background_mode_manager_mac.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e8b5c3c004f2f05e6863fb515e3808cd5fb877ae |
--- /dev/null |
+++ b/chrome/browser/background_mode_manager_mac.mm |
@@ -0,0 +1,39 @@ |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/app/chrome_command_ids.h" |
+#include "chrome/browser/background_mode_manager.h" |
+#include "grit/generated_resources.h" |
+ |
+#include "base/mac_util.h" |
+ |
+void BackgroundModeManager::DisableLaunchOnStartupTask::Run() { |
+ // If we didn't set Login Item, don't mess with it. |
+ if (!manager_->IsLaunchOnStartupResetAllowed()) |
Andrew T Wilson (Slow)
2010/12/03 02:06:59
See my previous notes - I don't think we can make
The wrong rickcam account
2010/12/04 02:08:04
Done. I've switched to use the family of routines
|
+ return; |
+ manager_->SetLaunchOnStartupResetAllowed(false); |
+ |
+ // Check if Chrome is not a login Item, or is a Login Item but w/o 'hidden' |
+ // flag - most likely user has modified the setting, don't override it. |
+ bool is_hidden = false; |
+ if (!mac_util::CheckLoginItemStatus(&is_hidden) || !is_hidden) |
+ return; |
+ |
+ mac_util::RemoveFromLoginItems(); |
+} |
+ |
+void BackgroundModeManager::EnableLaunchOnStartupTask::Run() { |
+ // Return if Chrome is already a Login Item (avoid overriding user choice). |
+ if (mac_util::CheckLoginItemStatus(NULL)) |
+ return; |
+ |
+ mac_util::AddToLoginItems(true); // Hide on startup. |
+ |
+ // Remember we set Login Item, not the user - so we can reset it later. |
+ manager_->SetLaunchOnStartupResetAllowed(true); |
+} |
+ |
+void BackgroundModeManager::AddPreferencesItem(menus::SimpleMenuModel* menu) { |
+ menu->AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); |
+} |