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