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 3 // found in the LICENSE file. 4 5 #include "base/base_paths.h" 6 #include "base/bind.h" 7 #include "base/command_line.h" 8 #include "base/files/file_path.h" 9 #include "base/logging.h" 10 #include "base/path_service.h" 11 #include "base/strings/utf_string_conversions.h" 12 #include "base/win/registry.h" 13 #include "chrome/browser/background/background_mode_manager.h" 14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/installer/util/auto_launch_util.h" 16 #include "content/public/browser/browser_thread.h" 17 #include "grit/chromium_strings.h" 18 #include "grit/generated_resources.h" 19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/gfx/image/image_skia.h" 21 22 using content::BrowserThread; 23 EnableLaunchOnStartup(bool should_launch)24void BackgroundModeManager::EnableLaunchOnStartup(bool should_launch) { 25 // This functionality is only defined for default profile, currently. 26 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserDataDir)) 27 return; 28 BrowserThread::PostTask( 29 BrowserThread::FILE, FROM_HERE, 30 should_launch ? 31 base::Bind(auto_launch_util::EnableBackgroundStartAtLogin) : 32 base::Bind(auto_launch_util::DisableBackgroundStartAtLogin)); 33 } 34 DisplayAppInstalledNotification(const extensions::Extension * extension)35void BackgroundModeManager::DisplayAppInstalledNotification( 36 const extensions::Extension* extension) { 37 // Create a status tray notification balloon explaining to the user that 38 // a background app has been installed. 39 CreateStatusTrayIcon(); 40 status_icon_->DisplayBalloon( 41 gfx::ImageSkia(), 42 l10n_util::GetStringUTF16(IDS_BACKGROUND_APP_INSTALLED_BALLOON_TITLE), 43 l10n_util::GetStringFUTF16( 44 IDS_BACKGROUND_APP_INSTALLED_BALLOON_BODY, 45 UTF8ToUTF16(extension->name()), 46 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); 47 } 48 GetPreferencesMenuLabel()49base::string16 BackgroundModeManager::GetPreferencesMenuLabel() { 50 return l10n_util::GetStringUTF16(IDS_OPTIONS); 51 } 52